msracver / Deformable-ConvNets

Deformable Convolutional Networks
MIT License
4.03k stars 959 forks source link

Shape error with deformable R-FCN #123

Open imrandatascientist opened 6 years ago

imrandatascientist commented 6 years ago

Hi I am running the R-FCN demo however I get the following error: @YuwenXiong

irashid@irashid-All-Series:~/Downloads/Deformable-ConvNets-master$ python ./rfcn/demo.py
/home/irashid/anaconda2/lib/python2.7/site-packages/urllib3/contrib/pyopenssl.py:46: DeprecationWarning: OpenSSL.rand is deprecated - you should use os.urandom instead
  import OpenSSL.SSL
{'CLASS_AGNOSTIC': True,
 'MXNET_VERSION': 'mxnet',
 'SCALES': [(600, 1000)],
 'TEST': {'BATCH_IMAGES': 1,
          'CXX_PROPOSAL': False,
          'HAS_RPN': True,
          'NMS': 0.3,
          'PROPOSAL_MIN_SIZE': 0,
          'PROPOSAL_NMS_THRESH': 0.7,
          'PROPOSAL_POST_NMS_TOP_N': 2000,
          'PROPOSAL_PRE_NMS_TOP_N': 20000,
          'RPN_MIN_SIZE': 0,
          'RPN_NMS_THRESH': 0.7,
          'RPN_POST_NMS_TOP_N': 300,
          'RPN_PRE_NMS_TOP_N': 6000,
          'max_per_image': 100,
          'test_epoch': 8},
 'TRAIN': {'ALTERNATE': {'RCNN_BATCH_IMAGES': 0,
                         'RPN_BATCH_IMAGES': 0,
                         'rfcn1_epoch': 0,
                         'rfcn1_lr': 0,
                         'rfcn1_lr_step': '',
                         'rfcn2_epoch': 0,
                         'rfcn2_lr': 0,
                         'rfcn2_lr_step': '',
                         'rpn1_epoch': 0,
                         'rpn1_lr': 0,
                         'rpn1_lr_step': '',
                         'rpn2_epoch': 0,
                         'rpn2_lr': 0,
                         'rpn2_lr_step': '',
                         'rpn3_epoch': 0,
                         'rpn3_lr': 0,
                         'rpn3_lr_step': ''},
           'ASPECT_GROUPING': True,
           'BATCH_IMAGES': 1,
           'BATCH_ROIS': -1,
           'BATCH_ROIS_OHEM': 128,
           'BBOX_MEANS': [0.0, 0.0, 0.0, 0.0],
           'BBOX_NORMALIZATION_PRECOMPUTED': True,
           'BBOX_REGRESSION_THRESH': 0.5,
           'BBOX_STDS': [0.1, 0.1, 0.2, 0.2],
           'BBOX_WEIGHTS': array([ 1.,  1.,  1.,  1.]),
           'BG_THRESH_HI': 0.5,
           'BG_THRESH_LO': 0.0,
           'CXX_PROPOSAL': False,
           'ENABLE_OHEM': True,
           'END2END': True,
           'FG_FRACTION': 0.25,
           'FG_THRESH': 0.5,
           'FLIP': True,
           'RESUME': True,
           'RPN_BATCH_SIZE': 256,
           'RPN_BBOX_WEIGHTS': [1.0, 1.0, 1.0, 1.0],
           'RPN_CLOBBER_POSITIVES': False,
           'RPN_FG_FRACTION': 0.5,
           'RPN_MIN_SIZE': 0,
           'RPN_NEGATIVE_OVERLAP': 0.3,
           'RPN_NMS_THRESH': 0.7,
           'RPN_POSITIVE_OVERLAP': 0.7,
           'RPN_POSITIVE_WEIGHT': -1.0,
           'RPN_POST_NMS_TOP_N': 300,
           'RPN_PRE_NMS_TOP_N': 6000,
           'SHUFFLE': True,
           'begin_epoch': 5,
           'end_epoch': 8,
           'lr': 0.0005,
           'lr_factor': 0.1,
           'lr_step': '5.333',
           'model_prefix': 'e2e',
           'momentum': 0.9,
           'warmup': False,
           'warmup_lr': 5e-05,
           'warmup_step': 1000,
           'wd': 0.0005},
 'dataset': {'NUM_CLASSES': 81,
             'dataset': 'coco',
             'dataset_path': './data/coco',
             'image_set': 'train2014+val2014',
             'proposal': 'rpn',
             'root_path': './data',
             'test_image_set': 'test-dev2015'},
 'default': {'frequent': 20, 'kvstore': 'device'},
 'gpus': '0',
 'network': {'ANCHOR_RATIOS': [0.5, 1, 2],
             'ANCHOR_SCALES': [4, 8, 16, 32],
             'FIXED_PARAMS': ['conv1',
                              'bn_conv1',
                              'res2',
                              'bn2',
                              'gamma',
                              'beta'],
             'FIXED_PARAMS_SHARED': ['conv1',
                                     'bn_conv1',
                                     'res2',
                                     'bn2',
                                     'res3',
                                     'bn3',
                                     'res4',
                                     'bn4',
                                     'gamma',
                                     'beta'],
             'IMAGE_STRIDE': 0,
             'NUM_ANCHORS': 12,
             'PIXEL_MEANS': array([ 103.06,  115.9 ,  123.15]),
             'RCNN_FEAT_STRIDE': 16,
             'RPN_FEAT_STRIDE': 16,
             'pretrained': './model/pretrained_model/resnet_v1_101',
             'pretrained_epoch': 0},
 'output_path': './output/rfcn',
 'symbol': 'resnet_v1_101_rfcn'}
[14:15:57] /home/travis/build/dmlc/mxnet-distro/mxnet-build/dmlc-core/include/dmlc/logging.h:308: [14:15:57] src/operator/nn/./../tensor/../elemwise_op_common.h:122: Check failed: assign(&dattr, (*vec)[i]) Incompatible attr in node  at 0-th output: expected (7938,1024,1,1), got (2058,1024,1,1)

Stack trace returned 10 entries:
[bt] (0) /home/irashid/anaconda2/lib/python2.7/site-packages/mxnet/libmxnet.so(+0x26a3cc) [0x7f05745b33cc]
[bt] (1) /home/irashid/anaconda2/lib/python2.7/site-packages/mxnet/libmxnet.so(+0x3760e3) [0x7f05746bf0e3]
[bt] (2) /home/irashid/anaconda2/lib/python2.7/site-packages/mxnet/libmxnet.so(+0x3769cb) [0x7f05746bf9cb]
[bt] (3) /home/irashid/anaconda2/lib/python2.7/site-packages/mxnet/libmxnet.so(+0x207cb32) [0x7f05763c5b32]
[bt] (4) /home/irashid/anaconda2/lib/python2.7/site-packages/mxnet/libmxnet.so(+0x20692d9) [0x7f05763b22d9]
[bt] (5) /home/irashid/anaconda2/lib/python2.7/site-packages/mxnet/libmxnet.so(+0x1fbf8b1) [0x7f05763088b1]
[bt] (6) /home/irashid/anaconda2/lib/python2.7/site-packages/mxnet/libmxnet.so(MXImperativeInvokeEx+0x63) [0x7f0576308c53]
[bt] (7) /home/irashid/anaconda2/lib/python2.7/lib-dynload/../../libffi.so.6(ffi_call_unix64+0x4c) [0x7f058f643ec0]
[bt] (8) /home/irashid/anaconda2/lib/python2.7/lib-dynload/../../libffi.so.6(ffi_call+0x22d) [0x7f058f64387d]
[bt] (9) /home/irashid/anaconda2/lib/python2.7/lib-dynload/_ctypes.so(_ctypes_callproc+0x4d6) [0x7f058f859736]

Traceback (most recent call last):
  File "./rfcn/demo.py", line 129, in <module>
    main()
  File "./rfcn/demo.py", line 89, in main
    arg_params=arg_params, aux_params=aux_params)
  File "/home/irashid/Downloads/Deformable-ConvNets-master/rfcn/core/tester.py", line 30, in __init__
    self._mod.init_params(arg_params=arg_params, aux_params=aux_params)
  File "/home/irashid/Downloads/Deformable-ConvNets-master/rfcn/core/module.py", line 789, in init_params
    force_init=force_init)
  File "/home/irashid/Downloads/Deformable-ConvNets-master/rfcn/core/module.py", line 278, in init_params
    _impl(desc, arr, arg_params)
  File "/home/irashid/Downloads/Deformable-ConvNets-master/rfcn/core/module.py", line 266, in _impl
    cache_arr.copyto(arr)
  File "/home/irashid/anaconda2/lib/python2.7/site-packages/mxnet/ndarray/ndarray.py", line 1635, in copyto
    return _internal._copyto(self, out=other)
  File "<string>", line 25, in _copyto
  File "/home/irashid/anaconda2/lib/python2.7/site-packages/mxnet/_ctypes/ndarray.py", line 92, in _imperative_invoke
    ctypes.byref(out_stypes)))
  File "/home/irashid/anaconda2/lib/python2.7/site-packages/mxnet/base.py", line 146, in check_call
    raise MXNetError(py_str(_LIB.MXGetLastError()))
mxnet.base.MXNetError: [14:15:57] src/operator/nn/./../tensor/../elemwise_op_common.h:122: Check failed: assign(&dattr, (*vec)[i]) Incompatible attr in node  at 0-th output: expected (7938,1024,1,1), got (2058,1024,1,1)

Stack trace returned 10 entries:
[bt] (0) /home/irashid/anaconda2/lib/python2.7/site-packages/mxnet/libmxnet.so(+0x26a3cc) [0x7f05745b33cc]
[bt] (1) /home/irashid/anaconda2/lib/python2.7/site-packages/mxnet/libmxnet.so(+0x3760e3) [0x7f05746bf0e3]
[bt] (2) /home/irashid/anaconda2/lib/python2.7/site-packages/mxnet/libmxnet.so(+0x3769cb) [0x7f05746bf9cb]
[bt] (3) /home/irashid/anaconda2/lib/python2.7/site-packages/mxnet/libmxnet.so(+0x207cb32) [0x7f05763c5b32]
[bt] (4) /home/irashid/anaconda2/lib/python2.7/site-packages/mxnet/libmxnet.so(+0x20692d9) [0x7f05763b22d9]
[bt] (5) /home/irashid/anaconda2/lib/python2.7/site-packages/mxnet/libmxnet.so(+0x1fbf8b1) [0x7f05763088b1]
[bt] (6) /home/irashid/anaconda2/lib/python2.7/site-packages/mxnet/libmxnet.so(MXImperativeInvokeEx+0x63) [0x7f0576308c53]
[bt] (7) /home/irashid/anaconda2/lib/python2.7/lib-dynload/../../libffi.so.6(ffi_call_unix64+0x4c) [0x7f058f643ec0]
[bt] (8) /home/irashid/anaconda2/lib/python2.7/lib-dynload/../../libffi.so.6(ffi_call+0x22d) [0x7f058f64387d]
[bt] (9) /home/irashid/anaconda2/lib/python2.7/lib-dynload/_ctypes.so(_ctypes_callproc+0x4d6) [0x7f058f859736]
arunbuduri commented 6 years ago

@imrandatascientist I got this error in the past too. This means that in demo.py, the yaml config file, the symbol file and the params file do not match. If you use the right yaml file, this should go away.

maruitao commented 6 years ago

pip install opencv-python==3.2.0.6 pip install easydict == 1.6

Karthik-Suresh93 commented 6 years ago

@arunbuduri @maruitao @imrandatascientist @YuwenXiong Could you please elaborate? I too am getting a similar error while running fpn.

Error in CustomOp.forward: Traceback (most recent call last): File "/home/k21993/visdrone_mxnet/local/lib/python2.7/site-packages/mxnet/operator.py", line 782, in forward_entry aux=tensors[4]) File "experiments/fpn/../../fpn/operator_py/fpn_roi_pooling.py", line 88, in forward self.assign(out_data[0], req[0], roi_pool) File "/home/k21993/visdrone_mxnet/local/lib/python2.7/site-packages/mxnet/operator.py", line 455, in assign dst[:] = src File "/home/k21993/visdrone_mxnet/local/lib/python2.7/site-packages/mxnet/ndarray/ndarray.py", line 405, in setitem value.copyto(self) File "/home/k21993/visdrone_mxnet/local/lib/python2.7/site-packages/mxnet/ndarray/ndarray.py", line 1635, in copyto return _internal._copyto(self, out=other) File "", line 25, in _copyto File "/home/k21993/visdrone_mxnet/local/lib/python2.7/site-packages/mxnet/_ctypes/ndarray.py", line 92, in _imperative_invoke ctypes.byref(out_stypes))) File "/home/k21993/visdrone_mxnet/local/lib/python2.7/site-packages/mxnet/base.py", line 146, in check_call raise MXNetError(py_str(_LIB.MXGetLastError())) MXNetError: [20:35:33] src/operator/nn/./../tensor/../elemwise_op_common.h:122: Check failed: assign(&dattr, (*vec)[i]) Incompatible attr in node at 0-th output: expected (2070,256,7,7), got (2072,256,7,7)

Please help me with this error