Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vgg = Vgg16() error #24

Closed
chenjun0210 opened this issue Jan 6, 2017 · 2 comments
Closed

vgg = Vgg16() error #24

chenjun0210 opened this issue Jan 6, 2017 · 2 comments

Comments

@chenjun0210
Copy link

#import Vgg16 helper class

vgg = Vgg16()


ValueError Traceback (most recent call last)
in ()
1 #import Vgg16 helper class
----> 2 vgg = Vgg16()

/home/chenjun/Projects/courses/deeplearning1/nbs/vgg16.pyc in init(self)
31 def init(self):
32 self.FILE_PATH = 'models/'
---> 33 self.create()
34 self.get_classes()
35

/home/chenjun/Projects/courses/deeplearning1/nbs/vgg16.pyc in create(self)
69
70 self.ConvBlock(2, 64)
---> 71 self.ConvBlock(2, 128)
72 self.ConvBlock(3, 256)
73 self.ConvBlock(3, 512)

/home/chenjun/Projects/courses/deeplearning1/nbs/vgg16.pyc in ConvBlock(self, layers, filters)
55 model.add(ZeroPadding2D((1, 1)))
56 model.add(Convolution2D(filters, 3, 3, activation='relu'))
---> 57 model.add(MaxPooling2D((2, 2), strides=(2, 2)))
58
59

/home/chenjun/anaconda2/lib/python2.7/site-packages/keras/models.pyc in add(self, layer)
325 output_shapes=[self.outputs[0]._keras_shape])
326 else:
--> 327 output_tensor = layer(self.outputs[0])
328 if isinstance(output_tensor, list):
329 raise TypeError('All layers in a Sequential model '

/home/chenjun/anaconda2/lib/python2.7/site-packages/keras/engine/topology.pyc in call(self, x, mask)
567 if inbound_layers:
568 # This will call layer.build() if necessary.
--> 569 self.add_inbound_node(inbound_layers, node_indices, tensor_indices)
570 # Outputs were already computed when calling self.add_inbound_node.
571 outputs = self.inbound_nodes[-1].output_tensors

/home/chenjun/anaconda2/lib/python2.7/site-packages/keras/engine/topology.pyc in add_inbound_node(self, inbound_layers, node_indices, tensor_indices)
630 # creating the node automatically updates self.inbound_nodes
631 # as well as outbound_nodes on inbound layers.
--> 632 Node.create_node(self, inbound_layers, node_indices, tensor_indices)
633
634 def get_output_shape_for(self, input_shape):

/home/chenjun/anaconda2/lib/python2.7/site-packages/keras/engine/topology.pyc in create_node(cls, outbound_layer, inbound_layers, node_indices, tensor_indices)
162
163 if len(input_tensors) == 1:
--> 164 output_tensors = to_list(outbound_layer.call(input_tensors[0], mask=input_masks[0]))
165 output_masks = to_list(outbound_layer.compute_mask(input_tensors[0], input_masks[0]))
166 # TODO: try to auto-infer shape

/home/chenjun/anaconda2/lib/python2.7/site-packages/keras/layers/pooling.pyc in call(self, x, mask)
158 strides=self.strides,
159 border_mode=self.border_mode,
--> 160 dim_ordering=self.dim_ordering)
161 return output
162

/home/chenjun/anaconda2/lib/python2.7/site-packages/keras/layers/pooling.pyc in _pooling_function(self, inputs, pool_size, strides, border_mode, dim_ordering)
208 output = K.pool2d(inputs, pool_size, strides,
209 border_mode, dim_ordering,
--> 210 pool_mode='max')
211 return output
212

/home/chenjun/anaconda2/lib/python2.7/site-packages/keras/backend/tensorflow_backend.pyc in pool2d(x, pool_size, strides, border_mode, dim_ordering, pool_mode)
2336
2337 if pool_mode == 'max':
-> 2338 x = tf.nn.max_pool(x, pool_size, strides, padding=padding)
2339 elif pool_mode == 'avg':
2340 x = tf.nn.avg_pool(x, pool_size, strides, padding=padding)

/home/chenjun/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/nn_ops.pyc in max_pool(value, ksize, strides, padding, data_format, name)
687 padding=padding,
688 data_format=data_format,
--> 689 name=name)
690
691

/home/chenjun/anaconda2/lib/python2.7/site-packages/tensorflow/python/ops/gen_nn_ops.pyc in _max_pool(input, ksize, strides, padding, data_format, name)
1121 result = _op_def_lib.apply_op("MaxPool", input=input, ksize=ksize,
1122 strides=strides, padding=padding,
-> 1123 data_format=data_format, name=name)
1124 return result
1125

/home/chenjun/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.pyc in apply_op(self, op_type_name, name, **keywords)
701 op = g.create_op(op_type_name, inputs, output_types, name=scope,
702 input_types=input_types, attrs=attr_protos,
--> 703 op_def=op_def)
704 outputs = op.outputs
705 return _Restructure(ops.convert_n_to_tensor(outputs),

/home/chenjun/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/ops.pyc in create_op(self, op_type, inputs, dtypes, input_types, name, attrs, op_def, compute_shapes, compute_device)
2334 original_op=self._default_original_op, op_def=op_def)
2335 if compute_shapes:
-> 2336 set_shapes_for_outputs(ret)
2337 self._add_op(ret)
2338 self._record_op_seen_by_control_dependencies(ret)

/home/chenjun/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/ops.pyc in set_shapes_for_outputs(op)
1723 raise RuntimeError("No shape function registered for standard op: %s"
1724 % op.type)
-> 1725 shapes = shape_func(op)
1726 if shapes is None:
1727 raise RuntimeError(

/home/chenjun/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/common_shapes.pyc in max_pool_shape(op)
508 out_rows, out_cols = get2d_conv_output_size(in_rows, in_cols, ksize_r,
509 ksize_c, stride_r, stride_c,
--> 510 padding)
511 output_shape = [batch_size, out_rows, out_cols, depth]
512 else:

/home/chenjun/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/common_shapes.pyc in get2d_conv_output_size(input_height, input_width, filter_height, filter_width, row_stride, col_stride, padding_type)
187 return get_conv_output_size((input_height, input_width),
188 (filter_height, filter_width),
--> 189 (row_stride, col_stride), padding_type)
190
191

/home/chenjun/anaconda2/lib/python2.7/site-packages/tensorflow/python/framework/common_shapes.pyc in get_conv_output_size(input_size, filter_size, strides, padding_type)
152 zip(filter_size, input_size)):
153 raise ValueError("Filter must not be larger than the input: "
--> 154 "Filter: %r Input: %r" % (filter_size, input_size))
155
156 if padding_type == b"VALID":

ValueError: Filter must not be larger than the input: Filter: (2, 2) Input: (1, 112)

@chenjun0210 chenjun0210 changed the title vgg = Vgg16() errot vgg = Vgg16() error Jan 6, 2017
@mo-hittudiv
Copy link

+1
Same error for me

@racheltho
Copy link
Contributor

It's better to ask this sort of question on the forums

dineshkumarsarangapani pushed a commit to dineshkumarsarangapani/courses that referenced this issue Sep 29, 2018
Add Resnet152 and VGG19_bn as VGG19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants