I am trying caffe2+Detectron in Windows. After successfully building caffe2 (with CUDA, cuDNN, OpenCV), COCOAPI and Detectron modules, I ran the tools/train_net.py
script in Detectron, trying to train Faster R-CNN on Pascal VOC.
I have modified import_detectron_ops()
in detectron/utils/c2.py
to use my caffe2_detectron_ops_gpu.dll
path.
I have added the following path with sys.path.insert(0, path)
(in tools/train_net.py
).
- pytorch build directory
- detectron root directory
- COCOAPI PythonAPI directory
I have added the following path to my PATH
variable.
- cuDNN bin directory
- pytorch build bin directory (
pytorch/build/bin/Release
), which containscaffe2_detectron_ops_gpu.dll
- OpenCV bin directory
With all these prepared, I was hoping I could successfully train Faster R-CNN using Detectron. It seemed to have succeeded in all import
commands. But it then resulted in the following error:
...
File "D:/repo/github/Detectron_facebookresearch\detectron\utils\train.py", line 53, in train_model
model, weights_file, start_iter, checkpoints, output_dir = create_model()
File "D:/repo/github/Detectron_facebookresearch\detectron\utils\train.py", line 132, in create_model
model = model_builder.create(cfg.MODEL.TYPE, train=True)
File "D:/repo/github/Detectron_facebookresearch\detectron\modeling\model_builder.py", line 124, in create
return get_func(model_type_func)(model)
File "D:/repo/github/Detectron_facebookresearch\detectron\modeling\model_builder.py", line 89, in generalized_rcnn
freeze_conv_body=cfg.TRAIN.FREEZE_CONV_BODY
File "D:/repo/github/Detectron_facebookresearch\detectron\modeling\model_builder.py", line 229, in build_generic_detection_model
optim.build_data_parallel_model(model, _single_gpu_build_func)
File "D:/repo/github/Detectron_facebookresearch\detectron\modeling\optimizer.py", line 40, in build_data_parallel_model
all_loss_gradients = _build_forward_graph(model, single_gpu_build_func)
File "D:/repo/github/Detectron_facebookresearch\detectron\modeling\optimizer.py", line 63, in _build_forward_graph
all_loss_gradients.update(single_gpu_build_func(model))
File "D:/repo/github/Detectron_facebookresearch\detectron\modeling\model_builder.py", line 169, in _single_gpu_build_func
blob_conv, dim_conv, spatial_scale_conv = add_conv_body_func(model)
File "D:/repo/github/Detectron_facebookresearch\detectron\modeling\ResNet.py", line 36, in add_ResNet50_conv4_body
return add_ResNet_convX_body(model, (3, 4, 6))
File "D:/repo/github/Detectron_facebookresearch\detectron\modeling\ResNet.py", line 98, in add_ResNet_convX_body
p, dim_in = globals()[cfg.RESNETS.STEM_FUNC](model, 'data')
File "D:/repo/github/Detectron_facebookresearch\detectron\modeling\ResNet.py", line 252, in basic_bn_stem
p = model.AffineChannel(p, 'res_conv1_bn', dim=dim, inplace=True)
File "D:/repo/github/Detectron_facebookresearch\detectron\modeling\detector.py", line 103, in AffineChannel
return self.net.AffineChannel([blob_in, scale, bias], blob_in)
File "D:/repo/github/pytorch/build\caffe2\python\core.py", line 2067, in __getattr__
",".join(workspace.C.nearby_opnames(op_type)) + ']'
AttributeError: Method AffineChannel is not a registered operator. Did you mean: []
I have checked out issue #320, and ensured that there is c2_utils.import_detectron_ops()
, which should have imported the Detectron operators.
My system information is as follows:
- Operating system: Windows 10 Home Edition
- Compiler version: VS 2015
- CUDA version: 8.0
- cuDNN version: cudnn-8.0-windows10-x64-v7
- NVIDIA driver version: 382.05
- GPU models (for all devices if they are not all the same): (GTX 1050)
-
PYTHONPATH
environment variable: (sys.path.insert()
is used instead as described above) -
python --version
output: Python 2.7.12 :: Anaconda custom (64-bit) - Anything else that seems relevant: OpenCV 3.2.0-vc14