diff --git a/mediapipe/calculators/tensor/inference_calculator_test.cc b/mediapipe/calculators/tensor/inference_calculator_test.cc index 1be2e26036..ce59b6dff6 100644 --- a/mediapipe/calculators/tensor/inference_calculator_test.cc +++ b/mediapipe/calculators/tensor/inference_calculator_test.cc @@ -67,24 +67,18 @@ constexpr char kGraphWithModelAsInputSidePacket[] = R"( input_stream: "tensor_in" node { - calculator: "ConstantSidePacketCalculator" - output_side_packet: "PACKET:model_path" - options: { - [mediapipe.ConstantSidePacketCalculatorOptions.ext]: { - packet { string_value: "mediapipe/calculators/tensor/testdata/add.bin" } + calculator: "ResourceProviderCalculator" + output_side_packet: "RESOURCE:model_resource" + node_options { + [type.googleapis.com/mediapipe.ResourceProviderCalculatorOptions]: { + resource_id: "mediapipe/calculators/tensor/testdata/add.bin" } } } - node { - calculator: "LocalFileContentsCalculator" - input_side_packet: "FILE_PATH:model_path" - output_side_packet: "CONTENTS:model_blob" - } - node { calculator: "TfLiteModelCalculator" - input_side_packet: "MODEL_BLOB:model_blob" + input_side_packet: "MODEL_RESOURCE:model_resource" output_side_packet: "MODEL:model" } diff --git a/mediapipe/calculators/tflite/BUILD b/mediapipe/calculators/tflite/BUILD index f39a8aef51..2526088d18 100644 --- a/mediapipe/calculators/tflite/BUILD +++ b/mediapipe/calculators/tflite/BUILD @@ -503,8 +503,7 @@ cc_test( ":tflite_inference_calculator", ":tflite_inference_calculator_cc_proto", ":tflite_model_calculator", - "//mediapipe/calculators/core:constant_side_packet_calculator", - "//mediapipe/calculators/util:local_file_contents_calculator", + "//mediapipe/calculators/util:resource_provider_calculator", "//mediapipe/framework:calculator_framework", "//mediapipe/framework:calculator_runner", "//mediapipe/framework/deps:file_path", diff --git a/mediapipe/calculators/tflite/tflite_inference_calculator_test.cc b/mediapipe/calculators/tflite/tflite_inference_calculator_test.cc index 7636152e8a..82c18c8ad8 100644 --- a/mediapipe/calculators/tflite/tflite_inference_calculator_test.cc +++ b/mediapipe/calculators/tflite/tflite_inference_calculator_test.cc @@ -54,24 +54,18 @@ TEST(TfLiteInferenceCalculatorTest, SmokeTest_ModelAsInputSidePacket) { input_stream: "tensor_in" node { - calculator: "ConstantSidePacketCalculator" - output_side_packet: "PACKET:model_path" - options: { - [mediapipe.ConstantSidePacketCalculatorOptions.ext]: { - packet { string_value: "mediapipe/calculators/tflite/testdata/add.bin" } + calculator: "ResourceProviderCalculator" + output_side_packet: "RESOURCE:model_resource" + node_options { + [type.googleapis.com/mediapipe.ResourceProviderCalculatorOptions]: { + resource_id: "mediapipe/calculators/tflite/testdata/add.bin" } } } - node { - calculator: "LocalFileContentsCalculator" - input_side_packet: "FILE_PATH:model_path" - output_side_packet: "CONTENTS:model_blob" - } - node { calculator: "TfLiteModelCalculator" - input_side_packet: "MODEL_BLOB:model_blob" + input_side_packet: "MODEL_RESOURCE:model_resource" output_side_packet: "MODEL:model" } diff --git a/mediapipe/framework/api2/builder.h b/mediapipe/framework/api2/builder.h index 6e9550afef..0b307326ad 100644 --- a/mediapipe/framework/api2/builder.h +++ b/mediapipe/framework/api2/builder.h @@ -307,18 +307,18 @@ using SideSource = SourceImpl; // parts utility/convenience functions or classes. // // For example: -// SidePacket GetModel(SidePacket model_blob, +// SidePacket GetModel(SidePacket model_resource, // Graph& graph) { // auto& model_node = graph.AddNode("TfLiteModelCalculator"); -// model_blob >> model_node.SideIn("MODEL_BLOB"); +// model_resource >> model_node.SideIn("MODEL_RESOURCE"); // return model_node.SideOut("MODEL").Cast(); // } // // Where graph can use it as: // Graph graph; -// SidePacket model_blob = -// graph.SideIn("MODEL_BLOB").Cast(); -// SidePacket model = GetModel(model_blob, graph); +// SidePacket model_resource = +// graph.SideIn("MODEL_RESOURCE").Cast(); +// SidePacket model = GetModel(model_resource, graph); template using SidePacket = SideSource;