msracver / Deformable-ConvNets

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

I change the code for cpu-mode implementation of Deformable Convnets #114

Open mawangyi opened 6 years ago

mawangyi commented 6 years ago

Deformable-ConvNets is Cool, i need implementation it in cpu-mode。 so, i change the code: Replace GPU with CPU nms = cpu_nms_wrapper(config.TEST.NMS) context=[mx.cpu()]

now, i got an error: <NDArray 300x5 @cpu(0)> -------------DataParallelExecutorGroup--outputs---380---------------

/Users/solomin/Deformable-ConvNets/faster_rcnn/core/DataParallelExecutorGroup.py(387)get_outputs() -> print self.execs[0].outputs[1] (Pdb) [11:31:27] /Users/solomin/mxnet/dmlc-core/include/dmlc/logging.h:308: [11:31:27] src/operator/contrib/./nn/deformable_im2col.h:94: not implemented

the problem at “DataParallelExecutorGroup.py(387)get_outputs()” cpu can get “self.execs[0].outputs[1]”

anyone know how to Solve it???

Thanks a lot!

-------------DataParallelExecutorGroup--outputs---380---------------
> /Users/solomin/Deformable-ConvNets/faster_rcnn/core/DataParallelExecutorGroup.py(387)get_outputs()
-> print self.execs[0].outputs[1]
(Pdb) [11:31:27] /Users/solomin/mxnet/dmlc-core/include/dmlc/logging.h:308: [11:31:27] src/operator/contrib/./nn/deformable_im2col.h:94: not implemented

Stack trace returned 10 entries:
[bt] (0) 0   libmxnet.so                         0x0000000118614529 _ZN4dmlc15LogMessageFatalD2Ev + 41
[bt] (1) 1   libmxnet.so                         0x000000011863b9fc _ZN5mxnet2op17deformable_im2colIfEEvPN7mshadow6StreamINS2_3cpuEEEPKT_S9_RKN4nnvm6TShapeESD_SD_SD_SD_SD_jPS7_ + 140
[bt] (2) 2   libmxnet.so                         0x0000000118638702 _ZN5mxnet2op23DeformableConvolutionOpIN7mshadow3cpuEfE7ForwardERKNS_9OpContextERKNSt3__16vectorINS_5TBlobENS8_9allocatorISA_EEEERKNS9_INS_9OpReqTypeENSB_ISG_EEEESF_SF_ + 2002
[bt] (3) 3   libmxnet.so                         0x00000001199c619a _ZN5mxnet2op13OperatorState7ForwardERKNS_9OpContextERKNSt3__16vectorINS_5TBlobENS5_9allocatorIS7_EEEERKNS6_INS_9OpReqTypeENS8_ISD_EEEESC_ + 2042
[bt] (4) 4   libmxnet.so                         0x000000011984130c _ZN5mxnet4exec23StatefulComputeExecutor3RunENS_10RunContextEb + 108
[bt] (5) 5   libmxnet.so                         0x000000011986a625 _ZNSt3__110__function6__funcIZN5mxnet4exec13GraphExecutor18CreateCachedSegOprEmmE3$_6NS_9allocatorIS5_EEFvNS2_10RunContextENS2_6engine18CallbackOnCompleteEEEclEOS8_OSA_ + 117
[bt] (6) 6   libmxnet.so                         0x00000001198320cf _ZN5mxnet6engine14ThreadedEngine15ExecuteOprBlockENS_10RunContextEPNS0_8OprBlockE + 255
[bt] (7) 7   libmxnet.so                         0x00000001198360f1 _ZNSt3__110__function6__funcIZZN5mxnet6engine23ThreadedEnginePerDevice13PushToExecuteEPNS3_8OprBlockEbENKUlvE_clEvEUlvE_NS_9allocatorIS8_EEFvvEEclEv + 65
[bt] (8) 8   libmxnet.so                         0x0000000119832933 _ZNSt3__114__thread_proxyINS_5tupleIJNS_10unique_ptrINS_15__thread_structENS_14default_deleteIS3_EEEENS_8functionIFvvEEEEEEEEPvSB_ + 51
[bt] (9) 9   libsystem_pthread.dylib             0x00007fff9c79499d _pthread_body + 131

[11:31:27] /Users/solomin/mxnet/dmlc-core/include/dmlc/logging.h:308: [11:31:27] src/engine/./threaded_engine.h:370: [11:31:27] src/operator/contrib/./nn/deformable_im2col.h:94: not implemented

Stack trace returned 10 entries:
[bt] (0) 0   libmxnet.so                         0x0000000118614529 _ZN4dmlc15LogMessageFatalD2Ev + 41
[bt] (1) 1   libmxnet.so                         0x000000011863b9fc _ZN5mxnet2op17deformable_im2colIfEEvPN7mshadow6StreamINS2_3cpuEEEPKT_S9_RKN4nnvm6TShapeESD_SD_SD_SD_SD_jPS7_ + 140
[bt] (2) 2   libmxnet.so                         0x0000000118638702 _ZN5mxnet2op23DeformableConvolutionOpIN7mshadow3cpuEfE7ForwardERKNS_9OpContextERKNSt3__16vectorINS_5TBlobENS8_9allocatorISA_EEEERKNS9_INS_9OpReqTypeENSB_ISG_EEEESF_SF_ + 2002
[bt] (3) 3   libmxnet.so                         0x00000001199c619a _ZN5mxnet2op13OperatorState7ForwardERKNS_9OpContextERKNSt3__16vectorINS_5TBlobENS5_9allocatorIS7_EEEERKNS6_INS_9OpReqTypeENS8_ISD_EEEESC_ + 2042
[bt] (4) 4   libmxnet.so                         0x000000011984130c _ZN5mxnet4exec23StatefulComputeExecutor3RunENS_10RunContextEb + 108
[bt] (5) 5   libmxnet.so                         0x000000011986a625 _ZNSt3__110__function6__funcIZN5mxnet4exec13GraphExecutor18CreateCachedSegOprEmmE3$_6NS_9allocatorIS5_EEFvNS2_10RunContextENS2_6engine18CallbackOnCompleteEEEclEOS8_OSA_ + 117
[bt] (6) 6   libmxnet.so                         0x00000001198320cf _ZN5mxnet6engine14ThreadedEngine15ExecuteOprBlockENS_10RunContextEPNS0_8OprBlockE + 255
[bt] (7) 7   libmxnet.so                         0x00000001198360f1 _ZNSt3__110__function6__funcIZZN5mxnet6engine23ThreadedEnginePerDevice13PushToExecuteEPNS3_8OprBlockEbENKUlvE_clEvEUlvE_NS_9allocatorIS8_EEFvvEEclEv + 65
[bt] (8) 8   libmxnet.so                         0x0000000119832933 _ZNSt3__114__thread_proxyINS_5tupleIJNS_10unique_ptrINS_15__thread_structENS_14default_deleteIS3_EEEENS_8functionIFvvEEEEEEEEPvSB_ + 51
[bt] (9) 9   libsystem_pthread.dylib             0x00007fff9c79499d _pthread_body + 131

A fatal error occurred in asynchronous engine operation. If you do not know what caused this error, you can try set environment variable MXNET_ENGINE_TYPE to NaiveEngine and run with debugger (i.e. gdb). This will force all operations to be synchronous and backtrace will give you the series of calls that lead to this error. Remember to set MXNET_ENGINE_TYPE back to empty after debugging.

Stack trace returned 7 entries:
[bt] (0) 0   libmxnet.so                         0x0000000118614529 _ZN4dmlc15LogMessageFatalD2Ev + 41
[bt] (1) 1   libmxnet.so                         0x0000000119832463 _ZN5mxnet6engine14ThreadedEngine15ExecuteOprBlockENS_10RunContextEPNS0_8OprBlockE + 1171
[bt] (2) 2   libmxnet.so                         0x00000001198360f1 _ZNSt3__110__function6__funcIZZN5mxnet6engine23ThreadedEnginePerDevice13PushToExecuteEPNS3_8OprBlockEbENKUlvE_clEvEUlvE_NS_9allocatorIS8_EEFvvEEclEv + 65
[bt] (3) 3   libmxnet.so                         0x0000000119832933 _ZNSt3__114__thread_proxyINS_5tupleIJNS_10unique_ptrINS_15__thread_structENS_14default_deleteIS3_EEEENS_8functionIFvvEEEEEEEEPvSB_ + 51
[bt] (4) 4   libsystem_pthread.dylib             0x00007fff9c79499d _pthread_body + 131
[bt] (5) 5   libsystem_pthread.dylib             0x00007fff9c79491a _pthread_body + 0
[bt] (6) 6   libsystem_pthread.dylib             0x00007fff9c792351 thread_start + 13

libc++abi.dylib: terminating with uncaught exception of type dmlc::Error: [11:31:27] src/engine/./threaded_engine.h:370: [11:31:27] src/operator/contrib/./nn/deformable_im2col.h:94: not implemented

