iOS example: objectclassificationgpu

Signed-off-by: Pierre Fenoll <pierrefenoll@gmail.com>
This commit is contained in:
Pierre Fenoll 2020-10-18 17:27:20 +02:00
parent 1f121dd3eb
commit 93cf6d93a0
3 changed files with 103 additions and 0 deletions

View File

@ -0,0 +1,71 @@
# Copyright 2020 The MediaPipe Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
load("@rules_cc//cc:defs.bzl", "objc_library")
load(
"@build_bazel_rules_apple//apple:ios.bzl",
"ios_application",
)
load(
"//mediapipe/examples/ios:bundle_id.bzl",
"BUNDLE_ID_PREFIX",
"example_provisioning",
)
licenses(["notice"]) # Apache 2.0
MIN_IOS_VERSION = "10.0"
alias(
name = "objectclassificationgpu",
actual = "ObjectClassificationGpuApp",
)
ios_application(
name = "ObjectClassificationGpuApp",
app_icons = ["//mediapipe/examples/ios/common:AppIcon"],
bundle_id = BUNDLE_ID_PREFIX + ".ObjectClassificationGpu",
families = [
"iphone",
"ipad",
],
infoplists = [
"//mediapipe/examples/ios/common:Info.plist",
"Info.plist",
],
minimum_os_version = MIN_IOS_VERSION,
provisioning_profile = example_provisioning(),
deps = [
":ObjectClassificationGpuAppLibrary",
"@ios_opencv//:OpencvFramework",
],
)
objc_library(
name = "ObjectClassificationGpuAppLibrary",
data = [
"//mediapipe/graphs/object_classification:mobile_gpu_binary_graph",
"//mediapipe/models:mobilenetv2.labelmap",
"//mediapipe/models:mobilenetv2.pt",
],
deps = [
"//mediapipe/examples/ios/common:CommonMediaPipeAppLibrary",
] + select({
"//mediapipe:ios_i386": [],
"//mediapipe:ios_x86_64": [],
"//conditions:default": [
"//mediapipe/graphs/object_classification:mobile_calculators",
],
}),
)

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CameraPosition</key>
<string>back</string>
<key>GraphName</key>
<string>mobile_gpu</string>
<key>GraphOutputStream</key>
<string>output_video</string>
<key>GraphInputStream</key>
<string>input_video</string>
<key>VideoName</key>
<string>object_classification</string>
</dict>
</plist>

View File

@ -13,11 +13,20 @@
# limitations under the License. # limitations under the License.
load("@rules_cc//cc:defs.bzl", "cc_library") load("@rules_cc//cc:defs.bzl", "cc_library")
load(
"//mediapipe/framework/tool:mediapipe_graph.bzl",
"mediapipe_binary_graph",
)
licenses(["notice"]) licenses(["notice"])
package(default_visibility = ["//visibility:public"]) package(default_visibility = ["//visibility:public"])
cc_library(
name = "mobile_calculators",
deps = [":desktop_pytorch_calculators"],
)
cc_library( cc_library(
name = "desktop_pytorch_calculators", name = "desktop_pytorch_calculators",
deps = [ deps = [
@ -30,3 +39,10 @@ cc_library(
"//mediapipe/calculators/util:labels_to_render_data_calculator", "//mediapipe/calculators/util:labels_to_render_data_calculator",
], ],
) )
mediapipe_binary_graph(
name = "mobile_gpu_binary_graph",
graph = "object_detection_mobile_gpu.pbtxt",
output_name = "mobile_gpu.binarypb",
deps = [":mobile_calculators"],
)