-
Notifications
You must be signed in to change notification settings - Fork 34
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
There is argument issue about Pooling layer(AveragePooling2D : border_mode) #82
Comments
I also encounter this issue when trying to use Inception_v3 in Keras. I think there is an issue in python2.7/site-packages/keras/backend/mxnet_backend.py when convert the argument from Keras to MXnet. They are not compatible. Is there anyone look into this issue? Thanks |
@mli @pluskid @superbobry @MaJieCornell
another problem comes:Using MXNet backend. Stack trace returned 10 entries: Traceback (most recent call last): |
I want to use keras.applications.inception_v3 model. After I load that model it, there is an error about pooling layer.
Error Message
:----> 1 InceptionV3(include_top=True,input_tensor=None, input_shape=None,weights=None)
/pang/linetor/miniconda2/envs/py27/lib/python2.7/site-packages/keras/applications/inception_v3.pyc in InceptionV3(include_top, weights, input_tensor, input_shape, classes)
149
150 branch_pool = AveragePooling2D(
--> 151 (3, 3), strides=(1, 1), border_mode='same')(x)
152 branch_pool = conv2d_bn(branch_pool, 32, 1, 1)
153 x = merge([branch1x1, branch5x5, branch3x3dbl, branch_pool],
/pang/linetor/miniconda2/envs/py27/lib/python2.7/site-packages/keras/engine/topology.pyc in call(self, x, mask)
570 if inbound_layers:
571 # This will call layer.build() if necessary.
--> 572 self.add_inbound_node(inbound_layers, node_indices, tensor_indices)
573 # Outputs were already computed when calling self.add_inbound_node.
574 outputs = self.inbound_nodes[-1].output_tensors
/pang/linetor/miniconda2/envs/py27/lib/python2.7/site-packages/keras/engine/topology.pyc in add_inbound_node(self, inbound_layers, node_indices, tensor_indices)
633 # creating the node automatically updates self.inbound_nodes
634 # as well as outbound_nodes on inbound layers.
--> 635 Node.create_node(self, inbound_layers, node_indices, tensor_indices)
636
637 def get_output_shape_for(self, input_shape):
/pang/linetor/miniconda2/envs/py27/lib/python2.7/site-packages/keras/engine/topology.pyc in create_node(cls, outbound_layer, inbound_layers, node_indices, tensor_indices)
164
165 if len(input_tensors) == 1:
--> 166 output_tensors = to_list(outbound_layer.call(input_tensors[0], mask=input_masks[0]))
167 output_masks = to_list(outbound_layer.compute_mask(input_tensors[0], input_masks[0]))
168 # TODO: try to auto-infer shape
/pang/linetor/miniconda2/envs/py27/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
/pang/linetor/miniconda2/envs/py27/lib/python2.7/site-packages/keras/layers/pooling.pyc in _pooling_function(self, inputs, pool_size, strides, border_mode, dim_ordering)
249 border_mode, dim_ordering):
250 output = K.pool2d(inputs, pool_size, strides,
--> 251 border_mode, dim_ordering, pool_mode='avg')
252 return output
253
/pang/linetor/miniconda2/envs/py27/lib/python2.7/site-packages/keras/backend/mxnet_backend.pyc in func_wrapper(*args, **kwargs)
31 old = learning_phase()
32 set_learning_phase(1)
---> 33 train_ret = func(*args, **kwargs)
34 set_learning_phase(0)
35 test_ret = func(*args, **kwargs)
/pang/linetor/miniconda2/envs/py27/lib/python2.7/site-packages/keras/backend/mxnet_backend.pyc in pool2d(x, pool_size, strides, border_mode, dim_ordering, pool_mode)
2910 x = _preprocess_convnd_input(x, dim_ordering)
2911 s = mx.sym.Pooling(data=x.symbol, kernel=pool_size, pool_type=pool_mode, pooling_convention=border_mode,
-> 2912 stride=strides)
2913 out = _postprocess_convnd_output(KerasSymbol(s), dim_ordering)
2914 return out
/pang/linetor/.local/lib/python2.7/site-packages/mxnet/symbol.pyc in Pooling(data, global_pool, cudnn_off, kernel, pool_type, pooling_convention, stride, pad, name, attr, out, **kwargs)
/pang/linetor/.local/lib/python2.7/site-packages/mxnet/_ctypes/symbol.pyc in _symbol_creator(handle, args, kwargs, keys, vals, name)
125 c_array(ctypes.c_char_p, [c_str(i) for i in keys]),
126 c_array(ctypes.c_char_p, [c_str(str(i)) for i in vals]),
--> 127 ctypes.byref(sym_handle)))
128
129 if args and kwargs:
/pang/linetor/.local/lib/python2.7/site-packages/mxnet/base.pyc in check_call(ret)
127 """
128 if ret != 0:
--> 129 raise MXNetError(py_str(_LIB.MXGetLastError()))
130
131 if sys.version_info[0] < 3:
MXNetError: Invalid Input: 'same', valid values are: {'full', 'valid'}, in operator Pooling(name="", stride="(1, 1)", pooling_convention="same", pool_type="avg", kernel="(3, 3)")
If I read error message, I think argument about border _mode. In keras 1.2.2, Pooling layer 's argument : border_mode need to be in ('valid' or 'same'). But by using mxnet, back-end it says {'full', 'valid'}.
If I use "same', mxnet makes a issue. If I use 'full', keras makes issue. So I can't implement InceptionResNetV2.
Is there any comment about this?
Please make sure that the boxes below are checked before you submit your issue. If your issue is an implementation question, please ask your question on StackOverflow or join the Keras Slack channel and ask there instead of filing a GitHub issue.
Thank you!
Check that you are up-to-date with the master branch of Keras. You can update with:
pip install git+git://github.com/fchollet/keras.git --upgrade --no-deps
If running on TensorFlow, check that you are up-to-date with the latest version. The installation instructions can be found here.
If running on Theano, check that you are up-to-date with the master branch of Theano. You can update with:
pip install git+git://github.com/Theano/Theano.git --upgrade --no-deps
Provide a link to a GitHub Gist of a Python script that can reproduce your issue (or just copy the script here if it is short).
The text was updated successfully, but these errors were encountered: