ZFTurbo / KAGGLE_DISTRACTED_DRIVER

Solutions
91 stars 53 forks source link

call_cpp_shape_fn raise ValueError(err.message) ValueError: Negative dimension size caused by subtracting 3 from 1 #5

Open monajalal opened 7 years ago

monajalal commented 7 years ago

Also for the other one, I get this error, please suggest fixes:

mona@pascal:~/computer_vision/kaggle_distracted_driver$ python run_keras_simple.py 
/usr/local/lib/python2.7/dist-packages/sklearn/cross_validation.py:44: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. Also note that the interface of the new CV iterators are different from that of this module. This module will be removed in 0.20.
  "This module will be removed in 0.20.", DeprecationWarning)
Using TensorFlow backend.
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcublas.so.8.0 locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcudnn.so.5.0 locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcufft.so.8.0 locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcurand.so.8.0 locally
Read train images
Load folder c0
Load folder c1
Load folder c2
Load folder c3
Load folder c4
Load folder c5
Load folder c6
Load folder c7
Load folder c8
Load folder c9
Directory doesnt exists
('Train shape:', (0, 1, 96, 128))
(0, 'train samples')
('Split train: ', 0)
('Split valid: ', 0)
('Split holdout: ', 0)
Traceback (most recent call last):
  File "run_keras_simple.py", line 189, in <module>
    input_shape=(1, img_rows, img_cols)))
  File "/usr/local/lib/python2.7/dist-packages/keras/models.py", line 294, in add
    layer.create_input_layer(batch_input_shape, input_dtype)
  File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 398, in create_input_layer
    self(x)
  File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 569, 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 632, 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 164, 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 442, in call
    filter_shape=self.W_shape)
  File "/usr/local/lib/python2.7/dist-packages/keras/backend/tensorflow_backend.py", line 2206, in conv2d
    x = tf.nn.conv2d(x, kernel, strides, padding=padding)
  File "/home/mona/tensorflow/_python_build/tensorflow/python/ops/gen_nn_ops.py", line 394, in conv2d
    data_format=data_format, name=name)
  File "/home/mona/tensorflow/_python_build/tensorflow/python/framework/op_def_library.py", line 749, in apply_op
    op_def=op_def)
  File "/home/mona/tensorflow/_python_build/tensorflow/python/framework/ops.py", line 2390, in create_op
    set_shapes_for_outputs(ret)
  File "/home/mona/tensorflow/_python_build/tensorflow/python/framework/ops.py", line 1785, in set_shapes_for_outputs
    shapes = shape_func(op)
  File "/home/mona/tensorflow/_python_build/tensorflow/python/framework/common_shapes.py", line 596, in call_cpp_shape_fn
    raise ValueError(err.message)
ValueError: Negative dimension size caused by subtracting 3 from 1
ZFTurbo commented 7 years ago

As I can see you don't have training data. It should be located in ../input/train/

ZFTurbo commented 7 years ago

Code written for theano backend, not for tensorflow. There are differences in shapes.