Stack trace returned 10 entries:
[bt] (0) 0   libmxnet.so                         0x0000000118614529 _ZN4dmlc15LogMessageFatalD2Ev + 41
[bt] (1) 1   libmxnet.so                         0x000000011863b9fc _ZN5mxnet2op17deformable_im2colIfEEvPN7mshadow6StreamINS2_3cpuEEEPKT_S9_RKN4nnvm6TShapeESD_SD_SD_SD_SD_jPS7_ + 140
[bt] (2) 2   libmxnet.so                         0x0000000118638702 _ZN5mxnet2op23DeformableConvolutionOpIN7mshadow3cpuEfE7ForwardERKNS_9OpContextERKNSt3__16vectorINS_5TBlobENS8_9allocatorISA_EEEERKNS9_INS_9OpReqTypeENSB_ISG_EEEESF_SF_ + 2002
[bt] (3) 3   libmxnet.so                         0x00000001199c619a _ZN5mxnet2op13OperatorState7ForwardERKNS_9OpContextERKNSt3__16vectorINS_5TBlobENS5_9allocatorIS7_EEEERKNS6_INS_9OpReqTypeENS8_ISD_EEEESC_ + 2042
[bt] (4) 4   libmxnet.so                         0x000000011984130c _ZN5mxnet4exec23StatefulComputeExecutor3RunENS_10RunContextEb + 108
[bt] (5) 5   libmxnet.so                         0x000000011986a625 _ZNSt3__110__function6__funcIZN5mxnet4exec13GraphExecutor18CreateCachedSegOprEmmE3$_6NS_9allocatorIS5_EEFvNS2_10RunContextENS2_6engine18CallbackOnCompleteEEEclEOS8_OSA_ + 117
[bt] (6) 6   libmxnet.so                         0x00000001198320cf _ZN5mxnet6engine14ThreadedEngine15ExecuteOprBlockENS_10RunContextEPNS0_8OprBlockE + 255
[bt] (7) 7   libmxnet.so                         0x00000001198360f1 _ZNSt3__110__function6__funcIZZN5mxnet6engine23ThreadedEnginePerDevice13PushToExecuteEPNS3_8OprBlockEbENKUlvE_clEvEUlvE_NS_9allocatorIS8_EEFvvEEclEv + 65
[bt] (8) 8   libmxnet.so                         0x0000000119832933 _ZNSt3__114__thread_proxyINS_5tupleIJNS_10unique_ptrINS_15__thread_structENS_14default_deleteIS3_EEEENS_8functionIFvvEEEEEEEEPvSB_ + 51
[bt] (9) 9   libsystem_pthread.dylib             0x00007fff9c79499d _pthread_body + 131

A fatal error occurred in asynchronous engine operation. If you do not know what caused this error, you can try set environment variable MXNET_ENGINE_TYPE to NaiveEngine and run with debugger (i.e. gdb). This will force all operations to be synchronous and backtrace will give you the series of calls that lead to this error. Remember to set MXNET_ENGINE_TYPE back to empty after debugging.

Stack trace returned 7 entries:
[bt] (0) 0   libmxnet.so                         0x0000000118614529 _ZN4dmlc15LogMessageFatalD2Ev + 41
[bt] (1) 1   libmxnet.so                         0x0000000119832463 _ZN5mxnet6engine14ThreadedEngine15ExecuteOprBlockENS_10RunContextEPNS0_8OprBlockE + 1171
[bt] (2) 2   libmxnet.so                         0x00000001198360f1 _ZNSt3__110__function6__funcIZZN5mxnet6engine23ThreadedEnginePerDevice13PushToExecuteEPNS3_8OprBlockEbENKUlvE_clEvEUlvE_NS_9allocatorIS8_EEFvvEEclEv + 65
[bt] (3) 3   libmxnet.so                         0x0000000119832933 _ZNSt3__114__thread_proxyINS_5tupleIJNS_10unique_ptrINS_15__thread_structENS_14default_deleteIS3_EEEENS_8functionIFvvEEEEEEEEPvSB_ + 51
[bt] (4) 4   libsystem_pthread.dylib             0x00007fff9c79499d _pthread_body + 131
[bt] (5) 5   libsystem_pthread.dylib             0x00007fff9c79491a _pthread_body + 0
[bt] (6) 6   libsystem_pthread.dylib             0x00007fff9c792351 thread_start + 13

Abort trap: 6
YuwenXiong commented 6 years ago

Current Deformable Convolution doesn't contain a CPU implementation.

mawangyi commented 6 years ago

@YuwenXiong thank you! if i want to implementation it use cpu,what i should to do?

arunbuduri commented 6 years ago

@mawangyi I implemented the CPU version and have it running well.

For CPU based inference, res101 network takes 2-3 secs for a 800x450 resolution image. I just tested res50 that takes just 1.5 secs for the same 800x450 image. GPU-mode is typically 10 times faster than CPU.

Email me at arun.buduri@gmail.com and I can give you the CPU implementation. I fully don't know the process of submitting the code into mxnet repo (yet) but once I figure that out, I'd love to get that into everyone's hands.

mawangyi commented 6 years ago

@arunbuduri ,Thanks for the kindly reply! Could you please give me the CPU implementation code ? my email is mawangyi@163.com, Thanks&Best Regards!

arunbuduri commented 6 years ago

Really sorry for the long delay in getting this information to you all.

I have captured the steps (along with the necessary source code) here - https://drive.google.com/open?id=1P8vYr9ekWp3NK8_N2bs8sl7jRT39m25I

I have tested this on Windows, Mac, Linux, and Ubuntu.

Please let me know if you have any questions.