Closed MicheleMarabelli closed 4 years ago
Realized later that i changed the model to make it work for my machine and the packets i had installed (several libraries references should be updated to make it compatible with current versions), and i was trying to load the model with the unmodified file (only modified it on the training machine)
I'm sorry for the disturb, please delete this issue
Trained the network with my dataset. it works and everythig for the training, but once i put the generative models in generate_images/models, comment the training and start the generation it encounters an error reading the model:
*will point out that the line in module.py is 1000+ because to make the model work i had to port the whole function "toimage" not easily accessible in current libraries anymore
Are you sure you want to generate synthetic images instead of training? (y/n): y
Traceback (most recent call last): File "model.py", line 1123, in
GAN = CycleGAN()
File "model.py", line 433, in init
self.load_model_and_generate_synthetic_images()
File "model.py", line 1030, in load_model_and_generate_synthetic_images
self.load_model_and_weights(self.G_A2B)
File "model.py", line 1025, in load_model_and_weights
model.load_weights(path_to_weights)
File ".../environment1/lib/python3.6/site-packages/keras/engine/saving.py", line 492, in load_wrapper
return load_function(*args, **kwargs)
File ".../environment1/lib/python3.6/site-packages/keras/engine/network.py", line 1230, in load_weights
f, self.layers, reshape=reshape)
File ".../environment1/lib/python3.6/site-packages/keras/engine/saving.py", line 1234, in load_weights_from_hdf5_group
K.batch_set_value(weight_value_tuples)
File ".../environment1/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py", line 2960, in batch_set_value
tf_keras_backend.batch_set_value(tuples)
File ".../environment1/lib/python3.6/site-packages/tensorflow/python/keras/backend.py", line 2875, in batch_set_value
assign_op = x.assign(assign_placeholder)
File ".../environment1/lib/python3.6/site-packages/tensorflow/python/ops/resource_variable_ops.py", line 915, in assign
self._shape.assert_is_compatible_with(value_tensor.shape)
File ".../environment1/lib/python3.6/site-packages/tensorflow/python/framework/tensor_shape.py", line 1023, in assert_is_compatible_with
raise ValueError("Shapes %s and %s are incompatible" % (self, other))
ValueError: Shapes (7, 7, 1, 32) and (32, 3, 7, 7) are incompatible
Meanwhile i'll try to figure it out too of course
*** Also: all the training seems to be working fine, and generating images without any particular problem. the problem is probably only in the reading of the weights
Also, i'm using keras_2.3 and tensorflow_1.13.1 because of limitations of the machine i am running it on which i am not permitted to edit.