Fixed application hanging for iris depth example when no face is in the input image

This commit is contained in:
shortcipher3 2020-09-08 22:25:09 -06:00
parent 7c26711531
commit bf9dfe4df7
3 changed files with 7 additions and 0 deletions

View File

@ -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();
}

View File

@ -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;

View File

@ -128,6 +128,7 @@ node {
min_suppression_threshold: 0.3
overlap_type: INTERSECTION_OVER_UNION
algorithm: WEIGHTED
error_on_empty_detections: true
}
}
}