diff --git a/mediapipe/examples/ios/objectclassificationgpu/BUILD b/mediapipe/examples/ios/objectclassificationgpu/BUILD new file mode 100644 index 000000000..8228f0046 --- /dev/null +++ b/mediapipe/examples/ios/objectclassificationgpu/BUILD @@ -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", + ], + }), +) diff --git a/mediapipe/examples/ios/objectclassificationgpu/Info.plist b/mediapipe/examples/ios/objectclassificationgpu/Info.plist new file mode 100644 index 000000000..9dfa563ef --- /dev/null +++ b/mediapipe/examples/ios/objectclassificationgpu/Info.plist @@ -0,0 +1,16 @@ + + + + + CameraPosition + back + GraphName + mobile_gpu + GraphOutputStream + output_video + GraphInputStream + input_video + VideoName + object_classification + + diff --git a/mediapipe/graphs/object_classification/BUILD b/mediapipe/graphs/object_classification/BUILD index dc1552659..44b431876 100644 --- a/mediapipe/graphs/object_classification/BUILD +++ b/mediapipe/graphs/object_classification/BUILD @@ -13,11 +13,20 @@ # limitations under the License. load("@rules_cc//cc:defs.bzl", "cc_library") +load( + "//mediapipe/framework/tool:mediapipe_graph.bzl", + "mediapipe_binary_graph", +) licenses(["notice"]) package(default_visibility = ["//visibility:public"]) +cc_library( + name = "mobile_calculators", + deps = [":desktop_pytorch_calculators"], +) + cc_library( name = "desktop_pytorch_calculators", deps = [ @@ -30,3 +39,10 @@ cc_library( "//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"], +)