Open Kopsahlong opened 6 years ago
I am also getting the same error!!
@vaghelan I never actually got this error fixed, but I found that some of the other NN architectures (like the resnet_50 and inception_v4) worked for me instead! I'd still love to get the VGG going though, so let me know if you come up with anything that helps...
error for resnet_50 also
resnet_50.py:29: UserWarning: Update your Conv2D
call to the Keras 2 API: Conv2D(256, (1, 1), name="res4f_branch2a")
x = Convolution2D(nb_filter1, 1, 1, name=conv_name_base + '2a')(input_tensor)
resnet_50.py:34: UserWarning: Update your Conv2D
call to the Keras 2 API: Conv2D(256, (3, 3), padding="same", name="res4f_branch2b")
border_mode='same', name=conv_name_base + '2b')(x)
resnet_50.py:38: UserWarning: Update your Conv2D
call to the Keras 2 API: Conv2D(1024, (1, 1), name="res4f_branch2c")
x = Convolution2D(nb_filter3, 1, 1, name=conv_name_base + '2c')(x)
resnet_50.py:63: UserWarning: Update your Conv2D
call to the Keras 2 API: Conv2D(512, (1, 1), strides=(2, 2), name="res5a_branch2a")
name=conv_name_base + '2a')(input_tensor)
resnet_50.py:68: UserWarning: Update your Conv2D
call to the Keras 2 API: Conv2D(512, (3, 3), padding="same", name="res5a_branch2b")
name=conv_name_base + '2b')(x)
resnet_50.py:72: UserWarning: Update your Conv2D
call to the Keras 2 API: Conv2D(2048, (1, 1), name="res5a_branch2c")
x = Convolution2D(nb_filter3, 1, 1, name=conv_name_base + '2c')(x)
resnet_50.py:76: UserWarning: Update your Conv2D
call to the Keras 2 API: Conv2D(2048, (1, 1), strides=(2, 2), name="res5a_branch1")
name=conv_name_base + '1')(input_tensor)
resnet_50.py:29: UserWarning: Update your Conv2D
call to the Keras 2 API: Conv2D(512, (1, 1), name="res5b_branch2a")
x = Convolution2D(nb_filter1, 1, 1, name=conv_name_base + '2a')(input_tensor)
resnet_50.py:34: UserWarning: Update your Conv2D
call to the Keras 2 API: Conv2D(512, (3, 3), padding="same", name="res5b_branch2b")
border_mode='same', name=conv_name_base + '2b')(x)
resnet_50.py:38: UserWarning: Update your Conv2D
call to the Keras 2 API: Conv2D(2048, (1, 1), name="res5b_branch2c")
x = Convolution2D(nb_filter3, 1, 1, name=conv_name_base + '2c')(x)
resnet_50.py:29: UserWarning: Update your Conv2D
call to the Keras 2 API: Conv2D(512, (1, 1), name="res5c_branch2a")
x = Convolution2D(nb_filter1, 1, 1, name=conv_name_base + '2a')(input_tensor)
resnet_50.py:34: UserWarning: Update your Conv2D
call to the Keras 2 API: Conv2D(512, (3, 3), padding="same", name="res5c_branch2b")
border_mode='same', name=conv_name_base + '2b')(x)
resnet_50.py:38: UserWarning: Update your Conv2D
call to the Keras 2 API: Conv2D(2048, (1, 1), name="res5c_branch2c")
x = Convolution2D(nb_filter3, 1, 1, name=conv_name_base + '2c')(x)
Traceback (most recent call last):
File "resnet_50.py", line 182, in
@vaghelan I know the fix to that problem! You just need to make sure you download the resnet50_weights_tf_dim_ordering_tf_kernels.h5 file () and place it in the imagenet_models directory. The download can be found here >> https://github.com/fchollet/deep-learning-models/releases.
New error :
Traceback (most recent call last):
File "resnet_50.py", line 182, in
@vaghelan how many channels are you using? And is your input data still just the cifar data that was given by default?
I just typed : python resnet_50.py
So yes it uses same cifar data.
Not entirely sure on this issue, but given that the error is in load weights, my best guess is that the weight file is incorrect for some reason and you need to search for another one (the file is online in lots of different locations)
I think code is old way of doing fine tuning. With new version of keras we have to do from keras.applications
https://keras.io/applications/
Look at fine tuning section.
They have given example for Inceptionv3. They knock off top layer and add new layer with less classes.
I am also getting the same error I'm using python 3.7, keras 2.2.4, and tensorflow 1.8.0 I modification code model.add(ZeroPadding2D((1, 1), input_shape=(channel,img_rows, img_cols))) == >> model.add(ZeroPadding2D((1, 1), input_shape=(img_rows, img_cols, channel))) channel last and Convolution2D modification model.add(Convolution2D(128, kernel_size=3, activation='relu',padding='same')) The code works
Hi Felix, thanks for the code you have provided here!
I just clone everything and am attempting to run things out of box before doing my own finetuning .. I'm running into this issue though, and am wondering if you have any insights.
I simply run 'python vgg16.py' and get this output:
Kristas-MacBook-Pro-2:cnn_finetune Krista$ python vgg19.py Using TensorFlow backend. 2017-11-10 12:30:18.227736: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA vgg19.py:29: UserWarning: Update your
model = vgg19_model(img_rows, img_cols, channel, num_classes)
File "vgg19.py", line 38, in vgg19_model
model.add(MaxPooling2D((2,2), strides=(2,2)))
File "/usr/local/lib/python2.7/site-packages/keras/models.py", line 475, in add
output_tensor = layer(self.outputs[0])
File "/usr/local/lib/python2.7/site-packages/keras/engine/topology.py", line 603, in call
output = self.call(inputs, **kwargs)
File "/usr/local/lib/python2.7/site-packages/keras/layers/pooling.py", line 154, in call
data_format=self.data_format)
File "/usr/local/lib/python2.7/site-packages/keras/layers/pooling.py", line 217, in _pooling_function
pool_mode='max')
File "/usr/local/lib/python2.7/site-packages/keras/backend/tensorflow_backend.py", line 3456, in pool2d
data_format=tf_data_format)
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/ops/nn_ops.py", line 1958, in max_pool
name=name)
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/ops/gen_nn_ops.py", line 2806, in _max_pool
data_format=data_format, name=name)
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 2958, in create_op
set_shapes_for_outputs(ret)
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 2209, in set_shapes_for_outputs
shapes = shape_func(op)
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 2159, in call_with_requiring
return call_cpp_shape_fn(op, require_shape_fn=True)
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/framework/common_shapes.py", line 627, in call_cpp_shape_fn
require_shape_fn)
File "/usr/local/lib/python2.7/site-packages/tensorflow/python/framework/common_shapes.py", line 691, in _call_cpp_shape_fn_impl
raise ValueError(err.message)
ValueError: Negative dimension size caused by subtracting 2 from 1 for 'max_pooling2d_2/MaxPool' (op: 'MaxPool') with input shapes: [?,1,112,128].
Conv2D
call to the Keras 2 API:Conv2D(64, (3, 3), activation="relu")
model.add(Convolution2D(64, 3, 3, activation='relu')) vgg19.py:31: UserWarning: Update yourConv2D
call to the Keras 2 API:Conv2D(64, (3, 3), activation="relu")
model.add(Convolution2D(64, 3, 3, activation='relu')) vgg19.py:35: UserWarning: Update yourConv2D
call to the Keras 2 API:Conv2D(128, (3, 3), activation="relu")
model.add(Convolution2D(128, 3, 3, activation='relu')) vgg19.py:37: UserWarning: Update yourConv2D
call to the Keras 2 API:Conv2D(128, (3, 3), activation="relu")
model.add(Convolution2D(128, 3, 3, activation='relu')) Traceback (most recent call last): File "vgg19.py", line 108, inI'm using python 2..7.14, keras 2.0.9, and tensorflow 1.4.0
Thanks in advance!