4

I've been trying to get this working on an android device for a while now, but I can't get the model to make any detections.

I'm using the sample code that google provides for object detection: https://github.com/tensorflow/examples/tree/master/lite/examples/object_detection/android and trying to get it to run with a pre-trained model for mobilenet v3, specifically the .tflite file in "ssd_mobilenet_v3_large_coco", downloaded from here: https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/detection_model_zoo.md

Whenever I run the model, it always returns confidence scores for every category no greater than 10^-15, i.e., far too low to constitute a detection. The code was working fine with the old mobilenet v1 model, and since this model is the only thing I'm changing I suspect that I must be using the new model wrong.

I'm wondering if anyone has been able to successfully use this new model for object detection, and if so how they did it. This is the way I'm trying to do it now:

1.) Taking the aforementioned sample code provided by google, I've replaced the model they use with the .tflite file with the mobilenet v3 .tflite model. (and changing the build.gradle file accordingly)

2.) I've set TF_OD_API_INPUT_SIZE = 320 (in DetectorActivity.java)

3.) I've set NUM_DETECTIONS = 2034 (in TFLiteObjectDetectionAPIModel.java)

4.) I've used 2 float arrays for the detection output, one for detection confidences of shape [1][NUM_DETECTIONS][91] and the other for boxes of shape [1][NUM_DETECTIONS][1][4]

Those are essentailly the only changes I've made. Cheers for any suggestions.

Sam Jakes
  • 121
  • 1
  • 5

0 Answers0