raghakot / keras-resnet

Residual networks implementation using Keras-1.0 functional API
Other
1.39k stars 616 forks source link

support tf image_dim_ordering #14

Closed paulfitz closed 7 years ago

paulfitz commented 7 years ago

This shuffles axes around if the global image_dim_ordering flag is set to tf, meaning the network should expect input of the form (samples, rows, cols, channels) rather than (samples, channels, rows, cols).

paulfitz commented 7 years ago

@raghakot thanks for the feedback - addressed your comment.

anubha17pearl commented 6 years ago

(480, 32) Tensor("conv1/BiasAdd:0", shape=(?, 112, 112, 64), dtype=float32) 2018-11-02 14:38:04.118278: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 Tensor("max_pooling2d_1/MaxPool:0", shape=(?, 56, 56, 64), dtype=float32) Tensor("activation_4/Relu:0", shape=(?, 56, 56, 64), dtype=float32) Tensor("activation_7/Relu:0", shape=(?, 56, 56, 64), dtype=float32) Tensor("activation_10/Relu:0", shape=(?, 56, 56, 64), dtype=float32) Traceback (most recent call last): File "resnet26_2.py", line 185, in model = ResNet26(input_shape = image_size, classes = num_class) File "resnet26_2.py", line 153, in ResNet26 X = identity_block(X, f = 3, filters = [128, 128, 128], stage = 3, block='a') File "resnet26_2.py", line 112, in identity_block X = Add()([X_shortcut,X]) File "C:\Users\DELL7437\Documents\anaconda3\envs\py35\lib\site-packages\keras\engine\topology.py", line 592, in call self.build(input_shapes) File "C:\Users\DELL7437\Documents\anaconda3\envs\py35\lib\site-packages\keras\layers\merge.py", line 90, in build output_shape = self._compute_elemwise_op_output_shape(output_shape, shape) File "C:\Users\DELL7437\Documents\anaconda3\envs\py35\lib\site-packages\keras\layers\merge.py", line 61, in _compute_elemwise_op_output_shape str(shape1) + ' ' + str(shape2)) ValueError: Operands could not be broadcast together with shapes (56, 56, 64) (56, 56, 128)

I am trying implement resnet with less number of layers. But I get this error. Input shape used is (224,224,3). I use keras 2.2.4 with tensorflow as backend(tensorflow 1.11.0) How to rectify this error?