-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Great work on this! I find this to be the most user friendly code for doing transfer learning. I can get it to work well on square images of a variety of sizes but I get errors when working on non-square images (see below). Got any advice on how to get around this?
Thanks again for the great code!
Negative dimension size caused by subtracting 7 from 2 for 'avg_pool/AvgPool' (op: 'AvgPool') with input shapes: [?,2,8,2048].
Traceback (most recent call last):
File "C:\Python35\lib\site-packages\tensorflow\python\framework\common_shapes.py", line 654, in _call_cpp_shape_fn_impl
input_tensors_as_shapes, status)
File "C:\Python35\lib\contextlib.py", line 66, in exit
next(self.gen)
File "C:\Python35\lib\site-packages\tensorflow\python\framework\errors_impl.py", line 466, in raise_exception_on_not_ok_status
pywrap_tensorflow.TF_GetCode(status))
tensorflow.python.framework.errors_impl.InvalidArgumentError: Negative dimension size caused by subtracting 7 from 2 for 'avg_pool/AvgPool' (op: 'AvgPool') with input shapes: [?,2,8,2048].
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "W:/work2017/TSA_kaggle/python_code/train_VGG16.py", line 57, in
train(args.nb_epoch, args.freeze_layers_number)
File "W:/work2017/TSA_kaggle/python_code/train_VGG16.py", line 43, in train
model.train()
File "W:\work2017\TSA_kaggle\python_code\models\base_model.py", line 89, in train
self._create()
File "W:\work2017\TSA_kaggle\python_code\models\resnet50.py", line 20, in _create
base_model = KerasResNet50(include_top=False, input_tensor=self.get_input_tensor())
File "C:\Python35\lib\site-packages\keras\applications\resnet50.py", line 232, in ResNet50
x = AveragePooling2D((7, 7), name='avg_pool')(x)
File "C:\Python35\lib\site-packages\keras\engine\topology.py", line 602, in call
output = self.call(inputs, **kwargs)
File "C:\Python35\lib\site-packages\keras\layers\pooling.py", line 154, in call
data_format=self.data_format)
File "C:\Python35\lib\site-packages\keras\layers\pooling.py", line 271, in _pooling_function
padding, data_format, pool_mode='avg')
File "C:\Python35\lib\site-packages\keras\backend\tensorflow_backend.py", line 3388, in pool2d
x = tf.nn.avg_pool(x, pool_size, strides, padding=padding)
File "C:\Python35\lib\site-packages\tensorflow\python\ops\nn_ops.py", line 1744, in avg_pool
name=name)
File "C:\Python35\lib\site-packages\tensorflow\python\ops\gen_nn_ops.py", line 46, in _avg_pool
data_format=data_format, name=name)
File "C:\Python35\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 767, in apply_op
op_def=op_def)
File "C:\Python35\lib\site-packages\tensorflow\python\framework\ops.py", line 2632, in create_op
set_shapes_for_outputs(ret)
File "C:\Python35\lib\site-packages\tensorflow\python\framework\ops.py", line 1911, in set_shapes_for_outputs
shapes = shape_func(op)
File "C:\Python35\lib\site-packages\tensorflow\python\framework\ops.py", line 1861, in call_with_requiring
return call_cpp_shape_fn(op, require_shape_fn=True)
File "C:\Python35\lib\site-packages\tensorflow\python\framework\common_shapes.py", line 595, in call_cpp_shape_fn
require_shape_fn)
File "C:\Python35\lib\site-packages\tensorflow\python\framework\common_shapes.py", line 659, in _call_cpp_shape_fn_impl
raise ValueError(err.message)
ValueError: Negative dimension size caused by subtracting 7 from 2 for 'avg_pool/AvgPool' (op: 'AvgPool') with input shapes: [?,2,8,2048].
-
[Tensorflow ] Which backend do you use (TensorFlow or Theano) and what its version?
-
[3.5 ] What version of Python?
-
What version of Keras?