Closed michalkowalski94 closed 5 years ago
Can you specify which model are you using (tiny or full YOLO)? For example, in the CI we have a sample model training and using wich passes, see section Sample training
It's tiny yolo During debuging that problem above, another has occured while i have tried to load a full model in hdf5:
File "D:\Publikacja\repaired_yolo\yolo3\yolo.py", line 118, in _create_model
self.yolo_model = load_model(self.weights_path, compile=False)
File "C:\Users\micha\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras\saving\save.py", line 146, in load_model
return hdf5_format.load_model_from_hdf5(filepath, custom_objects, compile)
File "C:\Users\micha\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras\saving\hdf5_format.py", line 212, in load_model_from_hdf5
custom_objects=custom_objects)
File "C:\Users\micha\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras\saving\model_config.py", line 55, in model_from_config
return deserialize(config, custom_objects=custom_objects)
File "C:\Users\micha\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras\layers\serialization.py", line 89, in deserialize
printable_module_name='layer')
File "C:\Users\micha\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras\utils\generic_utils.py", line 192, in deserialize_keras_object
list(custom_objects.items())))
File "C:\Users\micha\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras\engine\network.py", line 1131, in from_config
process_node(layer, node_data)
File "C:\Users\micha\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras\engine\network.py", line 1089, in process_node
layer(input_tensors, **kwargs)
File "C:\Users\micha\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras\engine\base_layer.py", line 634, in __call__
outputs = call_fn(inputs, *args, **kwargs)
File "C:\Users\micha\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras\layers\core.py", line 785, in call
return self.function(inputs, **arguments)
File "D:/Publikacja/repaired_yolo/yolo3/model.py", line 343, in yolo_loss
anchors[anchor_mask[l]],
File "C:\Users\micha\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\training\tracking\data_structures.py", line 356, in __getitem__
return self._storage[key]
TypeError: list indices must be integers or slices, not list
Traceback (most recent call last):
File "D:\Publikacja\repaired_yolo\yolo3\yolo.py", line 118, in _create_model
self.yolo_model = load_model(self.weights_path, compile=False)
File "C:\Users\micha\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras\saving\save.py", line 146, in load_model
return hdf5_format.load_model_from_hdf5(filepath, custom_objects, compile)
File "C:\Users\micha\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras\saving\hdf5_format.py", line 212, in load_model_from_hdf5
custom_objects=custom_objects)
File "C:\Users\micha\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras\saving\model_config.py", line 55, in model_from_config
return deserialize(config, custom_objects=custom_objects)
File "C:\Users\micha\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras\layers\serialization.py", line 89, in deserialize
printable_module_name='layer')
File "C:\Users\micha\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras\utils\generic_utils.py", line 192, in deserialize_keras_object
list(custom_objects.items())))
File "C:\Users\micha\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras\engine\network.py", line 1131, in from_config
process_node(layer, node_data)
File "C:\Users\micha\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras\engine\network.py", line 1089, in process_node
layer(input_tensors, **kwargs)
File "C:\Users\micha\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras\engine\base_layer.py", line 634, in __call__
outputs = call_fn(inputs, *args, **kwargs)
File "C:\Users\micha\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras\layers\core.py", line 785, in call
return self.function(inputs, **arguments)
File "D:/Publikacja/repaired_yolo/yolo3/model.py", line 343, in yolo_loss
anchors[anchor_mask[l]],
File "C:\Users\micha\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\training\tracking\data_structures.py", line 356, in __getitem__
return self._storage[key]
TypeError: list indices must be integers or slices, not list
could you please replicate following set of commands from automatic testing... this should pass: https://github.com/Borda/keras-yolo3/blob/master/circle.yml#L49-L63
Yup, everything works fine with voc on tensorflow 1.6, 1.13.1, 1.14, 2.0.0rc Problem occurs with my dataset Grayscale images with shape (1632,1088,1) Cannot load model from: yaml, json, hdf5 (incompatible shapes, channel first, etc)
EDIT: Yes i changed number of channels in model input shape
We have been facing something similar in #2 but I haven't played with gray scale images yer.... Please try to replicate your gray image to have 3 equal channels to verify that the problem really lies in the MxNx1 or just MxN But just thinking about it the body assumes only rgb images so the optional chnage has to be somewhere deeper :)
Well to be honest, i have never seen anything like this ever before. Layers in which dimensions are not compatilbe doesn't exist at all Problem lies in tensorflow.keras model.load_weights
Model: "model_1"
________________________________________________________________________________________________________________________
Layer (type) Output Shape Param # Connected to
========================================================================================================================
input_1 (InputLayer) [(None, 1632, 1088, 1)] 0
________________________________________________________________________________________________________________________
conv2d (Conv2D) (None, 1632, 1088, 16) 144 input_1[0][0]
________________________________________________________________________________________________________________________
batch_normalization (BatchNormalizatio (None, 1632, 1088, 16) 64 conv2d[0][0]
________________________________________________________________________________________________________________________
leaky_re_lu (LeakyReLU) (None, 1632, 1088, 16) 0 batch_normalization[0][0]
________________________________________________________________________________________________________________________
max_pooling2d (MaxPooling2D) (None, 816, 544, 16) 0 leaky_re_lu[0][0]
________________________________________________________________________________________________________________________
conv2d_1 (Conv2D) (None, 816, 544, 32) 4608 max_pooling2d[0][0]
________________________________________________________________________________________________________________________
batch_normalization_1 (BatchNormalizat (None, 816, 544, 32) 128 conv2d_1[0][0]
________________________________________________________________________________________________________________________
leaky_re_lu_1 (LeakyReLU) (None, 816, 544, 32) 0 batch_normalization_1[0][0]
________________________________________________________________________________________________________________________
max_pooling2d_1 (MaxPooling2D) (None, 408, 272, 32) 0 leaky_re_lu_1[0][0]
________________________________________________________________________________________________________________________
conv2d_2 (Conv2D) (None, 408, 272, 64) 18432 max_pooling2d_1[0][0]
________________________________________________________________________________________________________________________
batch_normalization_2 (BatchNormalizat (None, 408, 272, 64) 256 conv2d_2[0][0]
________________________________________________________________________________________________________________________
leaky_re_lu_2 (LeakyReLU) (None, 408, 272, 64) 0 batch_normalization_2[0][0]
________________________________________________________________________________________________________________________
max_pooling2d_2 (MaxPooling2D) (None, 204, 136, 64) 0 leaky_re_lu_2[0][0]
________________________________________________________________________________________________________________________
conv2d_3 (Conv2D) (None, 204, 136, 128) 73728 max_pooling2d_2[0][0]
________________________________________________________________________________________________________________________
batch_normalization_3 (BatchNormalizat (None, 204, 136, 128) 512 conv2d_3[0][0]
________________________________________________________________________________________________________________________
leaky_re_lu_3 (LeakyReLU) (None, 204, 136, 128) 0 batch_normalization_3[0][0]
________________________________________________________________________________________________________________________
max_pooling2d_3 (MaxPooling2D) (None, 102, 68, 128) 0 leaky_re_lu_3[0][0]
________________________________________________________________________________________________________________________
conv2d_4 (Conv2D) (None, 102, 68, 256) 294912 max_pooling2d_3[0][0]
________________________________________________________________________________________________________________________
batch_normalization_4 (BatchNormalizat (None, 102, 68, 256) 1024 conv2d_4[0][0]
________________________________________________________________________________________________________________________
leaky_re_lu_4 (LeakyReLU) (None, 102, 68, 256) 0 batch_normalization_4[0][0]
________________________________________________________________________________________________________________________
max_pooling2d_4 (MaxPooling2D) (None, 51, 34, 256) 0 leaky_re_lu_4[0][0]
________________________________________________________________________________________________________________________
conv2d_5 (Conv2D) (None, 51, 34, 512) 1179648 max_pooling2d_4[0][0]
________________________________________________________________________________________________________________________
batch_normalization_5 (BatchNormalizat (None, 51, 34, 512) 2048 conv2d_5[0][0]
________________________________________________________________________________________________________________________
leaky_re_lu_5 (LeakyReLU) (None, 51, 34, 512) 0 batch_normalization_5[0][0]
________________________________________________________________________________________________________________________
max_pooling2d_5 (MaxPooling2D) (None, 51, 34, 512) 0 leaky_re_lu_5[0][0]
________________________________________________________________________________________________________________________
conv2d_6 (Conv2D) (None, 51, 34, 1024) 4718592 max_pooling2d_5[0][0]
________________________________________________________________________________________________________________________
batch_normalization_6 (BatchNormalizat (None, 51, 34, 1024) 4096 conv2d_6[0][0]
________________________________________________________________________________________________________________________
leaky_re_lu_6 (LeakyReLU) (None, 51, 34, 1024) 0 batch_normalization_6[0][0]
________________________________________________________________________________________________________________________
conv2d_7 (Conv2D) (None, 51, 34, 256) 262144 leaky_re_lu_6[0][0]
________________________________________________________________________________________________________________________
batch_normalization_7 (BatchNormalizat (None, 51, 34, 256) 1024 conv2d_7[0][0]
________________________________________________________________________________________________________________________
leaky_re_lu_7 (LeakyReLU) (None, 51, 34, 256) 0 batch_normalization_7[0][0]
________________________________________________________________________________________________________________________
conv2d_10 (Conv2D) (None, 51, 34, 128) 32768 leaky_re_lu_7[0][0]
________________________________________________________________________________________________________________________
batch_normalization_9 (BatchNormalizat (None, 51, 34, 128) 512 conv2d_10[0][0]
________________________________________________________________________________________________________________________
leaky_re_lu_9 (LeakyReLU) (None, 51, 34, 128) 0 batch_normalization_9[0][0]
________________________________________________________________________________________________________________________
up_sampling2d (UpSampling2D) (None, 102, 68, 128) 0 leaky_re_lu_9[0][0]
________________________________________________________________________________________________________________________
concatenate (Concatenate) (None, 102, 68, 384) 0 up_sampling2d[0][0]
leaky_re_lu_4[0][0]
________________________________________________________________________________________________________________________
conv2d_8 (Conv2D) (None, 51, 34, 512) 1179648 leaky_re_lu_7[0][0]
________________________________________________________________________________________________________________________
conv2d_11 (Conv2D) (None, 102, 68, 256) 884736 concatenate[0][0]
________________________________________________________________________________________________________________________
batch_normalization_8 (BatchNormalizat (None, 51, 34, 512) 2048 conv2d_8[0][0]
________________________________________________________________________________________________________________________
batch_normalization_10 (BatchNormaliza (None, 102, 68, 256) 1024 conv2d_11[0][0]
________________________________________________________________________________________________________________________
leaky_re_lu_8 (LeakyReLU) (None, 51, 34, 512) 0 batch_normalization_8[0][0]
________________________________________________________________________________________________________________________
leaky_re_lu_10 (LeakyReLU) (None, 102, 68, 256) 0 batch_normalization_10[0][0]
________________________________________________________________________________________________________________________
conv2d_9 (Conv2D) (None, 51, 34, 24) 12312 leaky_re_lu_8[0][0]
________________________________________________________________________________________________________________________
conv2d_12 (Conv2D) (None, 102, 68, 24) 6168 leaky_re_lu_10[0][0]
________________________________________________________________________________________________________________________
input_2 (InputLayer) [(None, 51, 34, 3, 8)] 0
________________________________________________________________________________________________________________________
input_3 (InputLayer) [(None, 102, 68, 3, 8)] 0
________________________________________________________________________________________________________________________
yolo_loss (Lambda) (1,) 0 conv2d_9[0][0]
conv2d_12[0][0]
input_2[0][0]
input_3[0][0]
========================================================================================================================
Total params: 8,680,576
Trainable params: 8,674,208
Non-trainable params: 6,368
________________________________________________________________________________________________________________________
Traceback (most recent call last):
File "detection.py", line 175, in <module>
_main(**arg_params)
File "detection.py", line 157, in _main
nb_gpu=nb_gpu)
File "D:\Publikacja\repaired_yolo\yolo3\yolo.py", line 90, in __init__
self.boxes, self.scores, self.classes = self._create_model()
File "D:\Publikacja\repaired_yolo\yolo3\yolo.py", line 128, in _create_model
model.load_weights("best.h5")
File "C:\Users\micha\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras\engine\training.py", line 162, in load_weights
return super(Model, self).load_weights(filepath, by_name)
File "C:\Users\micha\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras\engine\network.py", line 1424, in load_weights
saving.load_weights_from_hdf5_group(f, self.layers)
File "C:\Users\micha\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras\saving\hdf5_format.py", line 759, in load_weights_from_hdf5_group
K.batch_set_value(weight_value_tuples)
File "C:\Users\micha\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras\backend.py", line 3066, in batch_set_value
assign_op = x.assign(assign_placeholder)
File "C:\Users\micha\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\ops\resource_variable_ops.py", line 1141, in assign
self._shape.assert_is_compatible_with(value_tensor.shape)
File "C:\Users\micha\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\tensor_shape.py", line 1103, in assert_is_compatible_with
raise ValueError("Shapes %s and %s are incompatible" % (self, other))
ValueError: Shapes (1, 1, 512, 24) and (21, 512, 1, 1) are incompatible
[UNSOLVED BUT READY TO CLOSE] Somehow stacking those grayscale images into (1632,1088,3) and retraining the model for input of shape (None,None,3) helped.
It should be fine now, pls, feel free to and any other issue you find... or reopen this one :)
After performing a training for images with shape (1632,1088) i thought there is now time for detection. Unfortunately while loading weights into model with same input parameters as training model an error has arisen:
Disclaimer - I'm not using theano