Error information:
Traceback (most recent call last):
File "bs.py", line 149, in <module>
tcpserver1=MYTCPServer(('192.168.0.109',54321))
File "wserver_bs.py", line 65, in __init__
self.model.load_weights(weight_filepath)
File "/home/ps/anaconda3/envs/anomaly/lib/python3.6/site-packages/tensorflow/python/keras/engine/training.py", line 162, in load_weights
return super(Model, self).load_weights(filepath, by_name)
File "/home/ps/anaconda3/envs/anomaly/lib/python3.6/site-packages/tensorflow/python/keras/engine/network.py", line 1424, in load_weights
saving.load_weights_from_hdf5_group(f, self.layers)
File "/home/ps/anaconda3/envs/anomaly/lib/python3.6/site-packages/tensorflow/python/keras/saving/hdf5_format.py", line 749, in load_weights_from_hdf5_group
layer, weight_values, original_keras_version, original_backend)
File "/home/ps/anaconda3/envs/anomaly/lib/python3.6/site-packages/tensorflow/python/keras/saving/hdf5_format.py", line 456, in preprocess_weights_for_loading
weights[0] = np.transpose(weights[0], (3, 2, 0, 1))
File "<__array_function__ internals>", line 6, in transpose
File "/home/ps/anaconda3/envs/anomaly/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 653, in transpose
return _wrapfunc(a, 'transpose', axes)
File "/home/ps/anaconda3/envs/anomaly/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 58, in _wrapfunc
return bound(*args, **kwds)
ValueError: axes don't match array
Tossed half a night, the Internet to check a variety of methods are useless
the fault lies in load_ On the weights function, it’s a matter of setting the model!
When loading the model, the default input size is used
model = cnn.CNNLikeModel()
The actual size of the input tensor is different from the default size, which leads to this error.
solve
1. Modify the default value of the function
2. Fill in the correct value when using this function.
Read More:
- [Solved] Tensorflow error or keras error and tf.keras error: oom video memory is insufficient
- [Solved] ERROR: You don‘t have the SNMP perl module installed.
- TensorFlow tf.keras.losses .MeanSquaredError
- [Solved] MindSpore Error: ValueError: Minimum inputs size 0 does not match…
- Tensorflow C++:You must define TF_LIB_GTL_ALIGNED_CHAR_ARRAY for your compiler
- Keras-nightly Import package Error: cannot import name ‘Adam‘ from ‘keras.optimizers‘
- No match for ‘operator =’ both ends of the equal sign do not match
- [Solved] Tensorflow-gpu 2.0.0 Run Error: ModuleNotFoundError: No module named ‘tensorflow_core.estimator‘
- TensorFlow error: AttributeError: module ‘tensorflow_core._api.v2.train’ has no attribute ‘Optimizer‘
- Tensorflow error: attributeerror: module ‘tensorflow_ API. V1. Train ‘has no attribute’ summarywriter ‘
- [Solved] AttributeError: module ‘keras.preprocessing.image‘ has no attribute ‘load_img‘
- [Solved] Tensorflow Error: Failed to load the native TensorFlow runtime.
- How to Solve Keras calls plot_model error
- [Solved] Tensorflow Error: failed to create cublas handle: CUBLAS_STATUS_ALLOC_FAILED
- [Solved] Python2 Install tensorflow Error: class DescriptorBase(metaclass=DescriptorMetaclass), SyntaxError: invalid syntax
- [Solved] MindSpore Error: ValueError: For ‘AvgPool’ every dimension of the output shape must be greater than zero
- [ubuntu14.04]Tensorflow: Could not find any downloads that satisfy the requirement
- [Solved] MindSpore Error: ValueError: `padding_idx` in `Embedding` out of range
- [Solved] TensorFlow severing Container Creat Error: failed: Out of range: Read less bytes than requested
- Installation and error report of tensorflow