From 1db91b550aeb43c742042f5ab947b81d90710079 Mon Sep 17 00:00:00 2001 From: MediaPipe Team Date: Mon, 31 Aug 2020 13:04:30 -0700 Subject: [PATCH] Project import generated by Copybara. GitOrigin-RevId: c27bb068d24890a4e3b7d2d536267e08d7e4abbd --- WORKSPACE | 7 +- ...ow_session_from_frozen_graph_calculator.cc | 2 +- ...low_session_from_frozen_graph_generator.cc | 2 +- .../unpack_media_sequence_calculator.proto | 7 ++ .../org_tensorflow_compatibility_fixes.diff | 71 ++++--------------- 5 files changed, 24 insertions(+), 65 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index a25d6c1d3..eb3efd275 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -362,13 +362,12 @@ http_archive( ) #Tensorflow repo should always go after the other external dependencies. -# 2020-05-11 -_TENSORFLOW_GIT_COMMIT = "7c09d15f9fcc14343343c247ebf5b8e0afe3e4aa" -_TENSORFLOW_SHA256= "673d00cbd2676ae43df1993e0d28c10b5ffbe96d9e2ab29f88a77b43c0211299" +# 2020-08-30 +_TENSORFLOW_GIT_COMMIT = "57b009e31e59bd1a7ae85ef8c0232ed86c9b71db" +_TENSORFLOW_SHA256= "de7f5f06204e057383028c7e53f3b352cdf85b3a40981b1a770c9a415a792c0e" http_archive( name = "org_tensorflow", urls = [ - "https://mirror.bazel.build/github.com/tensorflow/tensorflow/archive/%s.tar.gz" % _TENSORFLOW_GIT_COMMIT, "https://github.com/tensorflow/tensorflow/archive/%s.tar.gz" % _TENSORFLOW_GIT_COMMIT, ], patches = [ diff --git a/mediapipe/calculators/tensorflow/tensorflow_session_from_frozen_graph_calculator.cc b/mediapipe/calculators/tensorflow/tensorflow_session_from_frozen_graph_calculator.cc index 7975d4c9d..1c34ee6ed 100644 --- a/mediapipe/calculators/tensorflow/tensorflow_session_from_frozen_graph_calculator.cc +++ b/mediapipe/calculators/tensorflow/tensorflow_session_from_frozen_graph_calculator.cc @@ -51,7 +51,7 @@ namespace { void SetPreferredDevice(tf::GraphDef* graph_def, absl::string_view device_id) { for (auto& node : *graph_def->mutable_node()) { if (node.device().empty()) { - node.set_device(device_id); + node.set_device(std::string(device_id)); } } } diff --git a/mediapipe/calculators/tensorflow/tensorflow_session_from_frozen_graph_generator.cc b/mediapipe/calculators/tensorflow/tensorflow_session_from_frozen_graph_generator.cc index 0cb4a70b5..cd46a9a9f 100644 --- a/mediapipe/calculators/tensorflow/tensorflow_session_from_frozen_graph_generator.cc +++ b/mediapipe/calculators/tensorflow/tensorflow_session_from_frozen_graph_generator.cc @@ -47,7 +47,7 @@ namespace { void SetPreferredDevice(tf::GraphDef* graph_def, absl::string_view device_id) { for (auto& node : *graph_def->mutable_node()) { if (node.device().empty()) { - node.set_device(device_id); + node.set_device(std::string(device_id)); } } } diff --git a/mediapipe/calculators/tensorflow/unpack_media_sequence_calculator.proto b/mediapipe/calculators/tensorflow/unpack_media_sequence_calculator.proto index 51cc870c7..444e46ffd 100644 --- a/mediapipe/calculators/tensorflow/unpack_media_sequence_calculator.proto +++ b/mediapipe/calculators/tensorflow/unpack_media_sequence_calculator.proto @@ -56,4 +56,11 @@ message UnpackMediaSequenceCalculatorOptions { // the clip start and end times and outputs these for the // AudioDecoderCalculator to consume. optional AudioDecoderOptions base_audio_decoder_options = 9; + + optional string keypoint_names = 10 [ + default = + "NOSE,LEFT_EAR,RIGHT_EAR,LEFT_SHOULDER,RIGHT_SHOULDER,LEFT_FORE_PAW,RIGHT_FORE_PAW,LEFT_HIP,RIGHT_HIP,LEFT_HIND_PAW,RIGHT_HIND_PAW,ROOT_TAIL" + ]; + // When the keypoint doesn't exists, output this default value. + optional float default_keypoint_location = 11 [default = -1.0]; } diff --git a/third_party/org_tensorflow_compatibility_fixes.diff b/third_party/org_tensorflow_compatibility_fixes.diff index 5478e3d02..376384018 100644 --- a/third_party/org_tensorflow_compatibility_fixes.diff +++ b/third_party/org_tensorflow_compatibility_fixes.diff @@ -23,62 +23,15 @@ index b7c22ae77b..d0ba7b48b4 100644 pct_samples.points.push_back(pct); } } -diff --git a/tensorflow/lite/delegates/gpu/cl/api.cc b/tensorflow/lite/delegates/gpu/cl/api.cc -index 09c82307a5..0318c1a447 100644 ---- a/tensorflow/lite/delegates/gpu/cl/api.cc -+++ b/tensorflow/lite/delegates/gpu/cl/api.cc -@@ -352,10 +352,10 @@ class GlBufferHolder : public TensorTie { - }; - - TensorObject TensorToObj(const Tensor& tensor) { -- if (tensor.StorageType() == TensorStorageType::BUFFER) { -+ if (tensor.GetStorageType() == TensorStorageType::BUFFER) { - return OpenClBuffer{tensor.GetMemoryPtr()}; - } -- if (tensor.StorageType() == TensorStorageType::IMAGE_BUFFER) { -+ if (tensor.GetStorageType() == TensorStorageType::IMAGE_BUFFER) { - return OpenClBuffer{tensor.GetMemoryPtrForWriting()}; - } - return OpenClTexture{tensor.GetMemoryPtr()}; -@@ -516,9 +516,9 @@ TensorObjectDef TensorToDef(const Tensor& tensor) { - def.dimensions.h = tensor.Height(); - def.dimensions.w = tensor.Width(); - def.dimensions.c = tensor.Channels(); -- def.object_def.data_layout = ToDataLayout(tensor.StorageType()); -- def.object_def.data_type = tensor.DataType(); -- def.object_def.object_type = ToObjectType(tensor.StorageType()); -+ def.object_def.data_layout = ToDataLayout(tensor.GetStorageType()); -+ def.object_def.data_type = tensor.GetDataType(); -+ def.object_def.object_type = ToObjectType(tensor.GetStorageType()); - def.object_def.user_provided = false; - return def; - } -diff --git a/tensorflow/lite/delegates/gpu/cl/tensor.cc b/tensorflow/lite/delegates/gpu/cl/tensor.cc -index 308e1b6920..9b613c63f7 100644 ---- a/tensorflow/lite/delegates/gpu/cl/tensor.cc -+++ b/tensorflow/lite/delegates/gpu/cl/tensor.cc -@@ -29,7 +29,7 @@ namespace cl { - namespace { - - absl::Status CreateImageBufferFromBuffer(const CLContext& context, -- cl_mem memory, enum DataType data_type, -+ cl_mem memory, DataType data_type, - int width, cl_mem* result) { - cl_image_format format; - cl_image_desc desc; -diff --git a/tensorflow/lite/delegates/gpu/cl/tensor.h b/tensorflow/lite/delegates/gpu/cl/tensor.h -index a27c54a74e..39d3a04a47 100644 ---- a/tensorflow/lite/delegates/gpu/cl/tensor.h -+++ b/tensorflow/lite/delegates/gpu/cl/tensor.h -@@ -75,8 +75,8 @@ class Tensor { - int4 GetWHSB() const { return int4(shape_.w, shape_.h, Slices(), shape_.b); } - int4 GetWHDS() const { return int4(shape_.w, shape_.h, shape_.d, Slices()); } - -- enum DataType DataType() const { return descriptor_.data_type; } -- TensorStorageType StorageType() const { return descriptor_.storage_type; } -+ DataType GetDataType() const { return descriptor_.data_type; } -+ TensorStorageType GetStorageType() const { return descriptor_.storage_type; } - - // for profiling and memory statistics - uint64_t GetMemorySizeInBytes() const; - +diff --git a/tensorflow/core/platform/test.h b/tensorflow/core/platform/test.h +index ba50783765..5de5ea01f0 100644 +--- a/tensorflow/core/platform/test.h ++++ b/tensorflow/core/platform/test.h +@@ -42,7 +42,6 @@ limitations under the License. + #if defined(PLATFORM_GOOGLE) || defined(PLATFORM_GOOGLE_ANDROID) + #include "testing/base/public/gmock.h" + #else +-#include + #include + #include + #endif