Closed abhi-84 closed 2 years ago
I followed this https://github.com/hunglc007/tensorflow-yolov4-tflite/issues/214 and it worked! I am ablr to convert ti int8 format and able able to detect my test image.
I was able to convert to int8 format smoothly using @murdockhou post but during the detection phase, I was faced a few issues! I am just listing them here with the solution with the hope it may help someone.
Take care of 3 things for successful conversion and detection:
No change in core/config.py except this line. Here you update your class file name. In my case, it is "data.names" __C.YOLO.CLASSES = "./data/classes/data.names"
After appending code in detect.py as mentioned in the post and using int8 optimized model version, it may throw an error about "decode not found". Thus in the header, include decode: "from core.yolov4 import decode"
Add --tiny flag at end of detect command: "python detect.py --weights ./checkpoints/yolov4-tiny-416-int8.tflite --size 416 --model yolov4 --image ./data/test1.jpeg --framework tflite --tiny". Use your own test image!
2. appending code in detect.py as mentioned in th
In one more situation, this error might appear during save_model.py. When one of thr options is either wrong or typo in "--" sign as "-" in the following command: _python save_model.py --weights ./data/yolov4-tiny-custom_final.weights --output ./checkpoints/yolov4-tiny --inputsize 224 --model yolov4 --tiny
@abhi-84 Hi, can you convert the yolov4-tiny with separable convolution layer in dakrnet? tks
Hi all
Is it possible to convert yolov4-tiny model to tflite? With given instruction, yolov4-tiny can be converted to TensorFlow:
_python save_model.py --weights ./data/yolov4-tiny.weights --output ./checkpoints/yolov4-tiny-416 --inputsize 416 --model yolov4 --tiny
But when I am trying to convert it to tflite using the following, it throws an error!
_python save_model.py --weights ./data/yolov4.weights --output ./checkpoints/yolov4-416 --inputsize 416 --model yolov4 --framework tflite
Error: File "save_model.py", line 49, in save_tf utils.load_weights(model, FLAGS.weights, FLAGS.model, FLAGS.tiny) File "/home/abhishek/Documents/tensorflow-yolov4-tflite-master/core/utils.py", line 63, in load_weights conv_weights = conv_weights.reshape(conv_shape).transpose([2, 3, 1, 0]) ValueError: cannot reshape array of size 379318 into shape (256,256,3,3)
I am interested to reduce the size of yolo-tiny by converting it to tflite. Is that possible?