From 3ca8642ab57b7f067276da1c67ff8112b9f89c10 Mon Sep 17 00:00:00 2001 From: homuler Date: Mon, 3 May 2021 00:21:10 +0900 Subject: [PATCH] feat: read .binarypb --- .../Runtime/Scripts/Util/ResourceManager.cs | 1 + mediapipe_api/import_model.bzl | 2 +- third_party/mediapipe_model_path.diff | 12 ++++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Packages/com.github.homuler.mediapipe/Runtime/Scripts/Util/ResourceManager.cs b/Packages/com.github.homuler.mediapipe/Runtime/Scripts/Util/ResourceManager.cs index e160a3db7..35e9d3a5b 100644 --- a/Packages/com.github.homuler.mediapipe/Runtime/Scripts/Util/ResourceManager.cs +++ b/Packages/com.github.homuler.mediapipe/Runtime/Scripts/Util/ResourceManager.cs @@ -60,6 +60,7 @@ protected static string GetAssetNameFromPath(string assetPath) { var extension = Path.GetExtension(assetPath); switch (extension) { + case ".binarypb": case ".tflite": { return $"{assetName}.bytes"; } diff --git a/mediapipe_api/import_model.bzl b/mediapipe_api/import_model.bzl index 1a4075986..401647e53 100644 --- a/mediapipe_api/import_model.bzl +++ b/mediapipe_api/import_model.bzl @@ -53,7 +53,7 @@ _normalize_exts = rule( implementation = _normalize_exts_impl, attrs = { "srcs": attr.label_list(allow_files = True), - "bytes_exts": attr.string_list(default = ["jpg", "png", "tflite", "uuu"]), + "bytes_exts": attr.string_list(default = ["binarypb", "jpg", "png", "tflite", "uuu"]), "txt_exts": attr.string_list(default = ["pbtxt"]), }, ) diff --git a/third_party/mediapipe_model_path.diff b/third_party/mediapipe_model_path.diff index 88d7b3d82..2a942d947 100644 --- a/third_party/mediapipe_model_path.diff +++ b/third_party/mediapipe_model_path.diff @@ -1,3 +1,15 @@ +diff --git a/mediapipe/framework/encode_binary_proto.bzl b/mediapipe/framework/encode_binary_proto.bzl +index 3af435f..5a4a4a1 100644 +--- a/mediapipe/framework/encode_binary_proto.bzl ++++ b/mediapipe/framework/encode_binary_proto.bzl +@@ -104,6 +104,7 @@ def _encode_binary_proto_impl(ctx): + "--encode=" + ctx.attr.message_type, + "--proto_path=" + ctx.genfiles_dir.path, + "--proto_path=" + ctx.bin_dir.path, ++ "--proto_path=" + ctx.file.input.owner.workspace_root, + "--proto_path=.", + ] + path_list + file_list + + ["<", textpb.path, ">", binarypb.path], diff --git a/mediapipe/graphs/object_detection_3d/calculators/BUILD b/mediapipe/graphs/object_detection_3d/calculators/BUILD index 8f80312..45b8c53 100644 --- a/mediapipe/graphs/object_detection_3d/calculators/BUILD