问题
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.
Can someone recommend some alternative method to convert tflite
version of yolo4 (preferably working on colab
)?
回答1:
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.
Anyway to get tflite
version of the Yolov4
, I suggest you to use this repo.
Install Dependencies:
opencv-python==4.1.1.26
lxml
tqdm
tensorflow==2.3.0rc0
absl-py
easydict
matplotlib
pillow
Download yolov4.weights file: https://drive.google.com/open?id=1cewMfusmPjYWbrnuJRuKhPMwRe_b9PaT
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
Convert to Yolov4 tflite
version:
python convert_tflite.py --weights ./checkpoints/yolov4-416 --output ./checkpoints/yolov4-416.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
来源:https://stackoverflow.com/questions/62968981/unable-to-convert-yolov4-to-tflite