won't work saving custom weights to saved_model.pb
See original GitHub issuetried with cpu & gpu tensorflow
python3 save_model.py --weights ./data/custom.weights --output ./checkpoints/custom-416 --input_size 416 --model yolov4
2020-11-15 10:47:19.227868: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcudart.so.10.1
2020-11-15 10:47:20.467105: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcuda.so.1
2020-11-15 10:47:21.073388: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:982] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-11-15 10:47:21.074016: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1716] Found device 0 with properties:
pciBusID: 0000:00:04.0 name: Tesla V100-SXM2-16GB computeCapability: 7.0
coreClock: 1.53GHz coreCount: 80 deviceMemorySize: 15.75GiB deviceMemoryBandwidth: 836.37GiB/s
2020-11-15 10:47:21.074059: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcudart.so.10.1
2020-11-15 10:47:21.076255: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcublas.so.10
2020-11-15 10:47:21.078071: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcufft.so.10
2020-11-15 10:47:21.078490: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcurand.so.10
2020-11-15 10:47:21.080445: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcusolver.so.10
2020-11-15 10:47:21.082111: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcusparse.so.10
2020-11-15 10:47:21.082262: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'libcudnn.so.7'; dlerror: libcudnn.so.7: cannot open shared object file: No such file or directory
2020-11-15 10:47:21.082281: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1753] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.
Skipping registering GPU devices...
2020-11-15 10:47:21.082669: 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.
2020-11-15 10:47:21.091500: I tensorflow/core/platform/profile_utils/cpu_utils.cc:104] CPU Frequency: 2300000000 Hz
2020-11-15 10:47:21.092099: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x6544520 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-11-15 10:47:21.092130: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version
2020-11-15 10:47:21.094041: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1257] Device interconnect StreamExecutor with strength 1 edge matrix:
2020-11-15 10:47:21.094074: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1263]
Traceback (most recent call last):
File "save_model.py", line 58, in <module>
app.run(main)
File "/home/ubuntu/.local/lib/python3.5/site-packages/absl/app.py", line 303, in run
_run_main(main, args)
File "/home/ubuntu/.local/lib/python3.5/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/ubuntu/yolov4-custom-functions/core/utils.py", line 143, in load_weights
conv_weights = conv_weights.reshape(conv_shape).transpose([2, 3, 1, 0])
ValueError: cannot reshape array of size 4554552 into shape (1024,512,3,3)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:12
Top Results From Across the Web
Save and load Keras models | TensorFlow Core
When saving the model and its layers, the SavedModel format stores the class name, call function, losses, and weights (and the config, if ......
Read more >`tf.keras.Model.save` does not support subclassed ... - GitHub
Model.save does not support subclassed model when saving model as SavedModel ... Unable to load custom model when using tf.keras.callbacks.
Read more >Unable to load a Keras saved model (Error: unable to open file)
The weights are saved in the variables/ directory. For loading model then, reconstructed_model = keras.models.load_model("my_model"). OR,
Read more >Model saving & serialization APIs - Keras
Note that the model weights may have different scoped names after being loaded. ... The traced functions allow the SavedModel format to save...
Read more >How to Save and Load Your Keras Deep Learning Model
Model weights are saved to an HDF5 format. This grid format is ideal for storing multi-dimensional arrays of numbers.
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
Hi! Try to change line 14 of
./core/config.py
file to custom.names before runningsave_model.py
.Thank you very much! @jmudy