Skip to content

Commit

Permalink
bugfix: ObjectDetection Graph Options have been fixed for Python API
Browse files Browse the repository at this point in the history
  • Loading branch information
Aniket Ray committed Jun 24, 2021
1 parent 5051cac commit 16e448c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
3 changes: 3 additions & 0 deletions mediapipe/modules/object_detection/object_detection_cpu.pbtxt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ node: {
# Converts the transformed input image on CPU into an image tensor stored as a
# TfLiteTensor.
node {
name: "objectdetectioncpu__TfLiteConverterCalculator"
calculator: "TfLiteConverterCalculator"
input_stream: "IMAGE:transformed_image"
output_stream: "TENSORS:image_tensor"
Expand Down Expand Up @@ -91,6 +92,7 @@ node {
# the SSD anchors and the specification in the options, into a vector of
# detections. Each detection describes a detected object.
node {
name: "TfLiteTensorsToDetectionsCalculator"
calculator: "TfLiteTensorsToDetectionsCalculator"
input_stream: "TENSORS:detection_tensors"
input_side_packet: "ANCHORS:anchors"
Expand All @@ -114,6 +116,7 @@ node {

# Performs non-max suppression to remove excessive detections.
node {
name: "NonMaxSuppressionCalculator"
calculator: "NonMaxSuppressionCalculator"
input_stream: "unfiltered_detections"
output_stream: "filtered_detections"
Expand Down
8 changes: 8 additions & 0 deletions mediapipe/python/solution_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ class contains the shared logic among the high-level Solution APIs including
from mediapipe.calculators.core import constant_side_packet_calculator_pb2
from mediapipe.calculators.image import image_transformation_calculator_pb2
from mediapipe.calculators.tensor import tensors_to_detections_calculator_pb2
from mediapipe.calculators.tflite import tflite_tensors_to_detections_calculator_pb2
from mediapipe.calculators.util import landmarks_smoothing_calculator_pb2
from mediapipe.calculators.util import logic_calculator_pb2
from mediapipe.calculators.util import thresholding_calculator_pb2
from mediapipe.calculators.util import non_max_suppression_calculator_pb2
from mediapipe.framework.formats import classification_pb2
from mediapipe.framework.formats import landmark_pb2
from mediapipe.framework.formats import rect_pb2
Expand Down Expand Up @@ -75,6 +77,12 @@ class contains the shared logic among the high-level Solution APIs including
'Lift2DFrameAnnotationTo3DCalculator':
lift_2d_frame_annotation_to_3d_calculator_pb2
.Lift2DFrameAnnotationTo3DCalculatorOptions,
'TfLiteTensorsToDetectionsCalculator':
tflite_tensors_to_detections_calculator_pb2
.TfLiteTensorsToDetectionsCalculatorOptions,
'NonMaxSuppressionCalculator':
non_max_suppression_calculator_pb2
.NonMaxSuppressionCalculatorOptions,
}


Expand Down
4 changes: 2 additions & 2 deletions mediapipe/python/solutions/object_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ def __init__(self, max_object_detection=3,
calculator_params={
'TfLiteTensorsToDetectionsCalculator.min_score_thresh':
min_detection_confidence,
'objectdetectioncpu__NonMaxSuppressionCalculator.min_suppression_threshold':
'NonMaxSuppressionCalculator.min_suppression_threshold':
min_suppression_threshold,
'objectdetectioncpu__NonMaxSuppressionCalculator.max_num_detections':
'NonMaxSuppressionCalculator.max_num_detections':
max_object_detection,
},
outputs=['detections'])
Expand Down

0 comments on commit 16e448c

Please sign in to comment.