diff --git a/Assets/MediaPipe/Examples/Graphs/BoxTracking.meta b/Assets/MediaPipe/Examples/Graphs/BoxTracking.meta new file mode 100644 index 000000000..49dd7f74c --- /dev/null +++ b/Assets/MediaPipe/Examples/Graphs/BoxTracking.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6bb25818e0b42456084c617cfc37558f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MediaPipe/Examples/Graphs/BoxTracking/Objects.meta b/Assets/MediaPipe/Examples/Graphs/BoxTracking/Objects.meta new file mode 100644 index 000000000..82fa32886 --- /dev/null +++ b/Assets/MediaPipe/Examples/Graphs/BoxTracking/Objects.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0e6905054e8ff390b882957f1898525c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MediaPipe/Examples/Graphs/BoxTracking/Objects/BoxTrackingAndroid.prefab b/Assets/MediaPipe/Examples/Graphs/BoxTracking/Objects/BoxTrackingAndroid.prefab new file mode 100644 index 000000000..a9b1f56e5 --- /dev/null +++ b/Assets/MediaPipe/Examples/Graphs/BoxTracking/Objects/BoxTrackingAndroid.prefab @@ -0,0 +1,76 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1001 &1846855216083955463 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: -7921388173539795924, guid: 5a41994360993fec9acff375b639b07a, + type: 3} + propertyPath: config + value: + objectReference: {fileID: 4900000, guid: 05b9bdfe04f2582629927f10db8a53e8, type: 3} + - target: {fileID: 2660707083848588740, guid: 5a41994360993fec9acff375b639b07a, + type: 3} + propertyPath: m_RootOrder + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2660707083848588740, guid: 5a41994360993fec9acff375b639b07a, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2660707083848588740, guid: 5a41994360993fec9acff375b639b07a, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2660707083848588740, guid: 5a41994360993fec9acff375b639b07a, + type: 3} + propertyPath: m_LocalPosition.z + value: -10 + objectReference: {fileID: 0} + - target: {fileID: 2660707083848588740, guid: 5a41994360993fec9acff375b639b07a, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 2660707083848588740, guid: 5a41994360993fec9acff375b639b07a, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2660707083848588740, guid: 5a41994360993fec9acff375b639b07a, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2660707083848588740, guid: 5a41994360993fec9acff375b639b07a, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2660707083848588740, guid: 5a41994360993fec9acff375b639b07a, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2660707083848588740, guid: 5a41994360993fec9acff375b639b07a, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2660707083848588740, guid: 5a41994360993fec9acff375b639b07a, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2660707083848588742, guid: 5a41994360993fec9acff375b639b07a, + type: 3} + propertyPath: m_Name + value: OfficialDemoAndroid Variant + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 5a41994360993fec9acff375b639b07a, type: 3} diff --git a/Assets/MediaPipe/Examples/Graphs/BoxTracking/Objects/BoxTrackingAndroid.prefab.meta b/Assets/MediaPipe/Examples/Graphs/BoxTracking/Objects/BoxTrackingAndroid.prefab.meta new file mode 100644 index 000000000..8f56c9b61 --- /dev/null +++ b/Assets/MediaPipe/Examples/Graphs/BoxTracking/Objects/BoxTrackingAndroid.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: e741b626b1a478b4eac37623913cd0f0 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MediaPipe/Examples/Graphs/BoxTracking/Objects/BoxTrackingDesktopCPU.prefab b/Assets/MediaPipe/Examples/Graphs/BoxTracking/Objects/BoxTrackingDesktopCPU.prefab new file mode 100644 index 000000000..fe35f9a9d --- /dev/null +++ b/Assets/MediaPipe/Examples/Graphs/BoxTracking/Objects/BoxTrackingDesktopCPU.prefab @@ -0,0 +1,76 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1001 &3981244882400930969 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 1167823613918641047, guid: bcbe21b0464e9b73ea37d18add25baf5, + type: 3} + propertyPath: config + value: + objectReference: {fileID: 4900000, guid: 26045758a7804d813a7663843e829ee2, type: 3} + - target: {fileID: 8080420373148060848, guid: bcbe21b0464e9b73ea37d18add25baf5, + type: 3} + propertyPath: m_RootOrder + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8080420373148060848, guid: bcbe21b0464e9b73ea37d18add25baf5, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8080420373148060848, guid: bcbe21b0464e9b73ea37d18add25baf5, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8080420373148060848, guid: bcbe21b0464e9b73ea37d18add25baf5, + type: 3} + propertyPath: m_LocalPosition.z + value: -10 + objectReference: {fileID: 0} + - target: {fileID: 8080420373148060848, guid: bcbe21b0464e9b73ea37d18add25baf5, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8080420373148060848, guid: bcbe21b0464e9b73ea37d18add25baf5, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8080420373148060848, guid: bcbe21b0464e9b73ea37d18add25baf5, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8080420373148060848, guid: bcbe21b0464e9b73ea37d18add25baf5, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8080420373148060848, guid: bcbe21b0464e9b73ea37d18add25baf5, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8080420373148060848, guid: bcbe21b0464e9b73ea37d18add25baf5, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8080420373148060848, guid: bcbe21b0464e9b73ea37d18add25baf5, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8080420373148060850, guid: bcbe21b0464e9b73ea37d18add25baf5, + type: 3} + propertyPath: m_Name + value: OfficialDemoDesktopCPU Variant + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: bcbe21b0464e9b73ea37d18add25baf5, type: 3} diff --git a/Assets/MediaPipe/Examples/Graphs/BoxTracking/Objects/BoxTrackingDesktopCPU.prefab.meta b/Assets/MediaPipe/Examples/Graphs/BoxTracking/Objects/BoxTrackingDesktopCPU.prefab.meta new file mode 100644 index 000000000..b8cc8d891 --- /dev/null +++ b/Assets/MediaPipe/Examples/Graphs/BoxTracking/Objects/BoxTrackingDesktopCPU.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: f60d076394a0fff98aa7376e6a373608 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MediaPipe/Examples/Graphs/BoxTracking/Objects/BoxTrackingDesktopGPU.prefab b/Assets/MediaPipe/Examples/Graphs/BoxTracking/Objects/BoxTrackingDesktopGPU.prefab new file mode 100644 index 000000000..9f1a329dc --- /dev/null +++ b/Assets/MediaPipe/Examples/Graphs/BoxTracking/Objects/BoxTrackingDesktopGPU.prefab @@ -0,0 +1,76 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1001 &1746814465944258415 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: -5853697970282788592, guid: fc49226dfd774c66faf8a3dd6be53d0f, + type: 3} + propertyPath: config + value: + objectReference: {fileID: 4900000, guid: 40b02bc7786abbb10995a02065f86ee8, type: 3} + - target: {fileID: 5680418270291803701, guid: fc49226dfd774c66faf8a3dd6be53d0f, + type: 3} + propertyPath: m_Name + value: OfficialDemoDesktopGPU Variant + objectReference: {fileID: 0} + - target: {fileID: 5680418270291803703, guid: fc49226dfd774c66faf8a3dd6be53d0f, + type: 3} + propertyPath: m_RootOrder + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5680418270291803703, guid: fc49226dfd774c66faf8a3dd6be53d0f, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5680418270291803703, guid: fc49226dfd774c66faf8a3dd6be53d0f, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5680418270291803703, guid: fc49226dfd774c66faf8a3dd6be53d0f, + type: 3} + propertyPath: m_LocalPosition.z + value: -10 + objectReference: {fileID: 0} + - target: {fileID: 5680418270291803703, guid: fc49226dfd774c66faf8a3dd6be53d0f, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5680418270291803703, guid: fc49226dfd774c66faf8a3dd6be53d0f, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5680418270291803703, guid: fc49226dfd774c66faf8a3dd6be53d0f, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5680418270291803703, guid: fc49226dfd774c66faf8a3dd6be53d0f, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5680418270291803703, guid: fc49226dfd774c66faf8a3dd6be53d0f, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5680418270291803703, guid: fc49226dfd774c66faf8a3dd6be53d0f, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5680418270291803703, guid: fc49226dfd774c66faf8a3dd6be53d0f, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: fc49226dfd774c66faf8a3dd6be53d0f, type: 3} diff --git a/Assets/MediaPipe/Examples/Graphs/BoxTracking/Objects/BoxTrackingDesktopGPU.prefab.meta b/Assets/MediaPipe/Examples/Graphs/BoxTracking/Objects/BoxTrackingDesktopGPU.prefab.meta new file mode 100644 index 000000000..f8324db81 --- /dev/null +++ b/Assets/MediaPipe/Examples/Graphs/BoxTracking/Objects/BoxTrackingDesktopGPU.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 044e1cba0ae838e6db69f9166320db5a +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MediaPipe/Examples/Graphs/BoxTracking/Objects/BoxTrackingIOS.prefab b/Assets/MediaPipe/Examples/Graphs/BoxTracking/Objects/BoxTrackingIOS.prefab new file mode 100644 index 000000000..c2d893841 --- /dev/null +++ b/Assets/MediaPipe/Examples/Graphs/BoxTracking/Objects/BoxTrackingIOS.prefab @@ -0,0 +1,76 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1001 &8395530765531832735 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 629608919476140849, guid: 7d75ba64ea250846eb3ae0b6bba7db41, + type: 3} + propertyPath: config + value: + objectReference: {fileID: 4900000, guid: 40b02bc7786abbb10995a02065f86ee8, type: 3} + - target: {fileID: 8357887090699154473, guid: 7d75ba64ea250846eb3ae0b6bba7db41, + type: 3} + propertyPath: m_RootOrder + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8357887090699154473, guid: 7d75ba64ea250846eb3ae0b6bba7db41, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8357887090699154473, guid: 7d75ba64ea250846eb3ae0b6bba7db41, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8357887090699154473, guid: 7d75ba64ea250846eb3ae0b6bba7db41, + type: 3} + propertyPath: m_LocalPosition.z + value: -10 + objectReference: {fileID: 0} + - target: {fileID: 8357887090699154473, guid: 7d75ba64ea250846eb3ae0b6bba7db41, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8357887090699154473, guid: 7d75ba64ea250846eb3ae0b6bba7db41, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8357887090699154473, guid: 7d75ba64ea250846eb3ae0b6bba7db41, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8357887090699154473, guid: 7d75ba64ea250846eb3ae0b6bba7db41, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8357887090699154473, guid: 7d75ba64ea250846eb3ae0b6bba7db41, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8357887090699154473, guid: 7d75ba64ea250846eb3ae0b6bba7db41, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8357887090699154473, guid: 7d75ba64ea250846eb3ae0b6bba7db41, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8357887090699154475, guid: 7d75ba64ea250846eb3ae0b6bba7db41, + type: 3} + propertyPath: m_Name + value: OfficialDemoIOS Variant + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 7d75ba64ea250846eb3ae0b6bba7db41, type: 3} diff --git a/Assets/MediaPipe/Examples/Graphs/BoxTracking/Objects/BoxTrackingIOS.prefab.meta b/Assets/MediaPipe/Examples/Graphs/BoxTracking/Objects/BoxTrackingIOS.prefab.meta new file mode 100644 index 000000000..84185c8c4 --- /dev/null +++ b/Assets/MediaPipe/Examples/Graphs/BoxTracking/Objects/BoxTrackingIOS.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: af2f5b06ef13278759b6c1cd8475a7f3 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MediaPipe/Examples/Graphs/BoxTracking/Resources.meta b/Assets/MediaPipe/Examples/Graphs/BoxTracking/Resources.meta new file mode 100644 index 000000000..5f51fb7ae --- /dev/null +++ b/Assets/MediaPipe/Examples/Graphs/BoxTracking/Resources.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8ef252059d4084724b4f906513e31950 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MediaPipe/Examples/Graphs/BoxTracking/Resources/box_tracking_android.txt b/Assets/MediaPipe/Examples/Graphs/BoxTracking/Resources/box_tracking_android.txt new file mode 100644 index 000000000..ab29f1be1 --- /dev/null +++ b/Assets/MediaPipe/Examples/Graphs/BoxTracking/Resources/box_tracking_android.txt @@ -0,0 +1,89 @@ +# Copyright 2019 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. + +# Copied from mediapipe/graphs/tracking/object_detection_tracking_mobile_gpu.pbtxt. +# +# CHANGES: +# - Add ImageTransformationCalculator and rotate the input +# - Add GlScalerCalculator and flips the output + +# MediaPipe graph that performs object detection and tracking with TensorFlow +# Lite on GPU. +# Used in the examples in +# mediapipie/examples/android/src/java/com/mediapipe/apps/objecttrackinggpu + +# Images on GPU coming into and out of the graph. +input_stream: "input_video" +output_stream: "output_video" + +node: { + calculator: "ImageTransformationCalculator" + input_stream: "IMAGE_GPU:input_video" + output_stream: "IMAGE_GPU:transformed_input_video" + node_options: { + [type.googleapis.com/mediapipe.ImageTransformationCalculatorOptions] { + rotation_mode: 3 + } + } +} + +# Resamples the images by specific frame rate. This calculator is used to +# control the frequecy of subsequent calculators/subgraphs, e.g. less power +# consumption for expensive process. +node { + calculator: "PacketResamplerCalculator" + input_stream: "DATA:transformed_input_video" + output_stream: "DATA:throttled_input_video" + node_options: { + [type.googleapis.com/mediapipe.PacketResamplerCalculatorOptions] { + frame_rate: 0.5 + } + } +} + +# Subgraph that detections objects (see object_detection_gpu.pbtxt). +node { + calculator: "ObjectDetectionSubgraphGpu" + input_stream: "IMAGE:throttled_input_video" + output_stream: "DETECTIONS:output_detections" +} + +# Subgraph that tracks objects (see object_tracking_gpu.pbtxt). +node { + calculator: "ObjectTrackingSubgraphGpu" + input_stream: "VIDEO:transformed_input_video" + input_stream: "DETECTIONS:output_detections" + output_stream: "DETECTIONS:tracked_detections" +} + +# Subgraph that renders annotations and overlays them on top of the input +# images (see renderer_gpu.pbtxt). +node { + calculator: "RendererSubgraphGpu" + input_stream: "IMAGE:transformed_input_video" + input_stream: "DETECTIONS:tracked_detections" + output_stream: "IMAGE:output_video_raw" +} + +# Flip vertically because the output image is aligned from top-left to bottom-right. +node: { + calculator: "GlScalerCalculator" + input_stream: "VIDEO:output_video_raw" + output_stream: "VIDEO:output_video" + node_options: { + [type.googleapis.com/mediapipe.GlScalerCalculatorOptions] { + flip_vertical: true + } + } +} diff --git a/Assets/MediaPipe/Examples/Graphs/BoxTracking/Resources/box_tracking_android.txt.meta b/Assets/MediaPipe/Examples/Graphs/BoxTracking/Resources/box_tracking_android.txt.meta new file mode 100644 index 000000000..cc72a622f --- /dev/null +++ b/Assets/MediaPipe/Examples/Graphs/BoxTracking/Resources/box_tracking_android.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 05b9bdfe04f2582629927f10db8a53e8 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MediaPipe/Examples/Graphs/BoxTracking/Resources/box_tracking_desktop_cpu.txt b/Assets/MediaPipe/Examples/Graphs/BoxTracking/Resources/box_tracking_desktop_cpu.txt new file mode 100644 index 000000000..1e78617c9 --- /dev/null +++ b/Assets/MediaPipe/Examples/Graphs/BoxTracking/Resources/box_tracking_desktop_cpu.txt @@ -0,0 +1,86 @@ +# Copyright 2019 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. + +# Copied from mediapipe/graphs/tracking/object_detection_tracking_desktop_live.pbtxt +# +# CHANGES: +# - ImageTransformationCalculator rotates the input and flips the output + +# MediaPipe graph that performs object detection and tracking with TensorFlow +# Lite on CPU. +# Used in the examples in +# mediapipie/examples/desktop/object_tracking/ + +# Images on CPU coming into and out of the graph. +input_stream: "input_video" +output_stream: "output_video" + +node: { + calculator: "ImageTransformationCalculator" + input_stream: "IMAGE:input_video" + output_stream: "IMAGE:transformed_input_video" + node_options: { + [type.googleapis.com/mediapipe.ImageTransformationCalculatorOptions] { + rotation_mode: 3 + } + } +} + +# Resamples the images by specific frame rate. This calculator is used to +# control the frequecy of subsequent calculators/subgraphs, e.g. less power +# consumption for expensive process. +node { + calculator: "PacketResamplerCalculator" + input_stream: "DATA:transformed_input_video" + output_stream: "DATA:throttled_input_video" + node_options: { + [type.googleapis.com/mediapipe.PacketResamplerCalculatorOptions] { + frame_rate: 3 + } + } +} + +# Subgraph that detections objects (see object_detection_cpu.pbtxt). +node { + calculator: "ObjectDetectionSubgraphCpu" + input_stream: "IMAGE:throttled_input_video" + output_stream: "DETECTIONS:output_detections" +} + +# Subgraph that tracks objects (see object_tracking_cpu.pbtxt). +node { + calculator: "ObjectTrackingSubgraphCpu" + input_stream: "VIDEO:transformed_input_video" + input_stream: "DETECTIONS:output_detections" + output_stream: "DETECTIONS:tracked_detections" +} + +# Subgraph that renders annotations and overlays them on top of input images (see renderer_cpu.pbtxt). +node { + calculator: "RendererSubgraphCpu" + input_stream: "IMAGE:transformed_input_video" + input_stream: "DETECTIONS:tracked_detections" + output_stream: "IMAGE:output_video_raw" +} + +node: { + calculator: "ImageTransformationCalculator" + input_stream: "IMAGE:output_video_raw" + output_stream: "IMAGE:output_video" + node_options: { + [type.googleapis.com/mediapipe.ImageTransformationCalculatorOptions] { + flip_vertically: true + } + } +} diff --git a/Assets/MediaPipe/Examples/Graphs/BoxTracking/Resources/box_tracking_desktop_cpu.txt.meta b/Assets/MediaPipe/Examples/Graphs/BoxTracking/Resources/box_tracking_desktop_cpu.txt.meta new file mode 100644 index 000000000..9f262804d --- /dev/null +++ b/Assets/MediaPipe/Examples/Graphs/BoxTracking/Resources/box_tracking_desktop_cpu.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 26045758a7804d813a7663843e829ee2 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MediaPipe/Examples/Graphs/BoxTracking/Resources/box_tracking_desktop_gpu.txt b/Assets/MediaPipe/Examples/Graphs/BoxTracking/Resources/box_tracking_desktop_gpu.txt new file mode 100644 index 000000000..86035ee69 --- /dev/null +++ b/Assets/MediaPipe/Examples/Graphs/BoxTracking/Resources/box_tracking_desktop_gpu.txt @@ -0,0 +1,101 @@ +# Copyright 2019 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. + +# Copied from mediapipe/graphs/tracking/object_detection_tracking_mobile_gpu.pbtxt +# +# CHANGES: +# - `input_video` is ImageFrame (ImageFrameToGpuBufferCalculator converts it into GpuBuffer) +# - ImageTransformationCalculator rotates the input and flips the output +# - `output_video` is ImageFrame + +# MediaPipe graph that performs object detection and tracking with TensorFlow +# Lite on GPU. +# Used in the examples in +# mediapipie/examples/android/src/java/com/mediapipe/apps/objecttrackinggpu + +# Images on GPU coming into and out of the graph. +input_stream: "input_video" +output_stream: "output_video" + +node: { + calculator: "ImageFrameToGpuBufferCalculator" + input_stream: "input_video" + output_stream: "input_video_gpu" +} + +node: { + calculator: "ImageTransformationCalculator" + input_stream: "IMAGE_GPU:input_video_gpu" + output_stream: "IMAGE_GPU:transformed_input_video" + node_options: { + [type.googleapis.com/mediapipe.ImageTransformationCalculatorOptions] { + rotation_mode: 3 + } + } +} + +# Resamples the images by specific frame rate. This calculator is used to +# control the frequecy of subsequent calculators/subgraphs, e.g. less power +# consumption for expensive process. +node { + calculator: "PacketResamplerCalculator" + input_stream: "DATA:transformed_input_video" + output_stream: "DATA:throttled_input_video" + node_options: { + [type.googleapis.com/mediapipe.PacketResamplerCalculatorOptions] { + frame_rate: 0.5 + } + } +} + +# Subgraph that detections objects (see object_detection_gpu.pbtxt). +node { + calculator: "ObjectDetectionSubgraphGpu" + input_stream: "IMAGE:throttled_input_video" + output_stream: "DETECTIONS:output_detections" +} + +# Subgraph that tracks objects (see object_tracking_gpu.pbtxt). +node { + calculator: "ObjectTrackingSubgraphGpu" + input_stream: "VIDEO:transformed_input_video" + input_stream: "DETECTIONS:output_detections" + output_stream: "DETECTIONS:tracked_detections" +} + +# Subgraph that renders annotations and overlays them on top of the input +# images (see renderer_gpu.pbtxt). +node { + calculator: "RendererSubgraphGpu" + input_stream: "IMAGE:transformed_input_video" + input_stream: "DETECTIONS:tracked_detections" + output_stream: "IMAGE:output_video_raw" +} + +node: { + calculator: "ImageTransformationCalculator" + input_stream: "IMAGE_GPU:output_video_raw" + output_stream: "IMAGE_GPU:output_video_gpu" + node_options: { + [type.googleapis.com/mediapipe.ImageTransformationCalculatorOptions] { + flip_vertically: true + } + } +} + +node: { + calculator: "GpuBufferToImageFrameCalculator" + input_stream: "output_video_gpu" + output_stream: "output_video" +} diff --git a/Assets/MediaPipe/Examples/Graphs/BoxTracking/Resources/box_tracking_desktop_gpu.txt.meta b/Assets/MediaPipe/Examples/Graphs/BoxTracking/Resources/box_tracking_desktop_gpu.txt.meta new file mode 100644 index 000000000..9bf623c77 --- /dev/null +++ b/Assets/MediaPipe/Examples/Graphs/BoxTracking/Resources/box_tracking_desktop_gpu.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 40b02bc7786abbb10995a02065f86ee8 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MediaPipe/Examples/Graphs/ObjectDetection/Scripts/ObjectDetectionGraph.cs b/Assets/MediaPipe/Examples/Graphs/ObjectDetection/Scripts/ObjectDetectionGraph.cs index 0840d039b..2617be9cf 100644 --- a/Assets/MediaPipe/Examples/Graphs/ObjectDetection/Scripts/ObjectDetectionGraph.cs +++ b/Assets/MediaPipe/Examples/Graphs/ObjectDetection/Scripts/ObjectDetectionGraph.cs @@ -1,6 +1,5 @@ using Mediapipe; using System.Collections.Generic; -using UnityEngine; public class ObjectDetectionGraph : DemoGraph { private const string outputDetectionsStream = "output_detections"; diff --git a/Assets/MediaPipe/Examples/Graphs/OfficialDemo/Resources/official_demo_desktop_gpu.txt b/Assets/MediaPipe/Examples/Graphs/OfficialDemo/Resources/official_demo_desktop_gpu.txt index 54ef0d3d1..29a045722 100644 --- a/Assets/MediaPipe/Examples/Graphs/OfficialDemo/Resources/official_demo_desktop_gpu.txt +++ b/Assets/MediaPipe/Examples/Graphs/OfficialDemo/Resources/official_demo_desktop_gpu.txt @@ -15,10 +15,10 @@ # This file is OfficialDemoDesktopGPU's config file (Copied from mediapipe/graphs/hand_tracking/hand_tracking_mobile.pbtxt). # # CHANGES: -# - `input_video` is ImageFrame (ImageFrameToGpuBufferCalculator converts it into GpuBuffer) -# - Add ImageTransformationCalculator and rotate the input -# - Add GlScalerCalculator and flips the output -# - `output_video` is ImageFrame +# - `input_video` is ImageFrame (ImageFrameToGpuBufferCalculator converts it into GpuBuffer) +# - Add ImageTransformationCalculator and rotate the input +# - Add GlScalerCalculator and flips the output +# - `output_video` is ImageFrame # MediaPipe graph that performs multi-hand tracking with TensorFlow Lite on GPU. # Used in the examples in diff --git a/Assets/MediaPipe/Examples/Scenes/Android.unity b/Assets/MediaPipe/Examples/Scenes/Android.unity index 6e12b6802..831cfab95 100644 --- a/Assets/MediaPipe/Examples/Scenes/Android.unity +++ b/Assets/MediaPipe/Examples/Scenes/Android.unity @@ -1206,6 +1206,8 @@ MonoBehaviour: type: 3} objectDetectionGraph: {fileID: 3735150179219885988, guid: b1fcdb3eb670b402693f9c69c98a0d51, type: 3} + boxTrackingGraph: {fileID: 4417437456738808513, guid: e741b626b1a478b4eac37623913cd0f0, + type: 3} officialDemoGraph: {fileID: 2660707083848588742, guid: 5a41994360993fec9acff375b639b07a, type: 3} --- !u!1 &908513300 diff --git a/Assets/MediaPipe/Examples/Scenes/DesktopCPU.unity b/Assets/MediaPipe/Examples/Scenes/DesktopCPU.unity index 34ffe0af3..12dff88a3 100644 --- a/Assets/MediaPipe/Examples/Scenes/DesktopCPU.unity +++ b/Assets/MediaPipe/Examples/Scenes/DesktopCPU.unity @@ -1205,6 +1205,8 @@ MonoBehaviour: hairSegmentationGraph: {fileID: 0} objectDetectionGraph: {fileID: 2332830239939318747, guid: 4860f13fa4d3e4daab6ddf6f43ce96ab, type: 3} + boxTrackingGraph: {fileID: 5144046067910221867, guid: f60d076394a0fff98aa7376e6a373608, + type: 3} officialDemoGraph: {fileID: 8080420373148060850, guid: bcbe21b0464e9b73ea37d18add25baf5, type: 3} --- !u!1 &908513300 diff --git a/Assets/MediaPipe/Examples/Scenes/DesktopGPU.unity b/Assets/MediaPipe/Examples/Scenes/DesktopGPU.unity index 22397317f..c906356d3 100644 --- a/Assets/MediaPipe/Examples/Scenes/DesktopGPU.unity +++ b/Assets/MediaPipe/Examples/Scenes/DesktopGPU.unity @@ -1206,6 +1206,8 @@ MonoBehaviour: type: 3} objectDetectionGraph: {fileID: 8958252977655340068, guid: d5971d2eb607f463cb377c8460592f82, type: 3} + boxTrackingGraph: {fileID: 6262546456675006810, guid: 044e1cba0ae838e6db69f9166320db5a, + type: 3} officialDemoGraph: {fileID: 5680418270291803701, guid: fc49226dfd774c66faf8a3dd6be53d0f, type: 3} --- !u!1 &908513300 diff --git a/Assets/MediaPipe/Examples/Scenes/iOS.unity b/Assets/MediaPipe/Examples/Scenes/iOS.unity index 42b5334f7..a1a5bcac9 100644 --- a/Assets/MediaPipe/Examples/Scenes/iOS.unity +++ b/Assets/MediaPipe/Examples/Scenes/iOS.unity @@ -1205,6 +1205,8 @@ MonoBehaviour: hairSegmentationGraph: {fileID: 0} objectDetectionGraph: {fileID: 8958252977655340068, guid: d5971d2eb607f463cb377c8460592f82, type: 3} + boxTrackingGraph: {fileID: 540366779651806644, guid: af2f5b06ef13278759b6c1cd8475a7f3, + type: 3} officialDemoGraph: {fileID: 8357887090699154475, guid: 7d75ba64ea250846eb3ae0b6bba7db41, type: 3} --- !u!1 &908513300 diff --git a/Assets/MediaPipe/Examples/Scripts/GraphSelectorController.cs b/Assets/MediaPipe/Examples/Scripts/GraphSelectorController.cs index 506a477e6..e33ce1fbc 100644 --- a/Assets/MediaPipe/Examples/Scripts/GraphSelectorController.cs +++ b/Assets/MediaPipe/Examples/Scripts/GraphSelectorController.cs @@ -12,6 +12,7 @@ public class GraphSelectorController : MonoBehaviour { [SerializeField] GameObject poseTrackingGraph = null; [SerializeField] GameObject hairSegmentationGraph = null; [SerializeField] GameObject objectDetectionGraph = null; + [SerializeField] GameObject boxTrackingGraph = null; [SerializeField] GameObject officialDemoGraph = null; private GameObject sceneDirector; @@ -36,6 +37,7 @@ void InitializeOptions() { AddGraph("Pose Tracking", poseTrackingGraph); AddGraph("Hair Segmentation", hairSegmentationGraph); AddGraph("Object Detection", objectDetectionGraph); + AddGraph("Box Tracking", boxTrackingGraph); AddGraph("Official Demo", officialDemoGraph); var graphSelector = GetComponent(); diff --git a/C/mediapipe_api/BUILD b/C/mediapipe_api/BUILD index 28e3c3d39..8ab2d390d 100644 --- a/C/mediapipe_api/BUILD +++ b/C/mediapipe_api/BUILD @@ -89,6 +89,7 @@ cc_library( "@com_google_mediapipe//mediapipe/graphs/iris_tracking:iris_tracking_cpu_deps", "@com_google_mediapipe//mediapipe/graphs/pose_tracking:upper_body_pose_tracking_cpu_deps", "@com_google_mediapipe//mediapipe/graphs/object_detection:desktop_tflite_calculators", + "@com_google_mediapipe//mediapipe/graphs/tracking:desktop_calculators", ], "//conditions:default": [ "@com_google_mediapipe//mediapipe/gpu:gl_scaler_calculator", @@ -99,6 +100,7 @@ cc_library( "@com_google_mediapipe//mediapipe/graphs/iris_tracking:iris_tracking_gpu_deps", "@com_google_mediapipe//mediapipe/graphs/pose_tracking:upper_body_pose_tracking_gpu_deps", "@com_google_mediapipe//mediapipe/graphs/object_detection:mobile_calculators", + "@com_google_mediapipe//mediapipe/graphs/tracking:mobile_calculators", ], }), )