This project is a demo of Mobilenet-SSD TFLite model for object detection.
Mobilenet-SSD的模型推理部分与之前YOLO-X的不同,需要注意的是:
- Mobilenet-SSD的输出的shape为
[1, 15]
,由两个tensor组成,分别是detection_boxes
和detection_classes
,其中detection_boxes
的shape为[1, 4]
,detection_classes
的shape为[1, 11]
,其中,4表示每个目标的坐标信息,即[xmin, ymin, xmax, ymax]
,11表示类别(最后一个是背景)。 - 在
predict.py
文件中指出,28行以下内容根据实际需要进行翻写修改。里面涉及到了BBox的处理(与YOLO-X不同),AnchorBox
和BBoxUtility
两个类的作用是将模型输出的detection_boxes
转换为真实的坐标信息,具体的转换过程可以参考BBoxUtility
类中的decode_box
函数。 - 其他文件无需翻写修改。
另外,convert2tflite.py
文件提供了将模型转换为TFLite模型的两种方法,可以参考。