From 7c267115319d51075b3f2a8829afa4ad6a931e90 Mon Sep 17 00:00:00 2001 From: shortcipher3 Date: Mon, 7 Sep 2020 21:03:40 -0600 Subject: [PATCH 1/2] Update landmark_projection_calculator.cc Fixed minor typo --- mediapipe/calculators/util/landmark_projection_calculator.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediapipe/calculators/util/landmark_projection_calculator.cc b/mediapipe/calculators/util/landmark_projection_calculator.cc index 0309c530a..c44dceb9a 100644 --- a/mediapipe/calculators/util/landmark_projection_calculator.cc +++ b/mediapipe/calculators/util/landmark_projection_calculator.cc @@ -100,7 +100,7 @@ class LandmarkProjectionCalculator : public CalculatorBase { CollectionItemId input_id = cc->Inputs().BeginId(kLandmarksTag); CollectionItemId output_id = cc->Outputs().BeginId(kLandmarksTag); - // Number of inputs and outpus is the same according to the contract. + // Number of inputs and outputs is the same according to the contract. for (; input_id != cc->Inputs().EndId(kLandmarksTag); ++input_id, ++output_id) { const auto& input_packet = cc->Inputs().Get(input_id); From bf9dfe4df70ec94e8aa80bbaa15f61fd01057d72 Mon Sep 17 00:00:00 2001 From: shortcipher3 Date: Tue, 8 Sep 2020 22:25:09 -0600 Subject: [PATCH 2/2] Fixed application hanging for iris depth example when no face is in the input image --- mediapipe/calculators/util/non_max_suppression_calculator.cc | 3 +++ .../calculators/util/non_max_suppression_calculator.proto | 3 +++ .../modules/face_detection/face_detection_front_cpu.pbtxt | 1 + 3 files changed, 7 insertions(+) diff --git a/mediapipe/calculators/util/non_max_suppression_calculator.cc b/mediapipe/calculators/util/non_max_suppression_calculator.cc index 1ea1b3d6b..5721deba5 100644 --- a/mediapipe/calculators/util/non_max_suppression_calculator.cc +++ b/mediapipe/calculators/util/non_max_suppression_calculator.cc @@ -199,6 +199,9 @@ class NonMaxSuppressionCalculator : public CalculatorBase { if (options_.return_empty_detections()) { cc->Outputs().Index(0).Add(new Detections(), cc->InputTimestamp()); } + if (options_.error_on_empty_detections()) { + return ::mediapipe::InternalError("NonMaxSuppression received empty detections, but detections are required for this pipeline."); + } return ::mediapipe::OkStatus(); } diff --git a/mediapipe/calculators/util/non_max_suppression_calculator.proto b/mediapipe/calculators/util/non_max_suppression_calculator.proto index 5fa960497..f241f125c 100644 --- a/mediapipe/calculators/util/non_max_suppression_calculator.proto +++ b/mediapipe/calculators/util/non_max_suppression_calculator.proto @@ -58,6 +58,9 @@ message NonMaxSuppressionCalculatorOptions { // Whether to put empty detection vector in output stream. optional bool return_empty_detections = 5; + // Whether to throw an error on an empty input detection vector + optional bool error_on_empty_detections = 8; + // Algorithms that can be used to apply non-maximum suppression. enum NmsAlgorithm { DEFAULT = 0; diff --git a/mediapipe/modules/face_detection/face_detection_front_cpu.pbtxt b/mediapipe/modules/face_detection/face_detection_front_cpu.pbtxt index fda86fc50..8644af112 100644 --- a/mediapipe/modules/face_detection/face_detection_front_cpu.pbtxt +++ b/mediapipe/modules/face_detection/face_detection_front_cpu.pbtxt @@ -128,6 +128,7 @@ node { min_suppression_threshold: 0.3 overlap_type: INTERSECTION_OVER_UNION algorithm: WEIGHTED + error_on_empty_detections: true } } }