From 54d208aa5c5106419a6ff2e16f19e0ce2571b2a4 Mon Sep 17 00:00:00 2001 From: Bekzhan Bekbolatuly Date: Fri, 14 Apr 2023 11:41:16 -0700 Subject: [PATCH] Internal change PiperOrigin-RevId: 524345939 --- mediapipe/calculators/tensor/BUILD | 14 +++++++------- .../calculators/tensor/inference_calculator.cc | 4 ++-- .../calculators/tensor/inference_calculator.h | 6 +++--- .../tensor/inference_calculator_cpu.cc | 2 +- .../inference_interpreter_delegate_runner.cc | 10 +++++----- .../inference_interpreter_delegate_runner.h | 2 +- .../calculators/tensor/tflite_delegate_ptr.h | 2 +- .../audio_classifier/audio_classifier_test.cc | 8 ++++---- .../audio_embedder/audio_embedder_test.cc | 8 ++++---- mediapipe/tasks/cc/audio/utils/BUILD | 2 +- .../cc/audio/utils/audio_tensor_specs_test.cc | 4 ++-- .../tasks/cc/components/calculators/BUILD | 4 ++-- ...assification_aggregation_calculator_test.cc | 5 ++--- .../embedding_aggregation_calculator_test.cc | 4 ++-- ...classification_postprocessing_graph_test.cc | 6 +++--- .../embedding_postprocessing_graph_test.cc | 6 +++--- .../image_preprocessing_graph_test.cc | 4 ++-- mediapipe/tasks/cc/core/BUILD | 18 +++++++++--------- mediapipe/tasks/cc/core/model_resources.cc | 11 +++++------ mediapipe/tasks/cc/core/model_resources.h | 14 +++++++------- .../cc/core/model_resources_calculator_test.cc | 4 ++-- .../tasks/cc/core/model_resources_test.cc | 10 +++++----- mediapipe/tasks/cc/core/task_runner_test.cc | 4 ++-- mediapipe/tasks/cc/text/text_classifier/BUILD | 2 +- .../text_classifier/text_classifier_test.cc | 4 ++-- mediapipe/tasks/cc/text/text_embedder/BUILD | 2 +- .../text/text_embedder/text_embedder_test.cc | 4 ++-- mediapipe/tasks/cc/text/utils/BUILD | 2 +- .../cc/text/utils/text_model_utils_test.cc | 4 ++-- .../face_blendshapes_graph_test.cc | 4 ++-- .../hand_landmarker_graph_test.cc | 4 ++-- .../hand_landmarker/hand_landmarker_test.cc | 2 +- .../hand_landmarks_detector_graph_test.cc | 4 ++-- .../image_classifier/image_classifier_test.cc | 10 +++++----- .../image_embedder/image_embedder_test.cc | 10 +++++----- .../image_segmenter/image_segmenter_test.cc | 10 +++++----- .../interactive_segmenter_test.cc | 6 +++--- .../object_detector/object_detector_test.cc | 10 +++++----- .../pose_landmarks_detector_graph_test.cc | 4 ++-- mediapipe/tasks/cc/vision/utils/BUILD | 2 +- .../cc/vision/utils/image_tensor_specs_test.cc | 4 ++-- .../com/google/mediapipe/tasks/core/jni/BUILD | 2 +- .../core/jni/model_resources_cache_jni.cc | 2 +- mediapipe/util/tflite/BUILD | 2 +- mediapipe/util/tflite/tflite_model_loader.cc | 2 +- mediapipe/util/tflite/tflite_model_loader.h | 6 +++--- 46 files changed, 126 insertions(+), 128 deletions(-) diff --git a/mediapipe/calculators/tensor/BUILD b/mediapipe/calculators/tensor/BUILD index a574e11e1..5d52dda0f 100644 --- a/mediapipe/calculators/tensor/BUILD +++ b/mediapipe/calculators/tensor/BUILD @@ -401,8 +401,8 @@ cc_library_with_tflite( hdrs = ["inference_calculator.h"], tflite_deps = [ "//mediapipe/util/tflite:tflite_model_loader", - "@org_tensorflow//tensorflow/lite/core/shims:framework_stable", - "@org_tensorflow//tensorflow/lite/core/shims:builtin_ops", + "@org_tensorflow//tensorflow/lite:framework_stable", + "@org_tensorflow//tensorflow/lite/kernels:builtin_ops", ], deps = [ ":inference_calculator_cc_proto", @@ -506,7 +506,7 @@ cc_library_with_tflite( name = "tflite_delegate_ptr", hdrs = ["tflite_delegate_ptr.h"], tflite_deps = [ - "@org_tensorflow//tensorflow/lite/core/shims:c_api_types", + "@org_tensorflow//tensorflow/lite/c:c_api_types", ], ) @@ -517,8 +517,8 @@ cc_library_with_tflite( tflite_deps = [ ":tflite_delegate_ptr", "//mediapipe/util/tflite:tflite_model_loader", - "@org_tensorflow//tensorflow/lite/core/shims:c_api_types", - "@org_tensorflow//tensorflow/lite/core/shims:framework_stable", + "@org_tensorflow//tensorflow/lite:framework_stable", + "@org_tensorflow//tensorflow/lite/c:c_api_types", ], deps = [ ":inference_runner", @@ -546,8 +546,8 @@ cc_library( "@com_google_absl//absl/memory", "@com_google_absl//absl/status", "@com_google_absl//absl/status:statusor", - "@org_tensorflow//tensorflow/lite/core/shims:c_api_types", - "@org_tensorflow//tensorflow/lite/core/shims:framework_stable", + "@org_tensorflow//tensorflow/lite:framework_stable", + "@org_tensorflow//tensorflow/lite/c:c_api_types", "@org_tensorflow//tensorflow/lite/delegates/xnnpack:xnnpack_delegate", ] + select({ "//conditions:default": [], diff --git a/mediapipe/calculators/tensor/inference_calculator.cc b/mediapipe/calculators/tensor/inference_calculator.cc index c53c6e3d5..2a6936eba 100644 --- a/mediapipe/calculators/tensor/inference_calculator.cc +++ b/mediapipe/calculators/tensor/inference_calculator.cc @@ -94,8 +94,8 @@ InferenceCalculator::GetOpResolverAsPacket(CalculatorContext* cc) { return kSideInCustomOpResolver(cc).As(); } return PacketAdopting( - std::make_unique()); + std::make_unique< + tflite::ops::builtin::BuiltinOpResolverWithoutDefaultDelegates>()); } } // namespace api2 diff --git a/mediapipe/calculators/tensor/inference_calculator.h b/mediapipe/calculators/tensor/inference_calculator.h index b73f42053..d7e5e98cf 100644 --- a/mediapipe/calculators/tensor/inference_calculator.h +++ b/mediapipe/calculators/tensor/inference_calculator.h @@ -26,7 +26,7 @@ #include "mediapipe/framework/formats/tensor.h" #include "mediapipe/util/tflite/tflite_model_loader.h" #include "tensorflow/lite/core/api/op_resolver.h" -#include "tensorflow/lite/core/shims/cc/kernels/register.h" +#include "tensorflow/lite/kernels/register.h" namespace mediapipe { namespace api2 { @@ -97,8 +97,8 @@ class InferenceCalculator : public NodeIntf { // Deprecated. Prefers to use "OP_RESOLVER" input side packet instead. // TODO: Removes the "CUSTOM_OP_RESOLVER" side input after the // migration. - static constexpr SideInput:: - Optional kSideInCustomOpResolver{"CUSTOM_OP_RESOLVER"}; + static constexpr SideInput::Optional + kSideInCustomOpResolver{"CUSTOM_OP_RESOLVER"}; static constexpr SideInput::Optional kSideInOpResolver{ "OP_RESOLVER"}; static constexpr SideInput::Optional kSideInModel{"MODEL"}; diff --git a/mediapipe/calculators/tensor/inference_calculator_cpu.cc b/mediapipe/calculators/tensor/inference_calculator_cpu.cc index 80d36ba68..0c22fc7a1 100644 --- a/mediapipe/calculators/tensor/inference_calculator_cpu.cc +++ b/mediapipe/calculators/tensor/inference_calculator_cpu.cc @@ -24,7 +24,7 @@ #include "mediapipe/calculators/tensor/inference_calculator_utils.h" #include "mediapipe/calculators/tensor/inference_interpreter_delegate_runner.h" #include "mediapipe/calculators/tensor/inference_runner.h" -#include "tensorflow/lite/core/shims/cc/interpreter.h" +#include "tensorflow/lite/interpreter.h" #if defined(MEDIAPIPE_ANDROID) #include "tensorflow/lite/delegates/nnapi/nnapi_delegate.h" #endif // ANDROID diff --git a/mediapipe/calculators/tensor/inference_interpreter_delegate_runner.cc b/mediapipe/calculators/tensor/inference_interpreter_delegate_runner.cc index 26bf3d8f8..a2b8a9285 100644 --- a/mediapipe/calculators/tensor/inference_interpreter_delegate_runner.cc +++ b/mediapipe/calculators/tensor/inference_interpreter_delegate_runner.cc @@ -22,9 +22,9 @@ #include "mediapipe/framework/formats/tensor.h" #include "mediapipe/framework/mediapipe_profiling.h" #include "mediapipe/framework/port/ret_check.h" -#include "tensorflow/lite/core/shims/c/c_api_types.h" -#include "tensorflow/lite/core/shims/cc/interpreter.h" -#include "tensorflow/lite/core/shims/cc/interpreter_builder.h" +#include "tensorflow/lite/c/c_api_types.h" +#include "tensorflow/lite/interpreter.h" +#include "tensorflow/lite/interpreter_builder.h" #include "tensorflow/lite/string_util.h" #define PERFETTO_TRACK_EVENT_NAMESPACE mediapipe @@ -33,8 +33,8 @@ namespace mediapipe { namespace { -using Interpreter = ::tflite_shims::Interpreter; -using InterpreterBuilder = ::tflite_shims::InterpreterBuilder; +using Interpreter = ::tflite::Interpreter; +using InterpreterBuilder = ::tflite::InterpreterBuilder; template void CopyTensorBufferToInterpreter(const Tensor& input_tensor, diff --git a/mediapipe/calculators/tensor/inference_interpreter_delegate_runner.h b/mediapipe/calculators/tensor/inference_interpreter_delegate_runner.h index d2035c994..ca6d79851 100644 --- a/mediapipe/calculators/tensor/inference_interpreter_delegate_runner.h +++ b/mediapipe/calculators/tensor/inference_interpreter_delegate_runner.h @@ -23,8 +23,8 @@ #include "mediapipe/calculators/tensor/tflite_delegate_ptr.h" #include "mediapipe/framework/api2/packet.h" #include "mediapipe/util/tflite/tflite_model_loader.h" +#include "tensorflow/lite/c/c_api_types.h" #include "tensorflow/lite/core/api/op_resolver.h" -#include "tensorflow/lite/core/shims/c/c_api_types.h" namespace mediapipe { diff --git a/mediapipe/calculators/tensor/tflite_delegate_ptr.h b/mediapipe/calculators/tensor/tflite_delegate_ptr.h index caaa19c2f..afaf9f515 100644 --- a/mediapipe/calculators/tensor/tflite_delegate_ptr.h +++ b/mediapipe/calculators/tensor/tflite_delegate_ptr.h @@ -18,7 +18,7 @@ #include #include -#include "tensorflow/lite/core/shims/c/c_api_types.h" +#include "tensorflow/lite/c/c_api_types.h" namespace mediapipe { diff --git a/mediapipe/tasks/cc/audio/audio_classifier/audio_classifier_test.cc b/mediapipe/tasks/cc/audio/audio_classifier/audio_classifier_test.cc index 108374003..5f5f8da6c 100644 --- a/mediapipe/tasks/cc/audio/audio_classifier/audio_classifier_test.cc +++ b/mediapipe/tasks/cc/audio/audio_classifier/audio_classifier_test.cc @@ -37,7 +37,7 @@ limitations under the License. #include "mediapipe/tasks/cc/common.h" #include "mediapipe/tasks/cc/components/containers/category.h" #include "mediapipe/tasks/cc/components/containers/classification_result.h" -#include "tensorflow/lite/core/shims/cc/shims_test_util.h" +#include "tensorflow/lite/test_util.h" namespace mediapipe { namespace tasks { @@ -157,7 +157,7 @@ void CheckStreamingModeResults(std::vector outputs) { } } -class CreateFromOptionsTest : public tflite_shims::testing::Test {}; +class CreateFromOptionsTest : public tflite::testing::Test {}; TEST_F(CreateFromOptionsTest, SucceedsForModelWithMetadata) { auto options = std::make_unique(); @@ -270,7 +270,7 @@ TEST_F(CreateFromOptionsTest, FailsWithUnnecessaryCallback) { MediaPipeTasksStatus::kInvalidTaskGraphConfigError)))); } -class ClassifyTest : public tflite_shims::testing::Test {}; +class ClassifyTest : public tflite::testing::Test {}; TEST_F(ClassifyTest, Succeeds) { auto audio_buffer = GetAudioData(k16kTestWavFilename); @@ -467,7 +467,7 @@ TEST_F(ClassifyTest, SucceedsWithCategoryDenylist) { } } -class ClassifyAsyncTest : public tflite_shims::testing::Test {}; +class ClassifyAsyncTest : public tflite::testing::Test {}; TEST_F(ClassifyAsyncTest, Succeeds) { constexpr int kSampleRateHz = 48000; diff --git a/mediapipe/tasks/cc/audio/audio_embedder/audio_embedder_test.cc b/mediapipe/tasks/cc/audio/audio_embedder/audio_embedder_test.cc index e388423b1..81ecb1237 100644 --- a/mediapipe/tasks/cc/audio/audio_embedder/audio_embedder_test.cc +++ b/mediapipe/tasks/cc/audio/audio_embedder/audio_embedder_test.cc @@ -36,7 +36,7 @@ limitations under the License. #include "mediapipe/tasks/cc/audio/utils/test_utils.h" #include "mediapipe/tasks/cc/common.h" #include "mediapipe/tasks/cc/components/containers/embedding_result.h" -#include "tensorflow/lite/core/shims/cc/shims_test_util.h" +#include "tensorflow/lite/test_util.h" namespace mediapipe { namespace tasks { @@ -66,7 +66,7 @@ Matrix GetAudioData(absl::string_view filename) { return matrix_mapping.matrix(); } -class CreateFromOptionsTest : public tflite_shims::testing::Test {}; +class CreateFromOptionsTest : public tflite::testing::Test {}; TEST_F(CreateFromOptionsTest, FailsWithMissingModel) { auto audio_embedder = @@ -124,7 +124,7 @@ TEST_F(CreateFromOptionsTest, FailsWithMissingCallbackInAudioStreamMode) { MediaPipeTasksStatus::kInvalidTaskGraphConfigError)))); } -class EmbedTest : public tflite_shims::testing::Test {}; +class EmbedTest : public tflite::testing::Test {}; TEST_F(EmbedTest, SucceedsWithSilentAudio) { auto options = std::make_unique(); @@ -187,7 +187,7 @@ TEST_F(EmbedTest, SucceedsWithDifferentAudios) { MP_EXPECT_OK(audio_embedder->Close()); } -class EmbedAsyncTest : public tflite_shims::testing::Test { +class EmbedAsyncTest : public tflite::testing::Test { protected: void RunAudioEmbedderInStreamMode(std::string audio_file_name, int sample_rate_hz, diff --git a/mediapipe/tasks/cc/audio/utils/BUILD b/mediapipe/tasks/cc/audio/utils/BUILD index 1d6988008..29d88d33d 100644 --- a/mediapipe/tasks/cc/audio/utils/BUILD +++ b/mediapipe/tasks/cc/audio/utils/BUILD @@ -47,7 +47,7 @@ cc_test_with_tflite( data = ["//mediapipe/tasks/testdata/audio:test_models"], tflite_deps = [ "//mediapipe/tasks/cc/core:model_resources", - "@org_tensorflow//tensorflow/lite/core/shims:cc_shims_test_util", + "@org_tensorflow//tensorflow/lite:test_util", ], deps = [ ":audio_tensor_specs", diff --git a/mediapipe/tasks/cc/audio/utils/audio_tensor_specs_test.cc b/mediapipe/tasks/cc/audio/utils/audio_tensor_specs_test.cc index 60b2bdc50..4f7a5000e 100644 --- a/mediapipe/tasks/cc/audio/utils/audio_tensor_specs_test.cc +++ b/mediapipe/tasks/cc/audio/utils/audio_tensor_specs_test.cc @@ -34,7 +34,7 @@ limitations under the License. #include "mediapipe/tasks/cc/core/model_resources.h" #include "mediapipe/tasks/cc/core/proto/external_file.pb.h" #include "mediapipe/tasks/cc/metadata/metadata_extractor.h" -#include "tensorflow/lite/core/shims/cc/shims_test_util.h" +#include "tensorflow/lite/test_util.h" namespace mediapipe { namespace tasks { @@ -52,7 +52,7 @@ constexpr char kModelWithMetadata[] = "yamnet_audio_classifier_with_metadata.tflite"; constexpr char kModelWithoutMetadata[] = "model_without_metadata.tflite"; -class AudioTensorSpecsTest : public tflite_shims::testing::Test {}; +class AudioTensorSpecsTest : public tflite::testing::Test {}; TEST_F(AudioTensorSpecsTest, BuildInputAudioTensorSpecsWithoutMetdataOptionsFails) { diff --git a/mediapipe/tasks/cc/components/calculators/BUILD b/mediapipe/tasks/cc/components/calculators/BUILD index bb49bdb9d..e447f5d72 100644 --- a/mediapipe/tasks/cc/components/calculators/BUILD +++ b/mediapipe/tasks/cc/components/calculators/BUILD @@ -63,7 +63,7 @@ cc_test( "@com_google_absl//absl/status", "@com_google_absl//absl/status:statusor", "@com_google_absl//absl/strings:str_format", - "@org_tensorflow//tensorflow/lite/core/shims:cc_shims_test_util", + "@org_tensorflow//tensorflow/lite:test_util", ], ) @@ -232,6 +232,6 @@ cc_test( "//mediapipe/tasks/cc/components/containers/proto:embeddings_cc_proto", "@com_google_absl//absl/status", "@com_google_absl//absl/status:statusor", - "@org_tensorflow//tensorflow/lite/core/shims:cc_shims_test_util", + "@org_tensorflow//tensorflow/lite:test_util", ], ) diff --git a/mediapipe/tasks/cc/components/calculators/classification_aggregation_calculator_test.cc b/mediapipe/tasks/cc/components/calculators/classification_aggregation_calculator_test.cc index 811d70544..c824919df 100644 --- a/mediapipe/tasks/cc/components/calculators/classification_aggregation_calculator_test.cc +++ b/mediapipe/tasks/cc/components/calculators/classification_aggregation_calculator_test.cc @@ -33,7 +33,7 @@ limitations under the License. #include "mediapipe/framework/timestamp.h" #include "mediapipe/tasks/cc/components/calculators/classification_aggregation_calculator.pb.h" #include "mediapipe/tasks/cc/components/containers/proto/classifications.pb.h" -#include "tensorflow/lite/core/shims/cc/shims_test_util.h" +#include "tensorflow/lite/test_util.h" namespace mediapipe { namespace { @@ -66,8 +66,7 @@ ClassificationList MakeClassificationList(int class_index) { class_index)); } -class ClassificationAggregationCalculatorTest - : public tflite_shims::testing::Test { +class ClassificationAggregationCalculatorTest : public tflite::testing::Test { protected: absl::StatusOr BuildGraph( bool connect_timestamps = false) { diff --git a/mediapipe/tasks/cc/components/calculators/embedding_aggregation_calculator_test.cc b/mediapipe/tasks/cc/components/calculators/embedding_aggregation_calculator_test.cc index f2b2fa1d5..c4b635d24 100644 --- a/mediapipe/tasks/cc/components/calculators/embedding_aggregation_calculator_test.cc +++ b/mediapipe/tasks/cc/components/calculators/embedding_aggregation_calculator_test.cc @@ -31,7 +31,7 @@ limitations under the License. #include "mediapipe/framework/port/status_matchers.h" #include "mediapipe/framework/timestamp.h" #include "mediapipe/tasks/cc/components/containers/proto/embeddings.pb.h" -#include "tensorflow/lite/core/shims/cc/shims_test_util.h" +#include "tensorflow/lite/test_util.h" namespace mediapipe { namespace { @@ -52,7 +52,7 @@ constexpr char kTimestampsName[] = "timestamps_in"; constexpr char kTimestampedEmbeddingsTag[] = "TIMESTAMPED_EMBEDDINGS"; constexpr char kTimestampedEmbeddingsName[] = "timestamped_embeddings_out"; -class EmbeddingAggregationCalculatorTest : public tflite_shims::testing::Test { +class EmbeddingAggregationCalculatorTest : public tflite::testing::Test { protected: absl::StatusOr BuildGraph(bool connect_timestamps) { Graph graph; diff --git a/mediapipe/tasks/cc/components/processors/classification_postprocessing_graph_test.cc b/mediapipe/tasks/cc/components/processors/classification_postprocessing_graph_test.cc index a11bad71a..6dff64b1b 100644 --- a/mediapipe/tasks/cc/components/processors/classification_postprocessing_graph_test.cc +++ b/mediapipe/tasks/cc/components/processors/classification_postprocessing_graph_test.cc @@ -49,7 +49,7 @@ limitations under the License. #include "mediapipe/tasks/cc/core/model_resources.h" #include "mediapipe/tasks/cc/core/proto/external_file.pb.h" #include "mediapipe/util/label_map.pb.h" -#include "tensorflow/lite/core/shims/cc/shims_test_util.h" +#include "tensorflow/lite/test_util.h" namespace mediapipe { namespace tasks { @@ -101,7 +101,7 @@ absl::StatusOr> CreateModelResourcesForModel( std::move(external_file)); } -class ConfigureTest : public tflite_shims::testing::Test {}; +class ConfigureTest : public tflite::testing::Test {}; TEST_F(ConfigureTest, FailsWithInvalidMaxResults) { MP_ASSERT_OK_AND_ASSIGN( @@ -417,7 +417,7 @@ TEST_F(ConfigureTest, SucceedsWithMultipleHeads) { )pb"))); } -class PostprocessingTest : public tflite_shims::testing::Test { +class PostprocessingTest : public tflite::testing::Test { protected: absl::StatusOr BuildGraph( absl::string_view model_name, const proto::ClassifierOptions& options, diff --git a/mediapipe/tasks/cc/components/processors/embedding_postprocessing_graph_test.cc b/mediapipe/tasks/cc/components/processors/embedding_postprocessing_graph_test.cc index 768508446..94a2a7f3f 100644 --- a/mediapipe/tasks/cc/components/processors/embedding_postprocessing_graph_test.cc +++ b/mediapipe/tasks/cc/components/processors/embedding_postprocessing_graph_test.cc @@ -39,7 +39,7 @@ limitations under the License. #include "mediapipe/tasks/cc/components/processors/proto/embedding_postprocessing_graph_options.pb.h" #include "mediapipe/tasks/cc/core/model_resources.h" #include "mediapipe/tasks/cc/core/proto/external_file.pb.h" -#include "tensorflow/lite/core/shims/cc/shims_test_util.h" +#include "tensorflow/lite/test_util.h" namespace mediapipe { namespace tasks { @@ -86,7 +86,7 @@ absl::StatusOr> CreateModelResourcesForModel( std::move(external_file)); } -class ConfigureTest : public tflite_shims::testing::Test {}; +class ConfigureTest : public tflite::testing::Test {}; TEST_F(ConfigureTest, SucceedsWithQuantizedModelWithMetadata) { MP_ASSERT_OK_AND_ASSIGN( @@ -153,7 +153,7 @@ TEST_F(ConfigureTest, SucceedsWithFloatModelWithMetadata) { has_quantized_outputs: false)pb"))); } -class PostprocessingTest : public tflite_shims::testing::Test { +class PostprocessingTest : public tflite::testing::Test { protected: absl::StatusOr BuildGraph( absl::string_view model_name, const proto::EmbedderOptions& options, diff --git a/mediapipe/tasks/cc/components/processors/image_preprocessing_graph_test.cc b/mediapipe/tasks/cc/components/processors/image_preprocessing_graph_test.cc index 6c094c6bc..c69a51a65 100644 --- a/mediapipe/tasks/cc/components/processors/image_preprocessing_graph_test.cc +++ b/mediapipe/tasks/cc/components/processors/image_preprocessing_graph_test.cc @@ -37,7 +37,7 @@ limitations under the License. #include "mediapipe/tasks/cc/core/proto/external_file.pb.h" #include "mediapipe/tasks/cc/core/task_runner.h" #include "mediapipe/tasks/cc/vision/utils/image_utils.h" -#include "tensorflow/lite/core/shims/cc/shims_test_util.h" +#include "tensorflow/lite/test_util.h" namespace mediapipe { namespace tasks { @@ -125,7 +125,7 @@ absl::StatusOr> CreateTaskRunner( return TaskRunner::Create(graph.GetConfig()); } -class ConfigureTest : public tflite_shims::testing::Test {}; +class ConfigureTest : public tflite::testing::Test {}; TEST_F(ConfigureTest, SucceedsWithQuantizedModelWithMetadata) { MP_ASSERT_OK_AND_ASSIGN( diff --git a/mediapipe/tasks/cc/core/BUILD b/mediapipe/tasks/cc/core/BUILD index 465c382bb..7b2b97783 100644 --- a/mediapipe/tasks/cc/core/BUILD +++ b/mediapipe/tasks/cc/core/BUILD @@ -128,9 +128,9 @@ cc_library_with_tflite( srcs = ["model_resources.cc"], hdrs = ["model_resources.h"], tflite_deps = [ - "@org_tensorflow//tensorflow/lite/core/shims:builtin_ops", - "@org_tensorflow//tensorflow/lite/core/shims:framework_stable", - "@org_tensorflow//tensorflow/lite/core/shims:verifier", + "@org_tensorflow//tensorflow/lite:framework_stable", + "@org_tensorflow//tensorflow/lite/kernels:builtin_ops", + "@org_tensorflow//tensorflow/lite/tools:verifier", ], deps = [ ":external_file_handler", @@ -159,9 +159,9 @@ cc_test_with_tflite( ], tflite_deps = [ ":model_resources", - "@org_tensorflow//tensorflow/lite/core/shims:cc_shims_test_util", - "@org_tensorflow//tensorflow/lite/core/shims:builtin_ops", - "@org_tensorflow//tensorflow/lite/core/shims:framework_stable", + "@org_tensorflow//tensorflow/lite:framework_stable", + "@org_tensorflow//tensorflow/lite:test_util", + "@org_tensorflow//tensorflow/lite/kernels:builtin_ops", ], deps = [ ":utils", @@ -186,7 +186,7 @@ cc_library_with_tflite( hdrs = ["model_resources_cache.h"], tflite_deps = [ ":model_resources", - "@org_tensorflow//tensorflow/lite/core/shims:builtin_ops", + "@org_tensorflow//tensorflow/lite/kernels:builtin_ops", ], deps = [ ":model_asset_bundle_resources", @@ -233,7 +233,7 @@ cc_test_with_tflite( ":model_resources", ":model_resources_cache", ":model_resources_calculator", - "@org_tensorflow//tensorflow/lite/core/shims:cc_shims_test_util", + "@org_tensorflow//tensorflow/lite:test_util", ], deps = [ "//mediapipe/framework/port:gtest_main", @@ -284,7 +284,7 @@ cc_test_with_tflite( ":task_runner", ":model_resources", ":model_resources_cache", - "@org_tensorflow//tensorflow/lite/core/shims:cc_shims_test_util", + "@org_tensorflow//tensorflow/lite:test_util", ], deps = [ "//mediapipe/calculators/core:pass_through_calculator", diff --git a/mediapipe/tasks/cc/core/model_resources.cc b/mediapipe/tasks/cc/core/model_resources.cc index 7819f6213..76695125a 100644 --- a/mediapipe/tasks/cc/core/model_resources.cc +++ b/mediapipe/tasks/cc/core/model_resources.cc @@ -37,8 +37,8 @@ limitations under the License. #include "mediapipe/util/tflite/error_reporter.h" #include "tensorflow/lite/core/api/error_reporter.h" #include "tensorflow/lite/core/api/op_resolver.h" -#include "tensorflow/lite/core/shims/cc/model_builder.h" -#include "tensorflow/lite/core/shims/cc/tools/verifier.h" +#include "tensorflow/lite/model_builder.h" +#include "tensorflow/lite/tools/verifier.h" namespace mediapipe { namespace tasks { @@ -52,7 +52,7 @@ using ::mediapipe::tasks::metadata::ModelMetadataExtractor; bool ModelResources::Verifier::Verify(const char* data, int length, tflite::ErrorReporter* reporter) { - return tflite_shims::Verify(data, length, reporter); + return tflite::Verify(data, length, reporter); } ModelResources::ModelResources(const std::string& tag, @@ -124,7 +124,7 @@ absl::Status ModelResources::BuildModelFromExternalFileProto() { // and that it uses only operators that are supported by the OpResolver // that was passed to the ModelResources constructor, and then builds // the model from the buffer. - auto model = tflite_shims::FlatBufferModel::VerifyAndBuildFromBuffer( + auto model = tflite::FlatBufferModel::VerifyAndBuildFromBuffer( buffer_data, buffer_size, &verifier_, &error_reporter_); if (model == nullptr) { static constexpr char kInvalidFlatbufferMessage[] = @@ -151,8 +151,7 @@ absl::Status ModelResources::BuildModelFromExternalFileProto() { } model_packet_ = MakePacket( - model.release(), - [](tflite_shims::FlatBufferModel* model) { delete model; }); + model.release(), [](tflite::FlatBufferModel* model) { delete model; }); ASSIGN_OR_RETURN(auto model_metadata_extractor, metadata::ModelMetadataExtractor::CreateFromModelBuffer( buffer_data, buffer_size)); diff --git a/mediapipe/tasks/cc/core/model_resources.h b/mediapipe/tasks/cc/core/model_resources.h index c2a03f1f2..1bc1b65eb 100644 --- a/mediapipe/tasks/cc/core/model_resources.h +++ b/mediapipe/tasks/cc/core/model_resources.h @@ -32,10 +32,10 @@ limitations under the License. #include "mediapipe/util/tflite/error_reporter.h" #include "tensorflow/lite/core/api/error_reporter.h" #include "tensorflow/lite/core/api/op_resolver.h" -#include "tensorflow/lite/core/shims/cc/kernels/register.h" -#include "tensorflow/lite/core/shims/cc/model.h" -#include "tensorflow/lite/core/shims/cc/model_builder.h" -#include "tensorflow/lite/core/shims/cc/tools/verifier.h" +#include "tensorflow/lite/kernels/register.h" +#include "tensorflow/lite/model.h" +#include "tensorflow/lite/model_builder.h" +#include "tensorflow/lite/tools/verifier.h" namespace mediapipe { namespace tasks { @@ -51,8 +51,8 @@ class ModelResources { public: // Represents a TfLite model as a FlatBuffer. using ModelPtr = - std::unique_ptr>; + std::unique_ptr>; // Takes the ownership of the provided ExternalFile proto and creates // ModelResources from the proto and an op resolver object. A non-empty tag @@ -61,7 +61,7 @@ class ModelResources { static absl::StatusOr> Create( const std::string& tag, std::unique_ptr model_file, std::unique_ptr op_resolver = - absl::make_unique()); + absl::make_unique()); // Takes the ownership of the provided ExternalFile proto and creates // ModelResources from the proto and an op resolver mediapipe packet. A diff --git a/mediapipe/tasks/cc/core/model_resources_calculator_test.cc b/mediapipe/tasks/cc/core/model_resources_calculator_test.cc index 83134a8c7..6ba52e521 100644 --- a/mediapipe/tasks/cc/core/model_resources_calculator_test.cc +++ b/mediapipe/tasks/cc/core/model_resources_calculator_test.cc @@ -30,7 +30,7 @@ limitations under the License. #include "mediapipe/tasks/cc/core/proto/model_resources_calculator.pb.h" #include "mediapipe/tasks/cc/metadata/metadata_extractor.h" #include "tensorflow/lite/core/api/op_resolver.h" -#include "tensorflow/lite/core/shims/cc/shims_test_util.h" +#include "tensorflow/lite/test_util.h" namespace mediapipe { namespace tasks { @@ -124,7 +124,7 @@ void RunGraphWithGraphService(std::unique_ptr model_resources, } // namespace -class ModelResourcesCalculatorTest : public tflite_shims::testing::Test {}; +class ModelResourcesCalculatorTest : public tflite::testing::Test {}; TEST_F(ModelResourcesCalculatorTest, MissingCalculatorOptions) { auto graph_config = ParseTextProtoOrDie( diff --git a/mediapipe/tasks/cc/core/model_resources_test.cc b/mediapipe/tasks/cc/core/model_resources_test.cc index 3bc5ff062..036d0e784 100644 --- a/mediapipe/tasks/cc/core/model_resources_test.cc +++ b/mediapipe/tasks/cc/core/model_resources_test.cc @@ -38,9 +38,9 @@ limitations under the License. #include "mediapipe/tasks/cc/metadata/metadata_extractor.h" #include "tensorflow/lite/c/common.h" #include "tensorflow/lite/core/api/op_resolver.h" -#include "tensorflow/lite/core/shims/cc/kernels/builtin_op_kernels.h" -#include "tensorflow/lite/core/shims/cc/shims_test_util.h" +#include "tensorflow/lite/kernels/builtin_op_kernels.h" #include "tensorflow/lite/mutable_op_resolver.h" +#include "tensorflow/lite/test_util.h" namespace tflite { namespace ops { @@ -116,7 +116,7 @@ void CheckModelResourcesPackets(const ModelResources* model_resources) { } // namespace -class ModelResourcesTest : public tflite_shims::testing::Test {}; +class ModelResourcesTest : public tflite::testing::Test {}; TEST_F(ModelResourcesTest, CreateFromBinaryContent) { auto model_file = std::make_unique(); @@ -211,7 +211,7 @@ TEST_F(ModelResourcesTest, CreateSuccessWithCustomOpsFromFile) { static constexpr char kCustomOpName[] = "MY_CUSTOM_OP"; tflite::MutableOpResolver resolver; resolver.AddBuiltin(::tflite::BuiltinOperator_ADD, - ::tflite_shims::ops::builtin::Register_ADD()); + ::tflite::ops::builtin::Register_ADD()); resolver.AddCustom(kCustomOpName, ::tflite::ops::custom::Register_MY_CUSTOM_OP()); @@ -275,7 +275,7 @@ TEST_F(ModelResourcesTest, CreateSuccessWithCustomOpsPacket) { static constexpr char kCustomOpName[] = "MY_CUSTOM_OP"; tflite::MutableOpResolver resolver; resolver.AddBuiltin(::tflite::BuiltinOperator_ADD, - ::tflite_shims::ops::builtin::Register_ADD()); + ::tflite::ops::builtin::Register_ADD()); resolver.AddCustom(kCustomOpName, ::tflite::ops::custom::Register_MY_CUSTOM_OP()); diff --git a/mediapipe/tasks/cc/core/task_runner_test.cc b/mediapipe/tasks/cc/core/task_runner_test.cc index fdd32eec4..75c6260af 100644 --- a/mediapipe/tasks/cc/core/task_runner_test.cc +++ b/mediapipe/tasks/cc/core/task_runner_test.cc @@ -32,7 +32,7 @@ limitations under the License. #include "mediapipe/framework/port/status_matchers.h" #include "mediapipe/tasks/cc/core/model_resources.h" #include "mediapipe/tasks/cc/core/proto/external_file.pb.h" -#include "tensorflow/lite/core/shims/cc/shims_test_util.h" +#include "tensorflow/lite/test_util.h" namespace mediapipe { namespace tasks { @@ -112,7 +112,7 @@ CalculatorGraphConfig GetModelSidePacketsToStreamPacketsGraphConfig( } // namespace -class TaskRunnerTest : public tflite_shims::testing::Test {}; +class TaskRunnerTest : public tflite::testing::Test {}; TEST_F(TaskRunnerTest, ConfigWithNoOutputStream) { CalculatorGraphConfig proto = ParseTextProtoOrDie(R"pb( diff --git a/mediapipe/tasks/cc/text/text_classifier/BUILD b/mediapipe/tasks/cc/text/text_classifier/BUILD index 3c9c3fc0e..4bf773270 100644 --- a/mediapipe/tasks/cc/text/text_classifier/BUILD +++ b/mediapipe/tasks/cc/text/text_classifier/BUILD @@ -89,7 +89,7 @@ cc_test( "@com_google_absl//absl/strings", "@com_google_absl//absl/strings:cord", "@com_google_sentencepiece//src:sentencepiece_processor", - "@org_tensorflow//tensorflow/lite/core/shims:cc_shims_test_util", + "@org_tensorflow//tensorflow/lite:test_util", ], ) diff --git a/mediapipe/tasks/cc/text/text_classifier/text_classifier_test.cc b/mediapipe/tasks/cc/text/text_classifier/text_classifier_test.cc index 98ca9e903..f800a0e52 100644 --- a/mediapipe/tasks/cc/text/text_classifier/text_classifier_test.cc +++ b/mediapipe/tasks/cc/text/text_classifier/text_classifier_test.cc @@ -36,7 +36,7 @@ limitations under the License. #include "mediapipe/tasks/cc/components/containers/category.h" #include "mediapipe/tasks/cc/components/containers/classification_result.h" #include "mediapipe/tasks/cc/text/text_classifier/text_classifier_test_utils.h" -#include "tensorflow/lite/core/shims/cc/shims_test_util.h" +#include "tensorflow/lite/test_util.h" namespace mediapipe::tasks::text::text_classifier { namespace { @@ -87,7 +87,7 @@ void ExpectApproximatelyEqual(const TextClassifierResult& actual, } // namespace -class TextClassifierTest : public tflite_shims::testing::Test {}; +class TextClassifierTest : public tflite::testing::Test {}; TEST_F(TextClassifierTest, CreateSucceedsWithBertModel) { auto options = std::make_unique(); diff --git a/mediapipe/tasks/cc/text/text_embedder/BUILD b/mediapipe/tasks/cc/text/text_embedder/BUILD index c6a2616b0..addb971f1 100644 --- a/mediapipe/tasks/cc/text/text_embedder/BUILD +++ b/mediapipe/tasks/cc/text/text_embedder/BUILD @@ -91,6 +91,6 @@ cc_test( "@com_google_absl//absl/status", "@com_google_absl//absl/status:statusor", "@com_google_sentencepiece//src:sentencepiece_processor", - "@org_tensorflow//tensorflow/lite/core/shims:cc_shims_test_util", + "@org_tensorflow//tensorflow/lite:test_util", ], ) diff --git a/mediapipe/tasks/cc/text/text_embedder/text_embedder_test.cc b/mediapipe/tasks/cc/text/text_embedder/text_embedder_test.cc index 533d829b9..5e0be5578 100644 --- a/mediapipe/tasks/cc/text/text_embedder/text_embedder_test.cc +++ b/mediapipe/tasks/cc/text/text_embedder/text_embedder_test.cc @@ -26,7 +26,7 @@ limitations under the License. #include "mediapipe/framework/port/status_matchers.h" #include "mediapipe/tasks/cc/common.h" #include "mediapipe/tasks/cc/components/containers/embedding_result.h" -#include "tensorflow/lite/core/shims/cc/shims_test_util.h" +#include "tensorflow/lite/test_util.h" namespace mediapipe::tasks::text::text_embedder { namespace { @@ -49,7 +49,7 @@ using ::mediapipe::file::JoinPath; using ::testing::HasSubstr; using ::testing::Optional; -class EmbedderTest : public tflite_shims::testing::Test {}; +class EmbedderTest : public tflite::testing::Test {}; TEST_F(EmbedderTest, FailsWithMissingModel) { auto text_embedder = diff --git a/mediapipe/tasks/cc/text/utils/BUILD b/mediapipe/tasks/cc/text/utils/BUILD index 7b979189c..15af7683b 100644 --- a/mediapipe/tasks/cc/text/utils/BUILD +++ b/mediapipe/tasks/cc/text/utils/BUILD @@ -81,6 +81,6 @@ cc_test( "@com_google_absl//absl/flags:flag", "@com_google_absl//absl/status:statusor", "@com_google_absl//absl/strings", - "@org_tensorflow//tensorflow/lite/core/shims:cc_shims_test_util", + "@org_tensorflow//tensorflow/lite:test_util", ], ) diff --git a/mediapipe/tasks/cc/text/utils/text_model_utils_test.cc b/mediapipe/tasks/cc/text/utils/text_model_utils_test.cc index 3e29ff0c3..2ec5686f7 100644 --- a/mediapipe/tasks/cc/text/utils/text_model_utils_test.cc +++ b/mediapipe/tasks/cc/text/utils/text_model_utils_test.cc @@ -28,7 +28,7 @@ limitations under the License. #include "mediapipe/tasks/cc/components/processors/proto/text_model_type.pb.h" #include "mediapipe/tasks/cc/core/model_resources.h" #include "mediapipe/tasks/cc/core/proto/external_file.pb.h" -#include "tensorflow/lite/core/shims/cc/shims_test_util.h" +#include "tensorflow/lite/test_util.h" namespace mediapipe::tasks::text::utils { @@ -76,7 +76,7 @@ absl::StatusOr GetModelTypeFromFile( } // namespace -class TextModelUtilsTest : public tflite_shims::testing::Test {}; +class TextModelUtilsTest : public tflite::testing::Test {}; TEST_F(TextModelUtilsTest, BertClassifierModelTest) { MP_ASSERT_OK_AND_ASSIGN(auto model_type, diff --git a/mediapipe/tasks/cc/vision/face_landmarker/face_blendshapes_graph_test.cc b/mediapipe/tasks/cc/vision/face_landmarker/face_blendshapes_graph_test.cc index b9351b891..5c342a8e9 100644 --- a/mediapipe/tasks/cc/vision/face_landmarker/face_blendshapes_graph_test.cc +++ b/mediapipe/tasks/cc/vision/face_landmarker/face_blendshapes_graph_test.cc @@ -29,7 +29,7 @@ limitations under the License. #include "mediapipe/tasks/cc/core/proto/base_options.pb.h" #include "mediapipe/tasks/cc/core/task_runner.h" #include "mediapipe/tasks/cc/vision/face_landmarker/proto/face_blendshapes_graph_options.pb.h" -#include "tensorflow/lite/core/shims/cc/shims_test_util.h" +#include "tensorflow/lite/test_util.h" namespace mediapipe { namespace tasks { @@ -105,7 +105,7 @@ absl::StatusOr> CreateTaskRunner() { graph.GetConfig(), absl::make_unique()); } -class FaceBlendshapesTest : public tflite_shims::testing::Test {}; +class FaceBlendshapesTest : public tflite::testing::Test {}; TEST_F(FaceBlendshapesTest, SmokeTest) { // Prepare graph inputs. diff --git a/mediapipe/tasks/cc/vision/hand_landmarker/hand_landmarker_graph_test.cc b/mediapipe/tasks/cc/vision/hand_landmarker/hand_landmarker_graph_test.cc index c28df2c05..fc73e7787 100644 --- a/mediapipe/tasks/cc/vision/hand_landmarker/hand_landmarker_graph_test.cc +++ b/mediapipe/tasks/cc/vision/hand_landmarker/hand_landmarker_graph_test.cc @@ -43,7 +43,7 @@ limitations under the License. #include "mediapipe/tasks/cc/vision/hand_landmarker/proto/hand_landmarks_detector_graph_options.pb.h" #include "mediapipe/tasks/cc/vision/utils/image_utils.h" #include "tensorflow/lite/c/common.h" -#include "tensorflow/lite/core/shims/cc/shims_test_util.h" +#include "tensorflow/lite/test_util.h" namespace mediapipe { namespace tasks { @@ -137,7 +137,7 @@ absl::StatusOr> CreateTaskRunner() { graph.GetConfig(), absl::make_unique()); } -class HandLandmarkerTest : public tflite_shims::testing::Test {}; +class HandLandmarkerTest : public tflite::testing::Test {}; TEST_F(HandLandmarkerTest, Succeeds) { MP_ASSERT_OK_AND_ASSIGN( diff --git a/mediapipe/tasks/cc/vision/hand_landmarker/hand_landmarker_test.cc b/mediapipe/tasks/cc/vision/hand_landmarker/hand_landmarker_test.cc index 48e517977..bb7d1a905 100644 --- a/mediapipe/tasks/cc/vision/hand_landmarker/hand_landmarker_test.cc +++ b/mediapipe/tasks/cc/vision/hand_landmarker/hand_landmarker_test.cc @@ -41,7 +41,7 @@ limitations under the License. #include "mediapipe/tasks/cc/vision/core/image_processing_options.h" #include "mediapipe/tasks/cc/vision/hand_landmarker/hand_landmarker_result.h" #include "mediapipe/tasks/cc/vision/utils/image_utils.h" -#include "tensorflow/lite/core/shims/cc/shims_test_util.h" +#include "tensorflow/lite/test_util.h" namespace mediapipe { namespace tasks { diff --git a/mediapipe/tasks/cc/vision/hand_landmarker/hand_landmarks_detector_graph_test.cc b/mediapipe/tasks/cc/vision/hand_landmarker/hand_landmarks_detector_graph_test.cc index f28907d2f..bbf3a7cde 100644 --- a/mediapipe/tasks/cc/vision/hand_landmarker/hand_landmarks_detector_graph_test.cc +++ b/mediapipe/tasks/cc/vision/hand_landmarker/hand_landmarks_detector_graph_test.cc @@ -146,7 +146,7 @@ absl::StatusOr> CreateSingleHandTaskRunner( return TaskRunner::Create( graph.GetConfig(), - absl::make_unique()); + absl::make_unique()); } // Helper function to create a Multi Hand Landmark TaskRunner. @@ -188,7 +188,7 @@ absl::StatusOr> CreateMultiHandTaskRunner( return TaskRunner::Create( graph.GetConfig(), - absl::make_unique()); + absl::make_unique()); } NormalizedLandmarkList GetExpectedLandmarkList(absl::string_view filename) { diff --git a/mediapipe/tasks/cc/vision/image_classifier/image_classifier_test.cc b/mediapipe/tasks/cc/vision/image_classifier/image_classifier_test.cc index a9d6f55be..e8812d9fd 100644 --- a/mediapipe/tasks/cc/vision/image_classifier/image_classifier_test.cc +++ b/mediapipe/tasks/cc/vision/image_classifier/image_classifier_test.cc @@ -39,9 +39,9 @@ limitations under the License. #include "mediapipe/tasks/cc/vision/core/running_mode.h" #include "mediapipe/tasks/cc/vision/utils/image_utils.h" #include "tensorflow/lite/core/api/op_resolver.h" -#include "tensorflow/lite/core/shims/cc/shims_test_util.h" #include "tensorflow/lite/kernels/builtin_op_kernels.h" #include "tensorflow/lite/mutable_op_resolver.h" +#include "tensorflow/lite/test_util.h" namespace mediapipe { namespace tasks { @@ -148,7 +148,7 @@ class MobileNetQuantizedOpResolverMissingOps const MobileNetQuantizedOpResolverMissingOps& r) = delete; }; -class CreateTest : public tflite_shims::testing::Test {}; +class CreateTest : public tflite::testing::Test {}; TEST_F(CreateTest, SucceedsWithSelectiveOpResolver) { auto options = std::make_unique(); @@ -265,7 +265,7 @@ TEST_F(CreateTest, FailsWithMissingCallbackInLiveStreamMode) { MediaPipeTasksStatus::kInvalidTaskGraphConfigError)))); } -class ImageModeTest : public tflite_shims::testing::Test {}; +class ImageModeTest : public tflite::testing::Test {}; TEST_F(ImageModeTest, FailsWithCallingWrongMethod) { MP_ASSERT_OK_AND_ASSIGN( @@ -605,7 +605,7 @@ TEST_F(ImageModeTest, FailsWithInvalidImageProcessingOptions) { MediaPipeTasksStatus::kImageProcessingInvalidArgumentError)))); } -class VideoModeTest : public tflite_shims::testing::Test {}; +class VideoModeTest : public tflite::testing::Test {}; TEST_F(VideoModeTest, FailsWithCallingWrongMethod) { MP_ASSERT_OK_AND_ASSIGN( @@ -707,7 +707,7 @@ TEST_F(VideoModeTest, SucceedsWithRegionOfInterest) { MP_ASSERT_OK(image_classifier->Close()); } -class LiveStreamModeTest : public tflite_shims::testing::Test {}; +class LiveStreamModeTest : public tflite::testing::Test {}; TEST_F(LiveStreamModeTest, FailsWithCallingWrongMethod) { MP_ASSERT_OK_AND_ASSIGN( diff --git a/mediapipe/tasks/cc/vision/image_embedder/image_embedder_test.cc b/mediapipe/tasks/cc/vision/image_embedder/image_embedder_test.cc index 748333f7d..7a0e9e9dc 100644 --- a/mediapipe/tasks/cc/vision/image_embedder/image_embedder_test.cc +++ b/mediapipe/tasks/cc/vision/image_embedder/image_embedder_test.cc @@ -30,9 +30,9 @@ limitations under the License. #include "mediapipe/tasks/cc/vision/core/running_mode.h" #include "mediapipe/tasks/cc/vision/utils/image_utils.h" #include "tensorflow/lite/core/api/op_resolver.h" -#include "tensorflow/lite/core/shims/cc/shims_test_util.h" #include "tensorflow/lite/kernels/builtin_op_kernels.h" #include "tensorflow/lite/mutable_op_resolver.h" +#include "tensorflow/lite/test_util.h" namespace mediapipe { namespace tasks { @@ -103,7 +103,7 @@ class MobileNetV3OpResolverMissingOps : public ::tflite::MutableOpResolver { delete; }; -class CreateTest : public tflite_shims::testing::Test {}; +class CreateTest : public tflite::testing::Test {}; TEST_F(CreateTest, SucceedsWithSelectiveOpResolver) { auto options = std::make_unique(); @@ -181,7 +181,7 @@ TEST_F(CreateTest, FailsWithMissingCallbackInLiveStreamMode) { MediaPipeTasksStatus::kInvalidTaskGraphConfigError)))); } -class ImageModeTest : public tflite_shims::testing::Test {}; +class ImageModeTest : public tflite::testing::Test {}; TEST_F(ImageModeTest, FailsWithCallingWrongMethod) { MP_ASSERT_OK_AND_ASSIGN( @@ -410,7 +410,7 @@ TEST_F(ImageModeTest, SucceedsWithRegionOfInterestAndRotation) { EXPECT_LE(abs(similarity - expected_similarity), kSimilarityTolerancy); } -class VideoModeTest : public tflite_shims::testing::Test {}; +class VideoModeTest : public tflite::testing::Test {}; TEST_F(VideoModeTest, FailsWithCallingWrongMethod) { MP_ASSERT_OK_AND_ASSIGN( @@ -494,7 +494,7 @@ TEST_F(VideoModeTest, Succeeds) { MP_ASSERT_OK(image_embedder->Close()); } -class LiveStreamModeTest : public tflite_shims::testing::Test {}; +class LiveStreamModeTest : public tflite::testing::Test {}; TEST_F(LiveStreamModeTest, FailsWithCallingWrongMethod) { MP_ASSERT_OK_AND_ASSIGN( diff --git a/mediapipe/tasks/cc/vision/image_segmenter/image_segmenter_test.cc b/mediapipe/tasks/cc/vision/image_segmenter/image_segmenter_test.cc index 0c5a61486..21f73e103 100644 --- a/mediapipe/tasks/cc/vision/image_segmenter/image_segmenter_test.cc +++ b/mediapipe/tasks/cc/vision/image_segmenter/image_segmenter_test.cc @@ -39,9 +39,9 @@ limitations under the License. #include "mediapipe/tasks/cc/vision/image_segmenter/image_segmenter_result.h" #include "mediapipe/tasks/cc/vision/image_segmenter/proto/image_segmenter_graph_options.pb.h" #include "mediapipe/tasks/cc/vision/utils/image_utils.h" -#include "tensorflow/lite/core/shims/cc/shims_test_util.h" #include "tensorflow/lite/kernels/builtin_op_kernels.h" #include "tensorflow/lite/mutable_op_resolver.h" +#include "tensorflow/lite/test_util.h" namespace mediapipe { namespace tasks { @@ -180,7 +180,7 @@ class DeepLabOpResolver : public ::tflite::MutableOpResolver { DeepLabOpResolver(const DeepLabOpResolver& r) = delete; }; -class CreateFromOptionsTest : public tflite_shims::testing::Test {}; +class CreateFromOptionsTest : public tflite::testing::Test {}; class DeepLabOpResolverMissingOps : public ::tflite::MutableOpResolver { public: @@ -268,7 +268,7 @@ TEST(GetLabelsTest, SucceedsWithLabelsInModel) { } } -class ImageModeTest : public tflite_shims::testing::Test {}; +class ImageModeTest : public tflite::testing::Test {}; TEST_F(ImageModeTest, SucceedsWithCategoryMask) { MP_ASSERT_OK_AND_ASSIGN( @@ -521,7 +521,7 @@ TEST_F(ImageModeTest, SucceedsHairSegmentation) { SimilarToFloatMask(expected_mask_float, kGoldenMaskSimilarity)); } -class VideoModeTest : public tflite_shims::testing::Test {}; +class VideoModeTest : public tflite::testing::Test {}; TEST_F(VideoModeTest, FailsWithCallingWrongMethod) { MP_ASSERT_OK_AND_ASSIGN( @@ -581,7 +581,7 @@ TEST_F(VideoModeTest, Succeeds) { MP_ASSERT_OK(segmenter->Close()); } -class LiveStreamModeTest : public tflite_shims::testing::Test {}; +class LiveStreamModeTest : public tflite::testing::Test {}; TEST_F(LiveStreamModeTest, FailsWithCallingWrongMethod) { MP_ASSERT_OK_AND_ASSIGN(Image image, DecodeImageFromFile(JoinPath( diff --git a/mediapipe/tasks/cc/vision/interactive_segmenter/interactive_segmenter_test.cc b/mediapipe/tasks/cc/vision/interactive_segmenter/interactive_segmenter_test.cc index 40c2bb342..c761678d0 100644 --- a/mediapipe/tasks/cc/vision/interactive_segmenter/interactive_segmenter_test.cc +++ b/mediapipe/tasks/cc/vision/interactive_segmenter/interactive_segmenter_test.cc @@ -39,9 +39,9 @@ limitations under the License. #include "mediapipe/tasks/cc/vision/image_segmenter/calculators/tensors_to_segmentation_calculator.pb.h" #include "mediapipe/tasks/cc/vision/image_segmenter/proto/image_segmenter_graph_options.pb.h" #include "mediapipe/tasks/cc/vision/utils/image_utils.h" -#include "tensorflow/lite/core/shims/cc/shims_test_util.h" #include "tensorflow/lite/kernels/builtin_op_kernels.h" #include "tensorflow/lite/mutable_op_resolver.h" +#include "tensorflow/lite/test_util.h" #include "testing/base/public/gmock.h" namespace mediapipe { @@ -124,7 +124,7 @@ MATCHER_P3(SimilarToUint8Mask, expected_mask, similarity_threshold, similarity_threshold; } -class CreateFromOptionsTest : public tflite_shims::testing::Test {}; +class CreateFromOptionsTest : public tflite::testing::Test {}; class DeepLabOpResolverMissingOps : public ::tflite::MutableOpResolver { public: @@ -261,7 +261,7 @@ INSTANTIATE_TEST_SUITE_P( [](const ::testing::TestParamInfo& info) { return info.param.test_name; }); -class ImageModeTest : public tflite_shims::testing::Test {}; +class ImageModeTest : public tflite::testing::Test {}; // TODO: fix this unit test after image segmenter handled post // processing correctly with rotated image. diff --git a/mediapipe/tasks/cc/vision/object_detector/object_detector_test.cc b/mediapipe/tasks/cc/vision/object_detector/object_detector_test.cc index 178f95168..c992cf67e 100644 --- a/mediapipe/tasks/cc/vision/object_detector/object_detector_test.cc +++ b/mediapipe/tasks/cc/vision/object_detector/object_detector_test.cc @@ -43,9 +43,9 @@ limitations under the License. #include "mediapipe/tasks/cc/vision/utils/image_utils.h" #include "tensorflow/lite/c/common.h" #include "tensorflow/lite/core/api/op_resolver.h" -#include "tensorflow/lite/core/shims/cc/shims_test_util.h" #include "tensorflow/lite/kernels/builtin_op_kernels.h" #include "tensorflow/lite/mutable_op_resolver.h" +#include "tensorflow/lite/test_util.h" namespace tflite { namespace ops { @@ -159,7 +159,7 @@ class MobileSsdQuantizedOpResolver : public ::tflite::MutableOpResolver { MobileSsdQuantizedOpResolver(const MobileSsdQuantizedOpResolver& r) = delete; }; -class CreateFromOptionsTest : public tflite_shims::testing::Test {}; +class CreateFromOptionsTest : public tflite::testing::Test {}; TEST_F(CreateFromOptionsTest, SucceedsWithSelectiveOpResolver) { auto options = std::make_unique(); @@ -332,7 +332,7 @@ TEST_F(CreateFromOptionsTest, InputTensorSpecsForEfficientDetModel) { // TODO: Add NumThreadsTest back after having an // "acceleration configuration" field in the ObjectDetectorOptions. -class ImageModeTest : public tflite_shims::testing::Test {}; +class ImageModeTest : public tflite::testing::Test {}; TEST_F(ImageModeTest, FailsWithCallingWrongMethod) { MP_ASSERT_OK_AND_ASSIGN(Image image, DecodeImageFromFile(JoinPath( @@ -618,7 +618,7 @@ TEST_F(ImageModeTest, FailsWithRegionOfInterest) { MediaPipeTasksStatus::kImageProcessingInvalidArgumentError)))); } -class VideoModeTest : public tflite_shims::testing::Test {}; +class VideoModeTest : public tflite::testing::Test {}; TEST_F(VideoModeTest, FailsWithCallingWrongMethod) { MP_ASSERT_OK_AND_ASSIGN(Image image, DecodeImageFromFile(JoinPath( @@ -673,7 +673,7 @@ TEST_F(VideoModeTest, Succeeds) { MP_ASSERT_OK(object_detector->Close()); } -class LiveStreamModeTest : public tflite_shims::testing::Test {}; +class LiveStreamModeTest : public tflite::testing::Test {}; TEST_F(LiveStreamModeTest, FailsWithCallingWrongMethod) { MP_ASSERT_OK_AND_ASSIGN(Image image, DecodeImageFromFile(JoinPath( diff --git a/mediapipe/tasks/cc/vision/pose_landmarker/pose_landmarks_detector_graph_test.cc b/mediapipe/tasks/cc/vision/pose_landmarker/pose_landmarks_detector_graph_test.cc index a8592061c..d5108decf 100644 --- a/mediapipe/tasks/cc/vision/pose_landmarker/pose_landmarks_detector_graph_test.cc +++ b/mediapipe/tasks/cc/vision/pose_landmarker/pose_landmarks_detector_graph_test.cc @@ -143,7 +143,7 @@ absl::StatusOr> CreateSinglePoseTaskRunner( return TaskRunner::Create( graph.GetConfig(), - absl::make_unique()); + absl::make_unique()); } // Helper function to create a Multi Pose Landmark TaskRunner. @@ -189,7 +189,7 @@ absl::StatusOr> CreateMultiPoseTaskRunner( return TaskRunner::Create( graph.GetConfig(), - absl::make_unique()); + absl::make_unique()); } NormalizedLandmarkList GetExpectedLandmarkList(absl::string_view filename) { diff --git a/mediapipe/tasks/cc/vision/utils/BUILD b/mediapipe/tasks/cc/vision/utils/BUILD index 2d133cc98..7e5a4dc8c 100644 --- a/mediapipe/tasks/cc/vision/utils/BUILD +++ b/mediapipe/tasks/cc/vision/utils/BUILD @@ -50,7 +50,7 @@ cc_test_with_tflite( tflite_deps = [ ":image_tensor_specs", "//mediapipe/tasks/cc/core:model_resources", - "@org_tensorflow//tensorflow/lite/core/shims:cc_shims_test_util", + "@org_tensorflow//tensorflow/lite:test_util", ], deps = [ "//mediapipe/framework/deps:file_path", diff --git a/mediapipe/tasks/cc/vision/utils/image_tensor_specs_test.cc b/mediapipe/tasks/cc/vision/utils/image_tensor_specs_test.cc index 5d6fcf98c..8c7b7d595 100644 --- a/mediapipe/tasks/cc/vision/utils/image_tensor_specs_test.cc +++ b/mediapipe/tasks/cc/vision/utils/image_tensor_specs_test.cc @@ -35,7 +35,7 @@ limitations under the License. #include "mediapipe/tasks/cc/core/proto/external_file.pb.h" #include "mediapipe/tasks/cc/metadata/metadata_extractor.h" #include "mediapipe/tasks/metadata/metadata_schema_generated.h" -#include "tensorflow/lite/core/shims/cc/shims_test_util.h" +#include "tensorflow/lite/test_util.h" namespace mediapipe { namespace tasks { @@ -69,7 +69,7 @@ constexpr char kMobileNetMetadata[] = constexpr char kMobileNetQuantizedPartialMetadata[] = "mobilenet_v1_0.25_224_quant_without_subgraph_metadata.tflite"; -class ImageTensorSpecsTest : public tflite_shims::testing::Test {}; +class ImageTensorSpecsTest : public tflite::testing::Test {}; TEST_F(ImageTensorSpecsTest, BuildInputImageTensorSpecsWorks) { auto model_file = std::make_unique(); diff --git a/mediapipe/tasks/java/com/google/mediapipe/tasks/core/jni/BUILD b/mediapipe/tasks/java/com/google/mediapipe/tasks/core/jni/BUILD index 97f8dfd15..8f8abf06f 100644 --- a/mediapipe/tasks/java/com/google/mediapipe/tasks/core/jni/BUILD +++ b/mediapipe/tasks/java/com/google/mediapipe/tasks/core/jni/BUILD @@ -28,7 +28,7 @@ cc_library_with_tflite( ], tflite_deps = [ "//mediapipe/tasks/cc/core:model_resources_cache", - "@org_tensorflow//tensorflow/lite/core/shims:builtin_ops", + "@org_tensorflow//tensorflow/lite/kernels:builtin_ops", ], deps = [ "//mediapipe/java/com/google/mediapipe/framework/jni:mediapipe_framework_jni", diff --git a/mediapipe/tasks/java/com/google/mediapipe/tasks/core/jni/model_resources_cache_jni.cc b/mediapipe/tasks/java/com/google/mediapipe/tasks/core/jni/model_resources_cache_jni.cc index aab022dec..c7e015639 100644 --- a/mediapipe/tasks/java/com/google/mediapipe/tasks/core/jni/model_resources_cache_jni.cc +++ b/mediapipe/tasks/java/com/google/mediapipe/tasks/core/jni/model_resources_cache_jni.cc @@ -19,7 +19,7 @@ #include "mediapipe/java/com/google/mediapipe/framework/jni/graph_service_jni.h" #include "mediapipe/tasks/cc/core/mediapipe_builtin_op_resolver.h" #include "mediapipe/tasks/cc/core/model_resources_cache.h" -#include "tensorflow/lite/core/shims/cc/kernels/register.h" +#include "tensorflow/lite/kernels/register.h" namespace { using ::mediapipe::tasks::core::kModelResourcesCacheService; diff --git a/mediapipe/util/tflite/BUILD b/mediapipe/util/tflite/BUILD index a0bbdbf3f..59663c9ba 100644 --- a/mediapipe/util/tflite/BUILD +++ b/mediapipe/util/tflite/BUILD @@ -125,7 +125,7 @@ cc_library_with_tflite( srcs = ["tflite_model_loader.cc"], hdrs = ["tflite_model_loader.h"], tflite_deps = [ - "@org_tensorflow//tensorflow/lite/core/shims:framework_stable", + "@org_tensorflow//tensorflow/lite:framework_stable", ], visibility = ["//visibility:public"], deps = [ diff --git a/mediapipe/util/tflite/tflite_model_loader.cc b/mediapipe/util/tflite/tflite_model_loader.cc index 86fc260bb..a2a3cc2be 100644 --- a/mediapipe/util/tflite/tflite_model_loader.cc +++ b/mediapipe/util/tflite/tflite_model_loader.cc @@ -19,7 +19,7 @@ namespace mediapipe { -using FlatBufferModel = ::tflite_shims::FlatBufferModel; +using FlatBufferModel = ::tflite::FlatBufferModel; absl::StatusOr> TfLiteModelLoader::LoadFromPath( const std::string& path) { diff --git a/mediapipe/util/tflite/tflite_model_loader.h b/mediapipe/util/tflite/tflite_model_loader.h index 8c630ec8d..65bd9ba72 100644 --- a/mediapipe/util/tflite/tflite_model_loader.h +++ b/mediapipe/util/tflite/tflite_model_loader.h @@ -22,13 +22,13 @@ #include "mediapipe/framework/api2/packet.h" #include "mediapipe/framework/port/status.h" #include "mediapipe/framework/port/statusor.h" -#include "tensorflow/lite/core/shims/cc/model.h" +#include "tensorflow/lite/model.h" namespace mediapipe { // Represents a TfLite model as a FlatBuffer. using TfLiteModelPtr = - std::unique_ptr>; + std::unique_ptr>; class TfLiteModelLoader { public: