EdwardTyantov / ultrasound-nerve-segmentation

Kaggle Ultrasound Nerve Segmentation competition [Keras]

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

An error cast when I run train.py

JFChi opened this issue · comments

Dear Edward:
Thanks for your sharing. But when I run train.py, it cast our an error:ValueError: Filter must not be larger than the input: Filter: (3, 1) Input: (1, 80).
Do you know why?

Hi, could you post launch command and entire python error, please ?

I ran into this same problem, I think it has to do with the dimension ordering in images for tensorflow vs. theano. I fixed it by explicitly setting the backend to theano:

export KERAS_BACKEND=theano

I did run into more dimension problems later in the merge layers after fixing this though...

Year, kramimus, right, thanks a lot.
I configure my keras in the configuration file ~/.keras/keras.json

cat ~/.keras/keras.json
{
"image_dim_ordering": "th",
"epsilon": 1e-07,
"floatx": "float32",
"backend": "theano"
}

I've updated readme to address this issue.

Hi, I got the same type of error even though I setup the backend as tensorflow, and use the image_dim_ordering as tf.

It seems to me that the problem comes from here def get_unet(): inputs = Input((1,img_rows, img_cols)) I tried both this way and inputs = Input((img_rows, img_cols,1)) . Neighther solves the problem. Any insight would be appreciated.

Traceback (most recent call last):                                                                 
  File "train.py", line 155, in <module>                                                           
    train_and_predict()                                                                            
  File "train.py", line 121, in train_and_predict                                                  
    model = get_unet()                                                                             
  File "train.py", line 36, in get_unet                                                            
    conv1 = Convolution2D(32, 3, 3, activation='relu', border_mode='same')(inputs)                 
  File "/home/tfw/lib/python3.4/site-packages/Keras-1.0.3-py3.4.egg/keras/engine/topology.py", line 485, in __call__                                                                  
    self.add_inbound_node(inbound_layers, node_indices, tensor_indices)                            
  .......
  File "/home/tfw/lib/python3.4/site-packages/tensorflow/python/ops/common_shapes.py", line 238, in conv2d_shape
    in_rows, in_cols, filter_rows, filter_cols, stride_r, stride_c, padding)
  File "/home/tfw/lib/python3.4/site-packages/tensorflow/python/ops/common_shapes.py", line 151, in get2d_conv_output_size
    % (filter_height, filter_width, input_height, input_width))
ValueError: filter must not be larger than the input: Filter: [3x3] Input: [64x1]

I can't comment issues regarding TF, code works with theano, although I managed to launch with TF backend, but got 10x slower training iteration.