Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: Not implemented on the CPU #546

Open
MorningBanana opened this issue May 14, 2019 · 5 comments
Open

RuntimeError: Not implemented on the CPU #546

MorningBanana opened this issue May 14, 2019 · 5 comments

Comments

@MorningBanana
Copy link

when I'm trying to run the file trainval_net, it returns an error: "RuntimeError: Not implemented on the CPU (ROIAlign_backward at /home/qxf/Documents/faster-rcnn.pytorch-pytorch-1.0/lib/model/csrc/ROIAlign.h:44)", what can I do to deal with this? Thanks a lot!

The whole outputs are as follow:
Loading pretrained weights from data/pretrained_model/resnet101_caffe.pth
Traceback (most recent call last):
File "/home/qxf/Documents/faster-rcnn.pytorch-pytorch-1.0/trainval_net.py", line 329, in
loss.backward()
File "/home/qxf/PT1.0/local/lib/python2.7/site-packages/torch/tensor.py", line 102, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph)
File "/home/qxf/PT1.0/local/lib/python2.7/site-packages/torch/autograd/init.py", line 90, in backward
allow_unreachable=True) # allow_unreachable flag
File "/home/qxf/PT1.0/local/lib/python2.7/site-packages/torch/autograd/function.py", line 76, in apply
return self._forward_cls.backward(self, *args)
File "/home/qxf/PT1.0/local/lib/python2.7/site-packages/torch/autograd/function.py", line 188, in wrapper
outputs = fn(ctx, args)
File "/home/qxf/Documents/faster-rcnn.pytorch-pytorch-1.0/lib/model/roi_layers/roi_align.py", line 41, in backward
sampling_ratio,
RuntimeError: Not implemented on the CPU (ROIAlign_backward at /home/qxf/Documents/faster-rcnn.pytorch-pytorch-1.0/lib/model/csrc/ROIAlign.h:44)
frame #0: std::function<std::string ()>::operator()() const + 0x11 (0x7f2000662fe1 in /home/qxf/PT1.0/local/lib/python2.7/site-packages/torch/lib/libc10.so)
frame #1: c10::Error::Error(c10::SourceLocation, std::string const&) + 0x2a (0x7f2000662dfa in /home/qxf/PT1.0/local/lib/python2.7/site-packages/torch/lib/libc10.so)
frame #2: ROIAlign_backward(at::Tensor const&, at::Tensor const&, float, int, int, int, int, int, int, int) + 0xfe (0x7f20543016ae in /home/qxf/Documents/faster-rcnn.pytorch-pytorch-1.0/lib/model/_C.so)
frame #3: + 0x1657f (0x7f205430e57f in /home/qxf/Documents/faster-rcnn.pytorch-pytorch-1.0/lib/model/_C.so)
frame #4: + 0x1667e (0x7f205430e67e in /home/qxf/Documents/faster-rcnn.pytorch-pytorch-1.0/lib/model/_C.so)
frame #5: + 0x12b32 (0x7f205430ab32 in /home/qxf/Documents/faster-rcnn.pytorch-pytorch-1.0/lib/model/_C.so)
frame #6: PyEval_EvalFrameEx + 0x5ca (0x4bc4aa in /home/qxf/PT1.0/bin/python)
frame #7: PyEval_EvalCodeEx + 0x306 (0x4b9b66 in /home/qxf/PT1.0/bin/python)
frame #8: /home/qxf/PT1.0/bin/python() [0x4d5669]
frame #9: PyObject_Call + 0x3e (0x4a587e in /home/qxf/PT1.0/bin/python)
frame #10: PyEval_EvalFrameEx + 0x263e (0x4be51e in /home/qxf/PT1.0/bin/python)
frame #11: PyEval_EvalCodeEx + 0x306 (0x4b9b66 in /home/qxf/PT1.0/bin/python)
frame #12: /home/qxf/PT1.0/bin/python() [0x4d5669]
frame #13: PyObject_Call + 0x3e (0x4a587e in /home/qxf/PT1.0/bin/python)
frame #14: PyEval_EvalFrameEx + 0x263e (0x4be51e in /home/qxf/PT1.0/bin/python)
frame #15: PyEval_EvalCodeEx + 0x306 (0x4b9b66 in /home/qxf/PT1.0/bin/python)
frame #16: /home/qxf/PT1.0/bin/python() [0x4d5669]
frame #17: /home/qxf/PT1.0/bin/python() [0x4eef5e]
frame #18: PyObject_Call + 0x3e (0x4a587e in /home/qxf/PT1.0/bin/python)
frame #19: PyEval_CallObjectWithKeywords + 0x30 (0x4c5ef0 in /home/qxf/PT1.0/bin/python)
frame #20: torch::autograd::PyFunction::apply(std::vector<torch::autograd::Variable, std::allocatortorch::autograd::Variable >&&) + 0x193 (0x7f203a992883 in /home/qxf/PT1.0/local/lib/python2.7/site-packages/torch/lib/libtorch_python.so)
frame #21: torch::autograd::Engine::evaluate_function(torch::autograd::FunctionTask&) + 0x39e (0x7f1ffeff941e in /home/qxf/PT1.0/local/lib/python2.7/site-packages/torch/lib/libtorch.so.1)
frame #22: torch::autograd::Engine::thread_main(torch::autograd::GraphTask
) + 0xc0 (0x7f1ffeffb580 in /home/qxf/PT1.0/local/lib/python2.7/site-packages/torch/lib/libtorch.so.1)
frame #23: torch::autograd::Engine::thread_init(int) + 0xc7 (0x7f1ffeff7e57 in /home/qxf/PT1.0/local/lib/python2.7/site-packages/torch/lib/libtorch.so.1)
frame #24: torch::autograd::python::PythonEngine::thread_init(int) + 0x2a (0x7f203a98d31a in /home/qxf/PT1.0/local/lib/python2.7/site-packages/torch/lib/libtorch_python.so)
frame #25: + 0xb8c80 (0x7f204f44ac80 in /usr/lib/x86_64-linux-gnu/libstdc++.so.6)
frame #26: + 0x76ba (0x7f2053fc06ba in /lib/x86_64-linux-gnu/libpthread.so.0)
frame #27: clone + 0x6d (0x7f2053cf641d in /lib/x86_64-linux-gnu/libc.so.6)

