Project import generated by Copybara.

GitOrigin-RevId: 0f2489d226f1e2a5d718a8b9efe5e8198ba4ab3b
This commit is contained in:
MediaPipe Team 2022-06-29 11:00:12 -07:00 committed by Sebastian Schmidt
parent c688862570
commit 63e679d99c
11 changed files with 27 additions and 16 deletions

View File

@ -569,7 +569,7 @@ next section.
Option 1. Follow Option 1. Follow
[the official Bazel documentation](https://docs.bazel.build/versions/master/install-windows.html) [the official Bazel documentation](https://docs.bazel.build/versions/master/install-windows.html)
to install Bazel 5.0.0 or higher. to install Bazel 5.2.0 or higher.
Option 2. Follow the official Option 2. Follow the official
[Bazel documentation](https://docs.bazel.build/versions/master/install-bazelisk.html) [Bazel documentation](https://docs.bazel.build/versions/master/install-bazelisk.html)

View File

@ -82,6 +82,8 @@ class ConstantSidePacketCalculator : public CalculatorBase {
packet.Set<ClassificationList>(); packet.Set<ClassificationList>();
} else if (packet_options.has_landmark_list_value()) { } else if (packet_options.has_landmark_list_value()) {
packet.Set<LandmarkList>(); packet.Set<LandmarkList>();
} else if (packet_options.has_double_value()) {
packet.Set<double>();
} else { } else {
return absl::InvalidArgumentError( return absl::InvalidArgumentError(
"None of supported values were specified in options."); "None of supported values were specified in options.");
@ -114,6 +116,8 @@ class ConstantSidePacketCalculator : public CalculatorBase {
} else if (packet_options.has_landmark_list_value()) { } else if (packet_options.has_landmark_list_value()) {
packet.Set( packet.Set(
MakePacket<LandmarkList>(packet_options.landmark_list_value())); MakePacket<LandmarkList>(packet_options.landmark_list_value()));
} else if (packet_options.has_double_value()) {
packet.Set(MakePacket<double>(packet_options.double_value()));
} else { } else {
return absl::InvalidArgumentError( return absl::InvalidArgumentError(
"None of supported values were specified in options."); "None of supported values were specified in options.");

View File

@ -36,6 +36,7 @@ message ConstantSidePacketCalculatorOptions {
uint64 uint64_value = 5; uint64 uint64_value = 5;
ClassificationList classification_list_value = 6; ClassificationList classification_list_value = 6;
LandmarkList landmark_list_value = 7; LandmarkList landmark_list_value = 7;
double double_value = 9;
} }
} }

View File

@ -170,13 +170,18 @@ cc_library(
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [ deps = [
":inference_calculator_interface", ":inference_calculator_interface",
"@com_google_absl//absl/memory",
"@com_google_absl//absl/status",
"//mediapipe/framework/deps:file_path", "//mediapipe/framework/deps:file_path",
"//mediapipe/gpu:gl_calculator_helper", "//mediapipe/gpu:gl_calculator_helper",
"//mediapipe/util/tflite:tflite_gpu_runner", "//mediapipe/util/tflite:tflite_gpu_runner",
"@com_google_absl//absl/memory",
"@com_google_absl//absl/status",
"@org_tensorflow//tensorflow/lite:framework_stable", "@org_tensorflow//tensorflow/lite:framework_stable",
] + select({
"//conditions:default": [],
"//mediapipe:android": [
"//mediapipe/util/android/file/base",
], ],
}),
alwayslink = 1, alwayslink = 1,
) )

View File

@ -753,7 +753,6 @@ cc_library(
"//mediapipe/calculators/tensorflow:unpack_media_sequence_calculator_cc_proto", "//mediapipe/calculators/tensorflow:unpack_media_sequence_calculator_cc_proto",
"//mediapipe/framework:calculator_framework", "//mediapipe/framework:calculator_framework",
"//mediapipe/framework/formats:location", "//mediapipe/framework/formats:location",
"//mediapipe/framework/port:ret_check",
"//mediapipe/framework/port:status", "//mediapipe/framework/port:status",
"//mediapipe/util:audio_decoder_cc_proto", "//mediapipe/util:audio_decoder_cc_proto",
"//mediapipe/util/sequence:media_sequence", "//mediapipe/util/sequence:media_sequence",

View File

@ -18,7 +18,6 @@
#include "mediapipe/calculators/tensorflow/unpack_media_sequence_calculator.pb.h" #include "mediapipe/calculators/tensorflow/unpack_media_sequence_calculator.pb.h"
#include "mediapipe/framework/calculator_framework.h" #include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/formats/location.h" #include "mediapipe/framework/formats/location.h"
#include "mediapipe/framework/port/ret_check.h"
#include "mediapipe/framework/port/status.h" #include "mediapipe/framework/port/status.h"
#include "mediapipe/util/audio_decoder.pb.h" #include "mediapipe/util/audio_decoder.pb.h"
#include "mediapipe/util/sequence/media_sequence.h" #include "mediapipe/util/sequence/media_sequence.h"

View File

@ -30,6 +30,10 @@ mediapipe::FieldData ReadFileDescriptorSet(const std::string& pb) {
*result.mutable_message_value()->mutable_type_url() = *result.mutable_message_value()->mutable_type_url() =
"proto2.FileDescriptorSet"; "proto2.FileDescriptorSet";
*result.mutable_message_value()->mutable_value() = pb; *result.mutable_message_value()->mutable_value() = pb;
// Force linking of the generated options protobuf.
mediapipe::proto_ns::LinkMessageReflection<
MP_OPTION_TYPE_NS::MP_OPTION_TYPE_NAME>();
return result; return result;
} }

