Skip to content

[Bug] RuntimeError: min_area_polygons_impl: implementation for device cpu not found #1086

@tikitong

Description

@tikitong

Prerequisite

Task

I'm using the official example scripts/configs for the officially supported tasks/models/datasets.

Branch

master branch https://github.com/open-mmlab/mmrotate

Environment

from mmcv import collect_env
collect_env()

# Check MMRotate installation
import mmrotate
print(mmrotate.__version__)

# Check MMDetection installation
import mmdet
print(mmdet.__version__)

# Check mmcv installation
from mmcv.ops import get_compiling_cuda_version, get_compiler_version
print(get_compiling_cuda_version())
print(get_compiler_version())

# Check PyTorch version
import torch
print(f"PyTorch version: {torch.__version__}")

/home/bluav/miniconda3/envs/mmrotate_rep_geofiona/lib/python3.8/site-packages/mmcv/init.py:20: UserWarning: On January 1, 2023, MMCV will release v2.0.0, in which it will remove components related to the training process and add a data transformation module. In addition, it will rename the package names mmcv to mmcv-lite and mmcv-full to mmcv. See https://github.com/open-mmlab/mmcv/blob/master/docs/en/compatibility.md for more details.
warnings.warn(
0.3.4
2.28.2
10.2
GCC 7.3
PyTorch version: 1.12.1

Reproduces the problem - code sample

For the oriented_reppoints model (config and pth files are the same than is the repo), simply by running the installation check example. I want to run it specifically on cpu but this error is raised, is it about the mmrotate version here?

import mmrotate
from mmdet.apis import init_detector, inference_detector

config_file = 'oriented_reppoints_r50_fpn_1x_dota_le135.py'
checkpoint_file = 'oriented_reppoints_r50_fpn_1x_dota_le135-ef072de9.pth'
model = init_detector(config_file, checkpoint_file, device='cpu')
inference_detector(model, 'dota_demo.jpg')

I got the following error:

load checkpoint from local path: oriented_reppoints_r50_fpn_1x_dota_le135-ef072de9.pth
/home/bluav/miniconda3/envs/mmrotate_rep_geofiona/lib/python3.8/site-packages/torch/functional.py:478: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at /opt/conda/conda-bld/pytorch_1659484657607/work/aten/src/ATen/native/TensorShape.cpp:2895.)
return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined]
Traceback (most recent call last):
File "test.py", line 23, in
inference_detector(model, 'dota_demo.jpg')
File "/home/bluav/miniconda3/envs/mmrotate_rep_geofiona/lib/python3.8/site-packages/mmdet/apis/inference.py", line 157, in inference_detector
results = model(return_loss=False, rescale=True, **data)
File "/home/bluav/miniconda3/envs/mmrotate_rep_geofiona/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
return forward_call(*input, **kwargs)
File "/home/bluav/miniconda3/envs/mmrotate_rep_geofiona/lib/python3.8/site-packages/mmcv/runner/fp16_utils.py", line 119, in new_func
return old_func(*args, **kwargs)
File "/home/bluav/miniconda3/envs/mmrotate_rep_geofiona/lib/python3.8/site-packages/mmdet/models/detectors/base.py", line 174, in forward
return self.forward_test(img, img_metas, **kwargs)
File "/home/bluav/miniconda3/envs/mmrotate_rep_geofiona/lib/python3.8/site-packages/mmdet/models/detectors/base.py", line 147, in forward_test
return self.simple_test(imgs[0], img_metas[0], **kwargs)
File "/home/bluav/miniconda3/envs/mmrotate_rep_geofiona/lib/python3.8/site-packages/mmrotate/models/detectors/single_stage.py", line 101, in simple_test
bbox_list = self.bbox_head.get_bboxes(
File "/home/bluav/miniconda3/envs/mmrotate_rep_geofiona/lib/python3.8/site-packages/mmcv/runner/fp16_utils.py", line 208, in new_func
return old_func(*args, **kwargs)
File "/home/bluav/miniconda3/envs/mmrotate_rep_geofiona/lib/python3.8/site-packages/mmrotate/models/dense_heads/oriented_reppoints_head.py", line 1083, in get_bboxes
results = self._get_bboxes_single(cls_score_list, point_pred_list,
File "/home/bluav/miniconda3/envs/mmrotate_rep_geofiona/lib/python3.8/site-packages/mmrotate/models/dense_heads/oriented_reppoints_head.py", line 1174, in _get_bboxes_single
polys = min_area_polygons(pts)
File "/home/bluav/miniconda3/envs/mmrotate_rep_geofiona/lib/python3.8/site-packages/mmcv/ops/min_area_polygons.py", line 19, in min_area_polygons
ext_module.min_area_polygons(pointsets, polygons)
RuntimeError: min_area_polygons_impl: implementation for device cpu not found.

Reproduces the problem - command or script

Reproduces the problem - error message

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions