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.24k stars 1.24k forks source link

转换通过darknet框架训练自有数据集后的.weights文件,出现错误 #46

Open Eve66666 opened 4 years ago

Eve66666 commented 4 years ago

你好,通过指令:python convert_tflite.py --weights ./data/yolov4.weights --output ./data/yolov4-fp16.tflite --quantize_mode float16 我想把一个在darknet框架下训练得到的.weights权重文件转为tflite文件,但是出现了如下问题: ValueError: cannot reshape array of size 4559937 into shape (1024,512,3,3) 具体报错内容如下

Traceback (most recent call last):
  File "convert_tflite.py", line 109, in <module>
    app.run(main)
  File "E:\anaconda\envs\python-train\lib\site-packages\absl\app.py", line 299, in run
    _run_main(main, args)
  File "E:\anaconda\envs\python-train\lib\site-packages\absl\app.py", line 250, in _run_main
    sys.exit(main(argv))
  File "convert_tflite.py", line 104, in main
    save_tflite()
  File "convert_tflite.py", line 59, in save_tflite
    utils.load_weights(model, FLAGS.weights)
  File "E:\11yolov4\tensorflow-yolov4-tflite\tensorflow-yolov4-tflite-master\core\utils.py", line 114, in load_weights
    conv_weights = conv_weights.reshape(conv_shape).transpose([2, 3, 1, 0])
ValueError: cannot reshape array of size 4559937 into shape (1024,512,3,3)

请问如何可以解决这个问题?

tosonw commented 4 years ago

同问,我用AlexeyAB的darknet训练的.weights文件转的时候也遇到了这个问题

inSight-mk1 commented 4 years ago

Refer to https://github.com/hunglc007/tensorflow-yolov4-tflite/issues/126

zhubinsheng commented 3 years ago

解决了吗

KuoEuran commented 3 years ago

how to slove it?

KuoEuran commented 3 years ago

解决了吗

did you solve it?