View File

@ -243,6 +243,9 @@ std::string GetTestOutputsDir() {
size_t n = confstr(_CS_DARWIN_USER_TEMP_DIR, path, sizeof(path)); size_t n = confstr(_CS_DARWIN_USER_TEMP_DIR, path, sizeof(path));
if (n > 0 && n < sizeof(path)) return path; if (n > 0 && n < sizeof(path)) return path;
#endif // __APPLE__ #endif // __APPLE__
#ifdef __ANDROID__
return "/data/local/tmp/";
#endif // __ANDROID__
output_dir = "/tmp"; output_dir = "/tmp";
} }
return output_dir; return output_dir;

View File

@ -15,6 +15,7 @@
#include "mediapipe/python/pybind/matrix.h" #include "mediapipe/python/pybind/matrix.h"
#include "mediapipe/framework/formats/matrix.h" #include "mediapipe/framework/formats/matrix.h"
#include "pybind11/eigen.h"
#include "pybind11/numpy.h" #include "pybind11/numpy.h"
#include "pybind11/pybind11.h" #include "pybind11/pybind11.h"

View File

@ -401,6 +401,7 @@ cc_library(
hdrs = ["streaming_buffer.h"], hdrs = ["streaming_buffer.h"],
deps = [ deps = [
"//mediapipe/framework/port:logging", "//mediapipe/framework/port:logging",
"//mediapipe/framework/tool:type_util",
"@com_google_absl//absl/container:node_hash_map", "@com_google_absl//absl/container:node_hash_map",
"@com_google_absl//absl/strings", "@com_google_absl//absl/strings",
"@com_google_absl//absl/types:any", "@com_google_absl//absl/types:any",

View File

@ -25,6 +25,7 @@
#include "absl/container/node_hash_map.h" #include "absl/container/node_hash_map.h"
#include "absl/types/any.h" #include "absl/types/any.h"
#include "mediapipe/framework/port/logging.h" #include "mediapipe/framework/port/logging.h"
#include "mediapipe/framework/tool/type_util.h"
namespace mediapipe { namespace mediapipe {
@ -128,14 +129,6 @@ TaggedType TaggedPointerType(const std::string& tag);
template <class T> template <class T>
std::unique_ptr<T> MakeUnique(T* ptr); std::unique_ptr<T> MakeUnique(T* ptr);
template <typename Type>
inline size_t TypeId() {
static_assert(sizeof(char*) <= sizeof(size_t),
"ptr size too large for size_t");
static char dummy_var;
return reinterpret_cast<size_t>(&dummy_var);
}
// Note: If any of the function below are called with a tag not registered by // Note: If any of the function below are called with a tag not registered by
// the constructor, the function will fail with CHECK. // the constructor, the function will fail with CHECK.
// Also, if any of the functions below is called with an existing tag but // Also, if any of the functions below is called with an existing tag but
@ -318,7 +311,8 @@ class StreamingBuffer {
//// Implementation details. //// Implementation details.
template <class T> template <class T>
TaggedType TaggedPointerType(const std::string& tag) { TaggedType TaggedPointerType(const std::string& tag) {
return std::make_pair(tag, TypeId<StreamingBuffer::PointerType<T>>()); return std::make_pair(tag,
kTypeId<StreamingBuffer::PointerType<T>>.hash_code());
} }
template <class T> template <class T>
@ -330,7 +324,7 @@ template <class T>
void StreamingBuffer::AddDatum(const std::string& tag, void StreamingBuffer::AddDatum(const std::string& tag,
std::unique_ptr<T> pointer) { std::unique_ptr<T> pointer) {
CHECK(HasTag(tag)); CHECK(HasTag(tag));
CHECK_EQ(data_config_[tag], TypeId<PointerType<T>>()); CHECK_EQ(data_config_[tag], kTypeId<PointerType<T>>.hash_code());
auto& buffer = data_[tag]; auto& buffer = data_[tag];
absl::any packet(PointerType<T>(CreatePointer(pointer.release()))); absl::any packet(PointerType<T>(CreatePointer(pointer.release())));
buffer.push_back(packet); buffer.push_back(packet);