research
research copied to clipboard
ValueError: Filter must not be larger than the input: Filter: (8, 8) Input: (3, 160)
Hi,
I'm having this issue when running train steering model:
(snakes) guy_pavlov84@instance-1:~/research$ sudo ./train_steering_model.py --port 5557 --val_port 5556
Using TensorFlow backend.
Traceback (most recent call last):
File "./train_steering_model.py", line 62, in <module>
model = get_model()
File "./train_steering_model.py", line 31, in get_model
model.add(Convolution2D(16, 8, 8, subsample=(4, 4), border_mode="same"))
File "/usr/local/lib/python2.7/dist-packages/keras/models.py", line 308, in add
output_tensor = layer(self.outputs[0])
File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 514, in __call__
self.add_inbound_node(inbound_layers, node_indices, tensor_indices)
File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 572, in add_inbound_node
Node.create_node(self, inbound_layers, node_indices, tensor_indices)
File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 149, in create_node
output_tensors = to_list(outbound_layer.call(input_tensors[0], mask=input_masks[0]))
File "/usr/local/lib/python2.7/dist-packages/keras/layers/convolutional.py", line 466, in call
filter_shape=self.W_shape)
File "/usr/local/lib/python2.7/dist-packages/keras/backend/tensorflow_backend.py", line 1579, in conv2d
x = tf.nn.conv2d(x, kernel, strides, padding=padding)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gen_nn_ops.py", line 394, in conv2d
data_format=data_format, name=name)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/op_def_library.py", line 704, in apply_op
op_def=op_def)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 2262, in create_op
set_shapes_for_outputs(ret)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 1702, in set_shapes_for_outputs
shapes = shape_func(op)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/common_shapes.py", line 246, in conv2d_shape
padding)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/common_shapes.py", line 184, in get2d_conv_output_size
(row_stride, col_stride), padding_type)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/common_shapes.py", line 149, in get_conv_output_size
"Filter: %r Input: %r" % (filter_size, input_size))
ValueError: Filter must not be larger than the input: Filter: (8, 8) Input: (3, 160)
Any idea what that might be? This is the setup:
(snakes) guy_pavlov84@instance-1:~/research$ pip freeze
funcsigs==1.0.2
h5py==2.6.0
Keras==1.1.0
mock==2.0.0
numpy==1.11.2
pbr==1.10.0
PyYAML==3.12
pyzmq==15.4.0
scipy==0.18.1
six==1.10.0
tensorflow==0.5.0
Theano==0.8.2
zmq==0.0.0
Have you solved this problem? I have got the same problem as you.
Yes, at some point in a new release of keras the order of parameters of input_shape and output_shape was changed. To solve this we need to make two adjustments:
- input_shape=(ch, row, col) == > input_shape=(row, col, ch) (line 28 in train_steering_model.py) the same for output_shape
- flip the input data accordingly - add two lines after line 17 and before line 18 in train_steering_model.py: X = numpy.swapaxes(X, 2, 3) X = numpy.swapaxes(X, 3, 4)
Hey I solved the problem following your instructions, thank you very much.
Hey, I solved the problem following your instructions, then another problem is appear: After I trained the steering model, then use the following command to visualize the results: "./view_steering_model.py ./outputs/steering_model/steering_angle.json"
It got errors: Exception: Error when checking : expected lambda_input_1 to have shape (None, 160, 320, 3) but got array with shape (1, 3, 160, 320)
We need to modify the code in "view_steering_model.py" to slove the problem?
Yes, we have to change the code near the line 113 and 114 according to above instructions. Good luck.
Yes, thank you! I have changed the code near line 115,
Before: predicted_steers = model.predict(img[None, :, :, :].transpose(0, 3, 1, 2))[0][0]
After: predicted_steers = model.predict(img[None, :, :, :].transpose(0, 1, 2, 3))[0][0]
Than, it works. Thank you.
hey can you tell me what the line from utils import load, save is doing and more importantly how i can install utils
@gpavlov2016 Your solution works for me too but ran into another issue.
Using TensorFlow backend.
Epoch 1/200
Traceback (most recent call last):
File "train_steering_model.py", line 70, in
Any ideas why I might be seeing this?
I was able to figure out that I didn't include numpy in my imports in the train_steering_model.py file and hence it was giving me the above error.... However now I am running into the same issue as #27 and my training gets killed even before the 2nd epoch is done. Any ideas or suggestions will be very helpful. FYI - I don't think I have a powerful machine on which I am running this on as this seems to be aresource issue. What are the minimum system requirements for me to have it train successfully?
same problem occurred
in the view steering model.py file I found his error (ValueError: bad marshal data (unknown type code)) result when trying to execute the view steering model.py here is the result from the cmd prompt
Traceback (most recent call last): File "C:\Users\lenovo\Anaconda3\lib\site-packages\keras\utils\generic_utils.py ", line 229, in func_load raw_code = codecs.decode(code.encode('ascii'), 'base64') UnicodeEncodeError: 'ascii' codec can't encode character '\xe0' in position 46: ordinal not in range(128)
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "view_steering_model.py", line 94, in model = model_from_json(json.load(jfile)) File "C:\Users\lenovo\Anaconda3\lib\site-packages\keras\models.py", line 349, in model_from_json return layer_module.deserialize(config, custom_objects=custom_objects) File "C:\Users\lenovo\Anaconda3\lib\site-packages\keras\layers_init_.py", l ine 55, in deserialize printable_module_name='layer') File "C:\Users\lenovo\Anaconda3\lib\site-packages\keras\utils\generic_utils.py ", line 144, in deserialize_keras_object list(custom_objects.items()))) File "C:\Users\lenovo\Anaconda3\lib\site-packages\keras\models.py", line 1349, in from_config layer = layer_module.deserialize(conf, custom_objects=custom_objects) File "C:\Users\lenovo\Anaconda3\lib\site-packages\keras\layers_init_.py", l ine 55, in deserialize printable_module_name='layer') File "C:\Users\lenovo\Anaconda3\lib\site-packages\keras\utils\generic_utils.py ", line 144, in deserialize_keras_object list(custom_objects.items()))) File "C:\Users\lenovo\Anaconda3\lib\site-packages\keras\layers\core.py", line 711, in from_config function = func_load(config['function'], globs=globs) File "C:\Users\lenovo\Anaconda3\lib\site-packages\keras\utils\generic_utils.py ", line 234, in func_load code = marshal.loads(raw_code) ValueError: bad marshal data (unknown type code)