Skip to content

Commit

Permalink
build: mediapipe-0.8.5
Browse files Browse the repository at this point in the history
  • Loading branch information
homuler committed Jul 3, 2021
1 parent 24576ce commit 127561b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 21 deletions.
16 changes: 8 additions & 8 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ new_local_repository(
# mediapipe
http_archive(
name = "com_google_mediapipe",
strip_prefix = "mediapipe-0.8.4",
sha256 = "b44f8d19c6236ae46d7445a477739f24a221326a5cf55ca011350967e5981560",
strip_prefix = "mediapipe-0.8.5",
sha256 = "2a233540837b6e590a54e0a3c65d60d4d7d2113ec76b96504799a28003aab029",
patches = [
"@//third_party:mediapipe_opencv.diff",
"@//third_party:mediapipe_android.diff",
Expand All @@ -55,7 +55,7 @@ http_archive(
patch_args = [
"-p1",
],
urls = ["https://github.com/google/mediapipe/archive/v0.8.4.tar.gz"],
urls = ["https://github.com/google/mediapipe/archive/v0.8.5.tar.gz"],
)

# ABSL cpp library lts_2020_09_23
Expand Down Expand Up @@ -111,8 +111,8 @@ http_archive(
# Google Benchmark library.
http_archive(
name = "com_google_benchmark",
urls = ["https://github.com/google/benchmark/archive/master.zip"],
strip_prefix = "benchmark-master",
urls = ["https://github.com/google/benchmark/archive/main.zip"],
strip_prefix = "benchmark-main",
build_file = "@com_google_mediapipe//third_party:benchmark.BUILD",
)

Expand Down Expand Up @@ -411,9 +411,9 @@ http_archive(
)

# Tensorflow repo should always go after the other external dependencies.
# 2021-04-30
_TENSORFLOW_GIT_COMMIT = "5bd3c57ef184543d22e34e36cff9d9bea608e06d"
_TENSORFLOW_SHA256= "9a45862834221aafacf6fb275f92b3876bc89443cbecc51be93f13839a6609f0"
# 2021-05-27
_TENSORFLOW_GIT_COMMIT = "d6bfcdb0926173dbb7aa02ceba5aae6250b8aaa6"
_TENSORFLOW_SHA256 = "ec40e1462239d8783d02f76a43412c8f80bac71ea20e41e1b7729b990aad6923"
http_archive(
name = "org_tensorflow",
urls = [
Expand Down
18 changes: 8 additions & 10 deletions third_party/mediapipe_extension.diff
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ index 2e4ab10..6e5e073 100644
}

diff --git a/mediapipe/gpu/gl_scaler_calculator.cc b/mediapipe/gpu/gl_scaler_calculator.cc
index e50ef22..9cf0f2f 100644
index 6191876..19a8cf8 100644
--- a/mediapipe/gpu/gl_scaler_calculator.cc
+++ b/mediapipe/gpu/gl_scaler_calculator.cc
@@ -12,6 +12,8 @@
Expand All @@ -76,25 +76,25 @@ index e50ef22..9cf0f2f 100644
+// Modified to enable to specify the target GpuBuffer
+
#include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/formats/image.h"
#include "mediapipe/framework/port/ret_check.h"
#include "mediapipe/framework/port/status.h"
@@ -58,6 +60,7 @@ namespace mediapipe {
@@ -61,6 +63,7 @@ using Image = mediapipe::Image;
// existing calculator options, depending on field merge_fields.
// OUTPUT_DIMENSIONS: the output width and height in pixels.
// ROTATION: the counterclockwise rotation angle in degrees.
+// DESTINATION: the target GpuBuffer
// These can also be specified as options.
// To enable horizontal or vertical flip, specify them in options.
// The flipping is applied after rotation.
@@ -82,6 +85,7 @@ class GlScalerCalculator : public CalculatorBase {
@@ -85,6 +88,7 @@ class GlScalerCalculator : public CalculatorBase {

private:
GlCalculatorHelper helper_;
+ GpuBuffer dst_buffer_;
int dst_width_ = 0;
int dst_height_ = 0;
float dst_scale_ = -1.f;
@@ -109,6 +113,9 @@ absl::Status GlScalerCalculator::GetContract(CalculatorContract* cc) {
@@ -121,6 +125,9 @@ absl::Status GlScalerCalculator::GetContract(CalculatorContract* cc) {
}
MP_RETURN_IF_ERROR(GlCalculatorHelper::UpdateContract(cc));

Expand All @@ -104,21 +104,19 @@ index e50ef22..9cf0f2f 100644
if (cc->InputSidePackets().HasTag("OPTIONS")) {
cc->InputSidePackets().Tag("OPTIONS").Set<GlScalerCalculatorOptions>();
}
@@ -175,6 +182,13 @@ absl::Status GlScalerCalculator::Open(CalculatorContext* cc) {
@@ -187,6 +194,11 @@ absl::Status GlScalerCalculator::Open(CalculatorContext* cc) {
dst_width_ = dimensions[0];
dst_height_ = dimensions[1];
}
+
+ if (HasTagOrIndex(cc->InputSidePackets(), "DESTINATION", 1)) {
+ dst_buffer_ = cc->InputSidePackets().Tag("DESTINATION").Get<GpuBuffer>();
+ dst_width_ = dst_buffer_.width();
+ dst_height_ = dst_buffer_.height();
+ }
+
if (cc->InputSidePackets().HasTag("ROTATION")) {
rotation_ccw = cc->InputSidePackets().Tag("ROTATION").Get<int>();
}
@@ -185,7 +199,7 @@ absl::Status GlScalerCalculator::Open(CalculatorContext* cc) {
@@ -197,7 +209,7 @@ absl::Status GlScalerCalculator::Open(CalculatorContext* cc) {
}

absl::Status GlScalerCalculator::Process(CalculatorContext* cc) {
Expand All @@ -127,7 +125,7 @@ index e50ef22..9cf0f2f 100644
if (cc->Inputs().Tag("OUTPUT_DIMENSIONS").IsEmpty()) {
// OUTPUT_DIMENSIONS input stream is specified, but value is missing.
return absl::OkStatus();
@@ -264,9 +278,18 @@ absl::Status GlScalerCalculator::Process(CalculatorContext* cc) {
@@ -279,9 +291,18 @@ absl::Status GlScalerCalculator::Process(CalculatorContext* cc) {
MakePacket<float>(left_right_padding).At(cc->InputTimestamp()));
}

Expand Down
6 changes: 3 additions & 3 deletions third_party/mediapipe_model_path.diff
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ index 9bc43ba..088f8f8 100644
LOG(ERROR) << "Failed to load animation asset.";
return absl::UnknownError("Failed to load animation asset.");
diff --git a/mediapipe/util/BUILD b/mediapipe/util/BUILD
index 1fa71c6..758a81f 100644
index da12244..10b2034 100644
--- a/mediapipe/util/BUILD
+++ b/mediapipe/util/BUILD
@@ -155,12 +155,8 @@ cc_library(
Expand Down Expand Up @@ -294,7 +294,7 @@ index 1fa71c6..758a81f 100644

cc_library(
diff --git a/mediapipe/util/resource_util.cc b/mediapipe/util/resource_util.cc
index 042d1e8..89d9e9b 100644
index 8f40154..dfebafd 100644
--- a/mediapipe/util/resource_util.cc
+++ b/mediapipe/util/resource_util.cc
@@ -27,6 +27,7 @@ namespace mediapipe {
Expand All @@ -306,7 +306,7 @@ index 042d1e8..89d9e9b 100644

absl::Status GetResourceContents(const std::string& path, std::string* output,
@@ -37,8 +38,19 @@ absl::Status GetResourceContents(const std::string& path, std::string* output,
return absl::OkStatus();
return internal::DefaultGetResourceContents(path, output, read_as_binary);
}

+absl::StatusOr<std::string> PathToResourceAsFile(const std::string& path) {
Expand Down

0 comments on commit 127561b

Please sign in to comment.