@sectionzzz
Copy link

sectionzzz commented May 29, 2019

Just run with CUDA simply then it solves:
python trainval_net.py --cuda

@lpc777
Copy link

lpc777 commented Jun 28, 2019

it works, thank you very much

@VeenaUpendran
Copy link

File "C:\Veena\faster-rcnn.pytorch\lib\model\roi_layers\roi_align.py", line 41, in backward
sampling_ratio,
RuntimeError: Not implemented on the CPU

I am facing this issue

@VeenaUpendran
Copy link

$ python trainval_net.py
Called with args:
Namespace(batch_size=1, checkepoch=1, checkpoint=0, checkpoint_interval=10000, checksession=1, class_agnostic=False, cuda=False, dataset='pascal_voc', disp_interval=100, large_scale=False, lr=0.001, lr_decay_gamma=0.1, lr_decay_step=5, mGPUs=False, max_epochs=20, net='vgg16', num_workers=0, optimizer='sgd', resume=False, save_dir='models', session=1, start_epoch=1, use_tfboard=False)
C:\Veena\faster-rcnn.pytorch\lib\model\utils\config.py:374: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
yaml_cfg = edict(yaml.load(f))
Using config:
{'ANCHOR_RATIOS': [0.5, 1, 2],
'ANCHOR_SCALES': [8, 16, 32],
'CROP_RESIZE_WITH_MAX_POOL': False,
'CUDA': False,
'DATA_DIR': 'C:\Veena\faster-rcnn.pytorch\data',
'DEDUP_BOXES': 0.0625,
'EPS': 1e-14,
'EXP_DIR': 'vgg16',
'FEAT_STRIDE': [16],
'GPU_ID': 0,
'MATLAB': 'matlab',
'MAX_NUM_GT_BOXES': 20,
'MOBILENET': {'DEPTH_MULTIPLIER': 1.0,
'FIXED_LAYERS': 5,
'REGU_DEPTH': False,
'WEIGHT_DECAY': 4e-05},
'PIXEL_MEANS': array([[[102.9801, 115.9465, 122.7717]]]),
'POOLING_MODE': 'align',
'POOLING_SIZE': 7,
'RESNET': {'FIXED_BLOCKS': 1, 'MAX_POOL': False},
'RNG_SEED': 3,
'ROOT_DIR': 'C:\Veena\faster-rcnn.pytorch',
'TEST': {'BBOX_REG': True,
'HAS_RPN': True,
'MAX_SIZE': 1000,
'MODE': 'nms',
'NMS': 0.3,
'PROPOSAL_METHOD': 'gt',
'RPN_MIN_SIZE': 16,
'RPN_NMS_THRESH': 0.7,
'RPN_POST_NMS_TOP_N': 300,
'RPN_PRE_NMS_TOP_N': 6000,
'RPN_TOP_N': 5000,
'SCALES': [600],
'SVM': False},
'TRAIN': {'ASPECT_GROUPING': False,
'BATCH_SIZE': 256,
'BBOX_INSIDE_WEIGHTS': [1.0, 1.0, 1.0, 1.0],
'BBOX_NORMALIZE_MEANS': [0.0, 0.0, 0.0, 0.0],
'BBOX_NORMALIZE_STDS': [0.1, 0.1, 0.2, 0.2],
'BBOX_NORMALIZE_TARGETS': True,
'BBOX_NORMALIZE_TARGETS_PRECOMPUTED': True,
'BBOX_REG': True,
'BBOX_THRESH': 0.5,
'BG_THRESH_HI': 0.5,
'BG_THRESH_LO': 0.0,
'BIAS_DECAY': False,
'BN_TRAIN': False,
'DISPLAY': 10,
'DOUBLE_BIAS': True,
'FG_FRACTION': 0.25,
'FG_THRESH': 0.5,
'GAMMA': 0.1,
'HAS_RPN': True,
'IMS_PER_BATCH': 1,
'LEARNING_RATE': 0.01,
'MAX_SIZE': 1000,
'MOMENTUM': 0.9,
'PROPOSAL_METHOD': 'gt',
'RPN_BATCHSIZE': 256,
'RPN_BBOX_INSIDE_WEIGHTS': [1.0, 1.0, 1.0, 1.0],
'RPN_CLOBBER_POSITIVES': False,
'RPN_FG_FRACTION': 0.5,
'RPN_MIN_SIZE': 8,
'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': 2000,
'RPN_PRE_NMS_TOP_N': 12000,
'SCALES': [600],
'SNAPSHOT_ITERS': 5000,
'SNAPSHOT_KEPT': 3,
'SNAPSHOT_PREFIX': 'res101_faster_rcnn',
'STEPSIZE': [30000],
'SUMMARY_INTERVAL': 180,
'TRIM_HEIGHT': 600,
'TRIM_WIDTH': 600,
'TRUNCATED': False,
'USE_ALL_GT': True,
'USE_FLIPPED': True,
'USE_GT': False,
'WEIGHT_DECAY': 0.0005},
'USE_GPU_NMS': True}
Loaded dataset voc_2007_trainval for training
Set proposal method: gt
Appending horizontally-flipped training examples...
voc_2007_trainval gt roidb loaded from C:\Veena\faster-rcnn.pytorch\data\cache\voc_2007_trainval_gt_roidb.pkl
done
Preparing training data...
done
before filtering, there are 10022 images...
after filtering, there are 10022 images...
10022 roidb entries
Loading pretrained weights from data/pretrained_model/vgg16_caffe.pth
Traceback (most recent call last):
File "trainval_net.py", line 329, in
loss.backward()
File "C:\Users\arjun\AppData\Local\Programs\Python\Python37\lib\site-packages\torch_tensor.py", line 489, in backward
self, gradient, retain_graph, create_graph, inputs=inputs
File "C:\Users\arjun\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\autograd_init_.py", line 199, in backward
allow_unreachable=True, accumulate_grad=True) # Calls into the C++ engine to run the backward pass
File "C:\Users\arjun\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\autograd\function.py", line 267, in apply
return user_fn(self, *args)
File "C:\Users\arjun\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\autograd\function.py", line 414, in wrapper
outputs = fn(ctx, *args)
File "C:\Veena\faster-rcnn.pytorch\lib\model\roi_layers\roi_align.py", line 41, in backward
sampling_ratio,
RuntimeError: Not implemented on the CPU

