Skip to content

[Group conv support] ValueError: number of input channels does not match corresponding dimension of filter, 96 != 48 #10

Closed

Description

Hi,

I converted BVLC_AlexNet from Caffe to IR first. Then converted IR to Tensorflow code snippet in order to use it to get the checkpoint file. But when I tried to test my converted model by executing python -m mmdnn.conversion.examples.tensorflow.imagenet_test -s tensorflow -p AlexNet -n BVLC_AlexNet -w BVLC_AlexNet.npy, the error happened below:

Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/local/lib/python2.7/dist-packages/mmdnn/conversion/examples/tensorflow/imagenet_test.py", line 68, in <module>
    tester = TestTF()
  File "/usr/local/lib/python2.7/dist-packages/mmdnn/conversion/examples/tensorflow/imagenet_test.py", line 17, in __init__
    self.input, self.model = self.MainModel.KitModel(self.args.w)
  File "BVLC_AlexNet.py", line 33, in KitModel
    conv2_1         = convolution(conv2_0, strides = [1, 1], padding = 'VALID', name = 'conv2_1')
  File "BVLC_AlexNet.py", line 62, in convolution
    layer = tf.nn.convolution(input, w, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/nn_ops.py", line 750, in convolution
    name=name, data_format=data_format)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/nn_ops.py", line 807, in __init__
    num_spatial_dims]))
ValueError: number of input channels does not match corresponding dimension of filter, 96 != 48

If you wanna take a look at my converted model, here is the link
Can you please deal with it?
Thanks.

Activity

  1. kitstar commented on Nov 30, 2017

    @kitstar
    Contributor

    Hi Sean Chung (@seanchung2) . Same problem with xception. Not support Conv with groups now. Will implement it soon. Thanks.

  2. kitstar commented on Dec 1, 2017

    @kitstar
    Contributor

    Sean Chung (@seanchung2) master branch enables the groups convolution. Please try it. Thanks.

  3. kitstar commented on Dec 7, 2017

    @kitstar
    Contributor

    Hi Sean Chung (@seanchung2) ,
    caffe alexnet -> tf tested.

    master branch with following scripts:

    $ python -m mmdnn.conversion._script.convertToIR -f caffe -d kit_imagenet -n examples/caffe/models/bvlc_alexnet.prototxt -w examples/caffe/models/bvlc_alexnet.caffemodel
    
    $ python -m mmdnn.conversion._script.IRToCode -f tensorflow --IRModelPath kit_imagenet.pb --dstModelPath kit_imagenet.py -w kit_imagenet.npy
    
    $ python -m mmdnn.conversion.examples.tensorflow.imagenet_test -n kit_imagenet.py -w kit_imagenet.npy --dump ./caffe_alexnet.ckpt
    
    Tensorflow file is saved as [./caffe_alexnet.ckpt], generated by [kit_imagenet.py] and [kit_imagenet.npy].
  4. changed the title [-]ValueError: number of input channels does not match corresponding dimension of filter, 96 != 48[/-] [+][Group conv support] ValueError: number of input channels does not match corresponding dimension of filter, 96 != 48[/+] on Dec 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions