ValueError: Input dimension mis-match. (input[0].shape[1] = 7, input[1].shape[1] = 64)
Creating model...
C:\Users\shiri\Documents\keras-transfer-learning-for-oxford102-master\models\resnet50.py:33: UserWarning: Update your `Model` call to the Keras 2 API: `Model(outputs=Softmax.0, inputs=/input_1)`
self.model = Model(input=base_model.input, output=predictions)
Model is created
Fine tuning...
Freezing 80 layers
Found 6149 images belonging to 102 classes.
Found 1020 images belonging to 102 classes.
./models\base_model.py:43: UserWarning: Update your `fit_generator` call to the Keras 2 API: `fit_generator(<keras.pre..., validation_steps=1020, callbacks=[<keras.ca..., epochs=1000, steps_per_epoch=192, validation_data=<keras.pre..., class_weight={0: 2.4765...)`
class_weight=self.class_weight)
Epoch 1/1000
Input dimension mis-match. (input[0].shape[1] = 7, input[1].shape[1] = 64)
Apply node that caused the error: Elemwise{add,no_inplace}(AbstractConv2d{convdim=2, border_mode='valid', subsample=(2, 2), filter_flip=True, imshp=(None, 3, 230, 230), kshp=(64, 3, 7, 7), filter_dilation=(1, 1)}.0, Reshape{4}.0)
Toposort index: 3158
Inputs types: [TensorType(float32, 4D), TensorType(float32, (True, False, True, True))]
Inputs shapes: [(32, 7, 114, 84), (1, 64, 1, 1)]
Inputs strides: [(1066128, 152304, 1336, 8), (256, 4, 4, 4)]
Inputs values: ['not shown', 'not shown']
Outputs clients: [[AbstractBatchNormInference{axes=(0, 2, 3)}(Elemwise{add,no_inplace}.0, Reshape{4}.0, Reshape{4}.0, Reshape{4}.0, Reshape{4}.0, TensorConstant{0.00100000..0474974513}), AbstractBatchNormTrain{axes=(0, 2, 3)}(Elemwise{add,no_inplace}.0, InplaceDimShuffle{x,0,x,x}.0, InplaceDimShuffle{x,0,x,x}.0, TensorConstant{0.00100000..0474974513}, TensorConstant{0.10000000149011612})]]
Backtrace when the node is created(use Theano flag traceback.limit=N to make it longer):
File "C:\Anaconda3\envs\py35\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "C:/Users/shiri/Documents/keras-transfer-learning-for-oxford102-master/train.py", line 50, in <module>
model.train()
File "./models\base_model.py", line 48, in train
self._create()
File "C:\Users\shiri\Documents\keras-transfer-learning-for-oxford102-master\models\resnet50.py", line 21, in _create
base_model = KerasResNet50(include_top=False, input_tensor=self.get_input_tensor())
File "C:\Anaconda3\envs\py35\lib\site-packages\keras\applications\resnet50.py", line 207, in ResNet50
x = Conv2D(64, (7, 7), strides=(2, 2), name='conv1')(x)
File "C:\Anaconda3\envs\py35\lib\site-packages\keras\engine\topology.py", line 554, in __call__
output = self.call(inputs, **kwargs)
File "C:\Anaconda3\envs\py35\lib\site-packages\keras\layers\convolutional.py", line 178, in call
data_format=self.data_format)
File "C:\Anaconda3\envs\py35\lib\site-packages\keras\backend\theano_backend.py", line 1938, in bias_add
x += reshape(bias, (1, bias.shape[0], 1, 1))
HINT: Use the Theano flag 'exception_verbosity=high' for a debugprint and storage map footprint of this apply node.
Traceback (most recent call last):
File "C:\Anaconda3\envs\py35\lib\site-packages\theano\compile\function_module.py", line 884, in __call__
self.fn() if output_subset is None else\
ValueError: Input dimension mis-match. (input[0].shape[1] = 7, input[1].shape[1] = 64)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/shiri/Documents/keras-transfer-learning-for-oxford102-master/train.py", line 50, in <module>
model.train()
File "./models\base_model.py", line 51, in train
self._fine_tuning()
File "./models\base_model.py", line 43, in _fine_tuning
class_weight=self.class_weight)
File "C:\Anaconda3\envs\py35\lib\site-packages\keras\legacy\interfaces.py", line 88, in wrapper
return func(*args, **kwargs)
File "C:\Anaconda3\envs\py35\lib\site-packages\keras\engine\training.py", line 1876, in fit_generator
class_weight=class_weight)
File "C:\Anaconda3\envs\py35\lib\site-packages\keras\engine\training.py", line 1620, in train_on_batch
outputs = self.train_function(ins)
File "C:\Anaconda3\envs\py35\lib\site-packages\keras\backend\theano_backend.py", line 1094, in __call__
return self.function(*inputs)
File "C:\Anaconda3\envs\py35\lib\site-packages\theano\compile\function_module.py", line 898, in __call__
storage_map=getattr(self.fn, 'storage_map', None))
File "C:\Anaconda3\envs\py35\lib\site-packages\theano\gof\link.py", line 325, in raise_with_op
reraise(exc_type, exc_value, exc_trace)
File "C:\Anaconda3\envs\py35\lib\site-packages\six.py", line 685, in reraise
raise value.with_traceback(tb)
File "C:\Anaconda3\envs\py35\lib\site-packages\theano\compile\function_module.py", line 884, in __call__
self.fn() if output_subset is None else\
ValueError: Input dimension mis-match. (input[0].shape[1] = 7, input[1].shape[1] = 64)
Apply node that caused the error: Elemwise{add,no_inplace}(AbstractConv2d{convdim=2, border_mode='valid', subsample=(2, 2), filter_flip=True, imshp=(None, 3, 230, 230), kshp=(64, 3, 7, 7), filter_dilation=(1, 1)}.0, Reshape{4}.0)
Toposort index: 3158
Inputs types: [TensorType(float32, 4D), TensorType(float32, (True, False, True, True))]
Inputs shapes: [(32, 7, 114, 84), (1, 64, 1, 1)]
Inputs strides: [(1066128, 152304, 1336, 8), (256, 4, 4, 4)]
Inputs values: ['not shown', 'not shown']
Outputs clients: [[AbstractBatchNormInference{axes=(0, 2, 3)}(Elemwise{add,no_inplace}.0, Reshape{4}.0, Reshape{4}.0, Reshape{4}.0, Reshape{4}.0, TensorConstant{0.00100000..0474974513}), AbstractBatchNormTrain{axes=(0, 2, 3)}(Elemwise{add,no_inplace}.0, InplaceDimShuffle{x,0,x,x}.0, InplaceDimShuffle{x,0,x,x}.0, TensorConstant{0.00100000..0474974513}, TensorConstant{0.10000000149011612})]]
Backtrace when the node is created(use Theano flag traceback.limit=N to make it longer):
File "C:\Anaconda3\envs\py35\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "C:/Users/shiri/Documents/keras-transfer-learning-for-oxford102-master/train.py", line 50, in <module>
model.train()
File "./models\base_model.py", line 48, in train
self._create()
File "C:\Users\shiri\Documents\keras-transfer-learning-for-oxford102-master\models\resnet50.py", line 21, in _create
base_model = KerasResNet50(include_top=False, input_tensor=self.get_input_tensor())
File "C:\Anaconda3\envs\py35\lib\site-packages\keras\applications\resnet50.py", line 207, in ResNet50
x = Conv2D(64, (7, 7), strides=(2, 2), name='conv1')(x)
File "C:\Anaconda3\envs\py35\lib\site-packages\keras\engine\topology.py", line 554, in __call__
output = self.call(inputs, **kwargs)
File "C:\Anaconda3\envs\py35\lib\site-packages\keras\layers\convolutional.py", line 178, in call
data_format=self.data_format)
File "C:\Anaconda3\envs\py35\lib\site-packages\keras\backend\theano_backend.py", line 1938, in bias_add
x += reshape(bias, (1, bias.shape[0], 1, 1))
HINT: Use the Theano flag 'exception_verbosity=high' for a debugprint and storage map footprint of this apply node.