mediapipe
mediapipe copied to clipboard
Run Model Maker Object Detection TFLite model inference directly
I've trained a model in mediapipe model maker.
I want to run inference through tensorflow directly, on python, so I can use a Coral Edge TPU. Since it's a TFLite Model this should be possible.
But I'm struggling to get proper outputs.
For input, I resize to 256x256. I've tried normalisation in [0,255], [0,1] and [-1,1].
Running the signature function returns a dictionary of {detection_boxes, detection_scores}
Where shape(detection_boxes) = (1, num_boxes, 4)
and shape(detection_scores) = (1, num_boxes, num_classes)
However, the values I'm getting for detection_boxes are unnormalised and frequently negative. I've tried searching the repo for how decoding is done, and expected pre-processing on input, but its hard to traverse this repo.
Is there a minimal example of how to perform inference directly, and decode model output?
Failing that, what model input is expected and what format are the output detection_boxes
and detection_score
?
(Code: https://gist.github.com/DoctorDinosaur/be495b6065fff29f79ec11306dd89c3b)