无法将 YOLOv4 转换为 tflite [英] Unable to convert YOLOv4 to tflite

查看:57
本文介绍了无法将 YOLOv4 转换为 tflite的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的 android 项目中使用 yolo4,但我在转换时遇到了问题.来自:https://pypi.org/project/yolov4/ 的代码在 Google-Colab,尽管我在 Jupyter 笔记本上的 CUDA 版本存在一些问题.

I'm trying to use yolo4 in my android project but I'm having problems with conversion. The code from: https://pypi.org/project/yolov4/ has worked well on Google-Colab, though it had some problem with my CUDA version on Jupyter notebook.

我从以下位置收到转换错误:

I got conversion error from:

yolo.save_as_tflite("yolov4.tflite")

错误很长,我不确定我应该在这里粘贴哪个部分.

Error was long and I am not sure which part I should paste here.

有人可以推荐一些替代方法来转换 yolo4 的 tflite 版本(最好在 colab 上工作)?

Can someone recommend some alternative method to convert tflite version of yolo4 (preferably working on colab)?

推荐答案

如果您已经发布了错误的重要部分,那将会很有帮助.我猜您可能缺少一些依赖项/库.

If you would've posted important portion of the error, that would've been helpful. I'm guessing may be you're missing some dependencies/libraries.

无论如何要获得Yolov4tflite版本,我建议你使用这个 存储库.

Anyway to get tflite version of the Yolov4, I suggest you to use this repo.

安装依赖项:

opencv-python==4.1.1.26
lxml
tqdm
tensorflow==2.3.0rc0
absl-py
easydict
matplotlib
pillow

下载 yolov4.weights 文件:https://drive.google.com/open?id=1cewMfusmPjYWbrnuJRuKhPMwRe_b9PaT

darknet权重保存到tflite转换所需的tfmodel:

Save darknet weights to tfmodel that's needed for tflite conversion:

python save_model.py --weights ./data/yolov4.weights --output ./checkpoints/yolov4-416 --input_size 416 --model yolov4 --framework tflite

转换为 Yolov4 tflite 版本:

Convert to Yolov4 tflite version:

python convert_tflite.py --weights ./checkpoints/yolov4-416 --output ./checkpoints/yolov4-416.tflite

另外测试转换后的tflite模型:

Additionally to test the converted tflite model:

python detect.py --weights ./checkpoints/yolov4-416.tflite --size 416 --model yolov4 --image ./data/kite.jpg --framework tflite

这篇关于无法将 YOLOv4 转换为 tflite的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