google-coral / tflite

Examples using TensorFlow Lite API to run inference on Coral devices
https://coral.withgoogle.com
Apache License 2.0
182 stars 67 forks source link

Coral Detection with mobilenetv2-ssd error #28

Closed TingRui608470158 closed 4 years ago

TingRui608470158 commented 4 years ago

I pretrain a model with 2 classes ,but when I run detect_image.py . ----INFERENCE TIME---- Note: The first inference is slow because it includes loading the model into Edge TPU memory. Traceback (most recent call last): File "detect_image.py", line 129, in <module> main() File "detect_image.py", line 108, in main objs = detect.get_output(interpreter, args.threshold, scale) File "/home/ray/coral/tflite/python/examples/detection/detect.py", line 145, in get_output class_ids = output_tensor(interpreter, 1) File "/home/ray/coral/tflite/python/examples/detection/detect.py", line 138, in output_tensor tensor = interpreter.tensor(interpreter.get_output_details()[i]['index'])() IndexError: list index out of range

Namburger commented 4 years ago

@Ray608470158 sorry but this is not enough info to work with, how did you train the model, what architecture and can you submit the model? The detect image script assumes that the model has post processing ops

TingRui608470158 commented 4 years ago

I use the mobilenetv2 with colab While I finish training, it can be use for classification And then I try to use with ssd But can't use in object detection

Namburger commented 4 years ago

Could you clarify which colab? A classification model doesn't have the same outputs was a detection model, you shouldn't expect the same model to works with both demo

TingRui608470158 commented 4 years ago

this one 'retrain_classification_ptq_tf1' Oh, Where is mobilenetv2-ssd link with colab I didn't find that

Namburger commented 4 years ago

@Ray608470158 Classification only outputs confidence score, nothing else. The ssd-mobilenet object detection has 4 outputs outputs, please carefully review the doc for more info. https://www.tensorflow.org/lite/models/object_detection/overview

This demo is trying to find that ouputs in your classification which does not exist. You can follow this for a object detection retrain tutorial, although right now it is only available in docker: https://github.com/google-coral/tutorials/blob/master/retrain_detection_qat_tf1.ipynb