from mmdet.apis import inference_detector, init_detector
# Choose to use a config and initialize the detector
config = 'configs/yolox/yolox_tiny_8x8_300e_coco.py'
# Setup a checkpoint file to load
checkpoint = 'weight.pth'
# initialize the detector
model = init_detector(config, checkpoint, device='cuda:0')
# Use the detector to do inference
img = 'demo/demo.jpg'
result = inference_detector(model, img)
error:
load checkpoint from local path: weight.pth
C:\Users\xxx\Miniconda3\envs\xxx\lib\site-packages\torch\functional.py:445: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at ..\aten\src\ATen\native\TensorShape.cpp:2157.)
return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined]
C:\Users\xxx\Miniconda3\envs\xxx\lib\site-packages\mmdet\models\dense_heads\yolox_head.py:284: UserWarning: Creating a tensor from a list of numpy.ndarrays is extremely slow. Please consider converting the list to a single numpy.ndarray with numpy.array() before converting to a tensor. (Triggered internally at ..\torch\csrc\utils\tensor_new.cpp:201.)
flatten_bboxes[..., :4] /= flatten_bboxes.new_tensor(
Traceback (most recent call last):
File "C:\Users\xxx\dev\mmdetection\tools\perform_inference.py", line 11, in <module>
result = inference_detector(model, img)
File "C:\Users\xxx\Miniconda3\envs\xxx\lib\site-packages\mmdet\apis\inference.py", line 147, in inference_detector
results = model(return_loss=False, rescale=True, **data)
File "C:\Users\xxx\Miniconda3\envs\xxx\lib\site-packages\torch\nn\modules\module.py", line 1102, in _call_impl
return forward_call(*input, **kwargs)
File "C:\Users\xxx\Miniconda3\envs\xxx\lib\site-packages\mmcv\runner\fp16_utils.py", line 98, in new_func
return old_func(*args, **kwargs)
File "C:\Users\xxx\Miniconda3\envs\xxx\lib\site-packages\mmdet\models\detectors\base.py", line 174, in forward
return self.forward_test(img, img_metas, **kwargs)
File "C:\Users\FxxxA\Miniconda3\envs\xxx\lib\site-packages\mmdet\models\detectors\base.py", line 147, in forward_test
return self.simple_test(imgs[0], img_metas[0], **kwargs)
File "C:\Users\xxx\Miniconda3\envs\xxx\lib\site-packages\mmdet\models\detectors\single_stage.py", line 102, in simple_test
results_list = self.bbox_head.simple_test(
File "C:\Users\xxx\Miniconda3\envs\xxx\lib\site-packages\mmdet\models\dense_heads\base_dense_head.py", line 360, in simple_test
return self.simple_test_bboxes(feats, img_metas, rescale=rescale)
File "C:\Users\xxx\Miniconda3\envs\xxx\lib\site-packages\mmdet\models\dense_heads\dense_test_mixins.py", line 37, in simple_test_bboxes
results_list = self.get_bboxes(
File "C:\Users\xxx\Miniconda3\envs\xxx\lib\site-packages\mmdet\models\dense_heads\yolox_head.py", line 294, in get_bboxes
self._bboxes_nms(cls_scores, bboxes, score_factor, cfg))
File "C:\Users\xxx\Miniconda3\envs\xxx\lib\site-packages\mmdet\models\dense_heads\yolox_head.py", line 321, in _bboxes_nms
dets, keep = batched_nms(bboxes, scores, labels, cfg.nms)
File "C:\Users\xxx\Miniconda3\envs\xxx\lib\site-packages\mmcv\ops\nms.py", line 307, in batched_nms
dets, keep = nms_op(boxes_for_nms, scores, **nms_cfg_)
File "C:\Users\xxx\Miniconda3\envs\xxx\lib\site-packages\mmcv\utils\misc.py", line 340, in new_func
output = old_func(*args, **kwargs)
File "C:\Users\xxx\Miniconda3\envs\xxx\lib\site-packages\mmcv\ops\nms.py", line 171, in nms
inds = NMSop.apply(boxes, scores, iou_threshold, offset,
File "C:\Users\xxx\Miniconda3\envs\xxx\lib\site-packages\mmcv\ops\nms.py", line 26, in forward
inds = ext_module.nms(
RuntimeError: CUDA error: no kernel image is available for execution on the device
CUDA kernel errors might be asynchronously reported at some other API call,so the stacktrace below might be incorrect.
steps to reproduce:
no error
error: