本文是之前项目的说明,用以替换定制化模型
前文:YOLOv5_Android_USBCamera:支持USB摄像头的YOLOv5Android图像识别项目
模型转换过程
根据原项目的描述 https://github.com/lp6m/yolov5s_android ,这个项目使用的模型是通过从PyTorch原始实现的模型转换获得一个TFlite模型,而不是在TFlite中自己实现。
官方的模型定制化说明(必读):https://github.com/lp6m/yolov5s_android/issues/14
总体的转换过程为PyTorch -> ONNX -> OpenVino -> TFLite
步骤
- PyTorch (.pt 文件)
- 用实验室已有的YOLO项目源码可以得到模型权重文件
- ONNX (.onnx文件)
- 简介:https://blog.csdn.net/gaoxueyi551/article/details/117331600
- 转换:https://blog.csdn.net/weixin_38989668/article/details/123840882
- OpenVino
- 简介:https://zhuanlan.zhihu.com/p/91882515
- 代码过程:利用 OpenVino 推理
- TFLite
- 将 OpenVino 模型转换为 TFLite,作者使用的工具:
https://github.com/PINTO0309/openvino2tensorflow - 参考文档:
https://github.com/lp6m/yolov5s_android/tree/master/convert_model
- 将 OpenVino 模型转换为 TFLite,作者使用的工具: