hunglc007 / tensorflow-yolov4-tflite

YOLOv4, YOLOv4-tiny, YOLOv3, YOLOv3-tiny Implemented in Tensorflow 2.0, Android. Convert YOLO v4 .weights tensorflow, tensorrt and tflite
https://github.com/hunglc007/tensorflow-yolov4-tflite
MIT License
2.23k stars 1.24k forks source link

ValueError: cannot reshape array of size 588196 into shape (512,256,3,3) #355

Open KuoEuran opened 3 years ago

KuoEuran commented 3 years ago

I want to convert my darknet weights to tensorflow. when I use the command : python save_model.py --weights ./data/yolov4-tier_last.weights --output ./checkpoints/yolov4-320 --input_size 320 --model yolov4 And I get the error image And I have changed the input size of picture to 320 in convert_tflite.py. But it still shows that shape 512x256x3x3. And I have changed the coco.names to one class(person) according to some solutions but it doesn't work. image Isn't there anything I miss, please let me know

chun-ming-Lin commented 3 years ago

到core資料夾 -> config.py -> __C.YOLO.CLASSES 換成你的obj.names

immuhammadadil commented 2 years ago

This type of shape error occurs when you try to convert the yolov4 version other than the default i.e. on the AlexAB repository. It causes a mismatch in weights and the TensorFlow model written in this repo. So try to custom train (or use the default) weights according to AlexAB repository... Don't modify the model or you have to make the same modifications in the TensorFlow model in this repository....

Abhishek672 commented 2 years ago

@immuhammadadil any idea of how to convert a darknet model to tflite after we change its structure, using this repository. Is it possible? I have the new .weights and .cfg file Thanks

KuoEuran commented 2 years ago

@immuhammadadil Hi, Did you have any idea about the issue :https://github.com/hunglc007/tensorflow-yolov4-tflite/issues/422? I have stuck by conversion of separable depthwise convoution. If you have any ideas, please give me some advice, tks.