Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: cannot reshape array of size 92951 into shape (256,128,3,3) #467

Open
jjeongmin0308 opened this issue Sep 17, 2022 · 2 comments

Comments

@jjeongmin0308
Copy link

!python save_model.py --weights /content/tensorflow-yolov4-tflite/data/yolov4-custom_last.weights --output ./checkpoints/custom-416 --input_size 416 --model yolov4 --framework tflite
2022-09-17 18:04:49.809104: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcudart.so.10.1
2022-09-17 18:04:51.493961: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcuda.so.1
2022-09-17 18:04:51.503223: E tensorflow/stream_executor/cuda/cuda_driver.cc:314] failed call to cuInit: CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected
2022-09-17 18:04:51.503344: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:156] kernel driver does not appear to be running on this host (79cfa2660112): /proc/driver/nvidia/version does not exist
2022-09-17 18:04:51.504271: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN)to use the following CPU instructions in performance-critical operations: AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2022-09-17 18:04:51.512390: I tensorflow/core/platform/profile_utils/cpu_utils.cc:104] CPU Frequency: 2199995000 Hz
2022-09-17 18:04:51.512654: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x20e8f40 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2022-09-17 18:04:51.512699: 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 "/usr/local/lib/python3.7/dist-packages/absl/app.py", line 308, in run
_run_main(main, args)
File "/usr/local/lib/python3.7/dist-packages/absl/app.py", line 254, 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 "/content/tensorflow-yolov4-tflite/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 92951 into shape (256,128,3,3)

I made the following efforts to correct this error.

#396 (comment)

#396 (comment)

However, the error has not been corrected.

I also checked that there is no empty line at the bottom of the file.

@reno41317
Copy link

I use these code to replace that one,and it worked.
However the weight didn't work as I thought. There is no boundingbox in the ouput of image.
I don't know how is going on.
Hope to help you.

    conv_weights = np.ones(np.product(conv_shape))
    conv_weights = conv_weights.reshape(conv_shape)
    conv_weights = np.transpose(conv_weights, (2, 3, 1, 0))
    #conv_weights = conv_shape.reshape(conv_shape).transpose([2, 3, 1, 0])

@t109598032
Copy link

change core/config.py line 14: __C.YOLO.CLASSES = to path of your custom obj.names

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants