tensorflow-yolov4-tflite icon indicating copy to clipboard operation
tensorflow-yolov4-tflite copied to clipboard

Error in conversing custom weights of yolov4

Open Akash3194 opened this issue 3 years ago • 5 comments

I am getting error like below while using my own yolov4 weights model, i have already replace .names file with my own in core config file. In my model i have just 1 class. The error i am getting is below.

A service 0x3cf2520 initialized for platform Host (this does not guarantee that XLA will be used). Devices: 2021-06-10 15:18:21.048305: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version Traceback (most recent call last): File "save_model.py", line 58, in app.run(main) File "/home/aakash_tyagi/PycharmProjects/tensorflow-yolov4-tflite/venv/lib/python3.6/site-packages/absl/app.py", line 303, in run _run_main(main, args) File "/home/aakash_tyagi/PycharmProjects/tensorflow-yolov4-tflite/venv/lib/python3.6/site-packages/absl/app.py", line 251, in _run_main sys.exit(main(argv)) File "save_model.py", line 54, in main save_tf() File "save_model.py", line 49, in save_tf utils.load_weights(model, FLAGS.weights, FLAGS.model, FLAGS.tiny) File "/home/aakash_tyagi/PycharmProjects/tensorflow-yolov4-tflite/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 4457630 into shape (1024,512,3,3)

Akash3194 avatar Jun 10 '21 10:06 Akash3194

Hi. Any solution to this issue? I got the same error

faizmisman avatar Jul 05 '21 01:07 faizmisman

Even I m facing the same error. Please let me know if you come across with an answer

hemanthganeshkuricheti avatar Jul 16 '21 15:07 hemanthganeshkuricheti

I've facing same problem, but already solved by change the value of __C.YOLO.CLASSES with custom classes path in core/config.py

sutejoramadhan avatar Jul 16 '21 20:07 sutejoramadhan

@sutejoramadhan Hello. I have changed the config.py file with appropriate classes path and anchors but still doesn't work after successful conversion into tflite format. Any suggestions?

khg2478 avatar Aug 11 '21 12:08 khg2478

I fix this issue by checking file obj.names. There was empty line in the bottom of file. It was enterpreted as +1 class. Thats it.

haimin777 avatar Nov 23 '21 10:11 haimin777