Reshape error when running save_model.py
See original GitHub issueTraceback (most recent call last):
File "save_model.py", line 55, in <module>
app.run(main)
File "/home/ubuntu/.virtualenvs/tyt/lib/python3.6/site-packages/absl/app.py", line 299, in run
_run_main(main, args)
File "/home/ubuntu/.virtualenvs/tyt/lib/python3.6/site-packages/absl/app.py", line 250, in _run_main
sys.exit(main(argv))
File "save_model.py", line 51, in main
save_tf()
File "save_model.py", line 41, in save_tf
utils.load_weights(model, FLAGS.weights)
File "/home/ubuntu/tyt/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 4619172 into shape (1024,512,3,3)
I am experiencing this issue when attempting to convert a Yolov4 model trained on custom classes to tf using save_model
Yolov3 works fine, however the Yolov4 model is more accurate.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6
Top Results From Across the Web
How can I solve reshape ValueError when convert yolov4 ...
Basically, you are cloning the root repo to run this file while having the paths in core/config.py unchanged.
Read more >ValueError: cannot reshape array of size 2048 into shape (18 ...
Hi, I am trying to convert my custom YOLOv4 weights to TF using below command- python save_model.py --weights ./data/yolo-obj_best.weights ...
Read more >tf.reshape | TensorFlow v2.11.0
Using -1 to infer the shape -- # Here -1 is inferred to be 9: tf.reshape(t, [2, -1]) <tf.Tensor: shape=(2, 9), dtype=int32, numpy=...
Read more >(optional) Exporting a Model from PyTorch to ONNX and ...
In this tutorial, we describe how to convert a model defined in PyTorch into the ONNX format and then run it with ONNX...
Read more >How to Save and Load Your Keras Deep Learning Model
Keras is a simple and powerful Python library for deep learning. ... How to save model weights and model architecture in separate files ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@ejri You need to go to
and change the classes according to your model for example: if you have only two classes
and the other way is to change the line to your classes.names
Thx!!! so much! I owe u one!