From 6b0ab0e0129ae966e44909cc77b8766820721532 Mon Sep 17 00:00:00 2001 From: MediaPipe Team Date: Wed, 5 Aug 2020 21:13:15 -0400 Subject: [PATCH] Project import generated by Copybara. GitOrigin-RevId: e9b30181bd6a75481835643d6f48c1c05730ff87 --- docs/framework_concepts/calculators.md | 5 ++-- docs/framework_concepts/packets.md | 2 +- docs/solutions/iris.md | 2 +- .../desktop/autoflip/quality/scene_cropper.cc | 8 +++---- .../autoflip/quality/scene_cropper_test.cc | 24 +++++++++++++++++++ mediapipe/framework/output_stream_handler.h | 2 +- mediapipe/gpu/gl_context_webgl.cc | 7 ++++-- 7 files changed, 37 insertions(+), 13 deletions(-) diff --git a/docs/framework_concepts/calculators.md b/docs/framework_concepts/calculators.md index 6c7657bfd..0ee3473e6 100644 --- a/docs/framework_concepts/calculators.md +++ b/docs/framework_concepts/calculators.md @@ -402,7 +402,6 @@ node { The diagram below shows how the `PacketClonerCalculator` defines its output packets (bottom) based on its series of input packets (top). -| ![Graph using | -: PacketClonerCalculator](../images/packet_cloner_calculator.png) : -| :--------------------------------------------------------------------------: | +| ![Graph using PacketClonerCalculator](../images/packet_cloner_calculator.png) | +| :---------------------------------------------------------------------------: | | *Each time it receives a packet on its TICK input stream, the PacketClonerCalculator outputs the most recent packet from each of its input streams. The sequence of output packets (bottom) is determined by the sequence of input packets (top) and their timestamps. The timestamps are shown along the right side of the diagram.* | diff --git a/docs/framework_concepts/packets.md b/docs/framework_concepts/packets.md index bb0b61d6a..bdf11c69f 100644 --- a/docs/framework_concepts/packets.md +++ b/docs/framework_concepts/packets.md @@ -20,7 +20,7 @@ Packets are generally created with `MediaPipe::Adopt()` (from packet.h). ```c++ // Create some data. -auto data = gtl::MakeUnique("constructor_argument"); +auto data = absl::make_unique("constructor_argument"); // Create a packet to own the data. Packet p = Adopt(data.release()); // Make a new packet with the same data and a different timestamp. diff --git a/docs/solutions/iris.md b/docs/solutions/iris.md index eb2ecdd94..d95b804ca 100644 --- a/docs/solutions/iris.md +++ b/docs/solutions/iris.md @@ -76,7 +76,7 @@ to visualize its associated subgraphs, please see ### Face Detection Model -The face detector is the same [bazelFace](https://arxiv.org/abs/1907.05047) +The face detector is the same [BlazeFace](https://arxiv.org/abs/1907.05047) model used in [MediaPipe Face Detection](./face_detection.md). ### Face Landmark Model diff --git a/mediapipe/examples/desktop/autoflip/quality/scene_cropper.cc b/mediapipe/examples/desktop/autoflip/quality/scene_cropper.cc index acb66ced6..420cb8146 100644 --- a/mediapipe/examples/desktop/autoflip/quality/scene_cropper.cc +++ b/mediapipe/examples/desktop/autoflip/quality/scene_cropper.cc @@ -144,11 +144,9 @@ namespace autoflip { // renderer. for (int i = 0; i < num_scene_frames; i++) { const int left = -(scene_frame_xforms[i].at(0, 2)); - const int right = left + crop_width; - const int top = top_static_border_size; - const int bottom = frame_height_ - bottom_static_border_size; - crop_from_location->push_back( - cv::Rect(left, top, right - left, bottom - top)); + const int top = + top_static_border_size - (scene_frame_xforms[i].at(1, 2)); + crop_from_location->push_back(cv::Rect(left, top, crop_width, crop_height)); } // If no cropped_frames is passed in, return directly. diff --git a/mediapipe/examples/desktop/autoflip/quality/scene_cropper_test.cc b/mediapipe/examples/desktop/autoflip/quality/scene_cropper_test.cc index e0e4f9d15..fb2c989b2 100644 --- a/mediapipe/examples/desktop/autoflip/quality/scene_cropper_test.cc +++ b/mediapipe/examples/desktop/autoflip/quality/scene_cropper_test.cc @@ -201,5 +201,29 @@ TEST(SceneCropperTest, CropFramesWorksWithPriorFocusPointFrames) { } } +// Checks that crop_from_locations gets the correct results. +TEST(SceneCropperTest, CropFromLocation) { + CameraMotionOptions options; + options.mutable_polynomial_path_solver()->set_prior_frame_buffer_size(30); + SceneCropper scene_cropper(options, kSceneWidth, kSceneHeight); + std::vector cropped_frames; + std::vector crop_from_locations; + const auto& scene_frames = GetDefaultSceneFrames(); + MP_EXPECT_OK(scene_cropper.CropFrames( + GetDefaultSceneKeyFrameCropSummary(), GetTimestamps(scene_frames.size()), + GetIsKeyframe(scene_frames.size()), scene_frames, + GetDefaultFocusPointFrames(), GetFocusPointFrames(3), 0, 0, false, + &crop_from_locations, &cropped_frames)); + EXPECT_EQ(cropped_frames.size(), kNumSceneFrames); + for (int i = 0; i < kNumSceneFrames; ++i) { + EXPECT_EQ(cropped_frames[i].rows, kCropHeight); + EXPECT_EQ(cropped_frames[i].cols, kCropWidth); + } + for (int i = 0; i < kNumSceneFrames; ++i) { + EXPECT_EQ(crop_from_locations[i].height, kCropHeight); + EXPECT_EQ(crop_from_locations[i].width, kCropWidth); + } +} + } // namespace autoflip } // namespace mediapipe diff --git a/mediapipe/framework/output_stream_handler.h b/mediapipe/framework/output_stream_handler.h index b9ec42b92..092fa78b2 100644 --- a/mediapipe/framework/output_stream_handler.h +++ b/mediapipe/framework/output_stream_handler.h @@ -155,7 +155,7 @@ class OutputStreamHandler { // TODO: Rename the variable to be more descriptive. Timestamp task_timestamp_bound_ ABSL_GUARDED_BY(timestamp_mutex_); - // PropagateionState indicates the current state of the propagation process. + // PropagationState indicates the current state of the propagation process. // There are eight possible transitions: // (a) From kIdle to kPropagatingPackets. // Any thread that makes this transition becomes the propagation thread, and diff --git a/mediapipe/gpu/gl_context_webgl.cc b/mediapipe/gpu/gl_context_webgl.cc index a06917922..19c0ea506 100644 --- a/mediapipe/gpu/gl_context_webgl.cc +++ b/mediapipe/gpu/gl_context_webgl.cc @@ -141,8 +141,8 @@ GlContext::StatusOrGlContext GlContext::Create( } MP_RETURN_IF_ERROR(status); - LOG(INFO) << "Successfully created a WebGL Context with major version " - << gl_major_version_ << " and context " << context_; + LOG(INFO) << "Successfully created a WebGL context with major version " + << gl_major_version_ << " and handle " << context_; return ::mediapipe::OkStatus(); } @@ -158,6 +158,9 @@ void GlContext::DestroyContext() { EMSCRIPTEN_RESULT res = emscripten_webgl_destroy_context(context_); if (res != EMSCRIPTEN_RESULT_SUCCESS) { LOG(ERROR) << "emscripten_webgl_destroy_context() returned error " << res; + } else { + LOG(INFO) << "Successfully destroyed WebGL context with handle " + << context_; } context_ = 0; }