arjun@LAPTOP-B7JENB0H MINGW64 /c/Veena/faster-rcnn.pytorch (pytorch-1.0)
$ python trainval_net.py
Called with args:
Namespace(batch_size=1, checkepoch=1, checkpoint=0, checkpoint_interval=10000, checksession=1, class_agnostic=False, cuda=False, dataset='pascal_voc', disp_interval=100, large_scale=False, lr=0.001, lr_decay_gamma=0.1, lr_decay_step=5, mGPUs=False, max_epochs=20, net='vgg16', num_workers=0, optimizer='sgd', resume=False, save_dir='models', session=1, start_epoch=1, use_tfboard=False)
C:\Veena\faster-rcnn.pytorch\lib\model\utils\config.py:374: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
yaml_cfg = edict(yaml.load(f))
Using config:
{'ANCHOR_RATIOS': [0.5, 1, 2],
'ANCHOR_SCALES': [8, 16, 32],
'CROP_RESIZE_WITH_MAX_POOL': False,
'CUDA': False,
'DATA_DIR': 'C:\Veena\faster-rcnn.pytorch\data',
'DEDUP_BOXES': 0.0625,
'EPS': 1e-14,
'EXP_DIR': 'vgg16',
'FEAT_STRIDE': [16],
'GPU_ID': 0,
'MATLAB': 'matlab',
'MAX_NUM_GT_BOXES': 20,
'MOBILENET': {'DEPTH_MULTIPLIER': 1.0,
'FIXED_LAYERS': 5,
'REGU_DEPTH': False,
'WEIGHT_DECAY': 4e-05},
'PIXEL_MEANS': array([[[102.9801, 115.9465, 122.7717]]]),
'POOLING_MODE': 'align',
'POOLING_SIZE': 7,
'RESNET': {'FIXED_BLOCKS': 1, 'MAX_POOL': False},
'RNG_SEED': 3,
'ROOT_DIR': 'C:\Veena\faster-rcnn.pytorch',
'TEST': {'BBOX_REG': True,
'HAS_RPN': True,
'MAX_SIZE': 1000,
'MODE': 'nms',
'NMS': 0.3,
'PROPOSAL_METHOD': 'gt',
'RPN_MIN_SIZE': 16,
'RPN_NMS_THRESH': 0.7,
'RPN_POST_NMS_TOP_N': 300,
'RPN_PRE_NMS_TOP_N': 6000,
'RPN_TOP_N': 5000,
'SCALES': [600],
'SVM': False},
'TRAIN': {'ASPECT_GROUPING': False,
'BATCH_SIZE': 256,
'BBOX_INSIDE_WEIGHTS': [1.0, 1.0, 1.0, 1.0],
'BBOX_NORMALIZE_MEANS': [0.0, 0.0, 0.0, 0.0],
'BBOX_NORMALIZE_STDS': [0.1, 0.1, 0.2, 0.2],
'BBOX_NORMALIZE_TARGETS': True,
'BBOX_NORMALIZE_TARGETS_PRECOMPUTED': True,
'BBOX_REG': True,
'BBOX_THRESH': 0.5,
'BG_THRESH_HI': 0.5,
'BG_THRESH_LO': 0.0,
'BIAS_DECAY': False,
'BN_TRAIN': False,
'DISPLAY': 10,
'DOUBLE_BIAS': True,
'FG_FRACTION': 0.25,
'FG_THRESH': 0.5,
'GAMMA': 0.1,
'HAS_RPN': True,
'IMS_PER_BATCH': 1,
'LEARNING_RATE': 0.01,
'MAX_SIZE': 1000,
'MOMENTUM': 0.9,
'PROPOSAL_METHOD': 'gt',
'RPN_BATCHSIZE': 256,
'RPN_BBOX_INSIDE_WEIGHTS': [1.0, 1.0, 1.0, 1.0],
'RPN_CLOBBER_POSITIVES': False,
'RPN_FG_FRACTION': 0.5,
'RPN_MIN_SIZE': 8,
'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': 2000,
'RPN_PRE_NMS_TOP_N': 12000,
'SCALES': [600],
'SNAPSHOT_ITERS': 5000,
'SNAPSHOT_KEPT': 3,
'SNAPSHOT_PREFIX': 'res101_faster_rcnn',
'STEPSIZE': [30000],
'SUMMARY_INTERVAL': 180,
'TRIM_HEIGHT': 600,
'TRIM_WIDTH': 600,
'TRUNCATED': False,
'USE_ALL_GT': True,
'USE_FLIPPED': True,
'USE_GT': False,
'WEIGHT_DECAY': 0.0005},
'USE_GPU_NMS': True}
Loaded dataset voc_2007_trainval for training
Set proposal method: gt
Appending horizontally-flipped training examples...
voc_2007_trainval gt roidb loaded from C:\Veena\faster-rcnn.pytorch\data\cache\voc_2007_trainval_gt_roidb.pkl
done
Preparing training data...
done
before filtering, there are 10022 images...
after filtering, there are 10022 images...
10022 roidb entries
Loading pretrained weights from data/pretrained_model/vgg16_caffe.pth
Traceback (most recent call last):
File "trainval_net.py", line 329, in
loss.backward()
File "C:\Users\arjun\AppData\Local\Programs\Python\Python37\lib\site-packages\torch_tensor.py", line 489, in backward
self, gradient, retain_graph, create_graph, inputs=inputs
File "C:\Users\arjun\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\autograd_init_.py", line 199, in backward
allow_unreachable=True, accumulate_grad=True) # Calls into the C++ engine to run the backward pass
File "C:\Users\arjun\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\autograd\function.py", line 267, in apply
return user_fn(self, *args)
File "C:\Users\arjun\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\autograd\function.py", line 414, in wrapper
outputs = fn(ctx, *args)
File "C:\Veena\faster-rcnn.pytorch\lib\model\roi_layers\roi_align.py", line 41, in backward
sampling_ratio,
RuntimeError: Not implemented on the CPU

please help

@xiaojunjun65
Copy link

WO YE YUUDAO LE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants