implus / GFocalV2

Generalized Focal Loss V2: Learning Reliable Localization Quality Estimation for Dense Object Detection, CVPR2021
Apache License 2.0
477 stars 54 forks source link

ImportError: cannot import name 'force_fp32' from 'mmcv.runner' #19

Open Lixia1221 opened 3 years ago

Lixia1221 commented 3 years ago

(open-mmlab) fsr@titanxp:~/FoveaBox-01$ python tools/train.py configs/foveabox/fovea_r50_fpn_gfl.py Traceback (most recent call last): File "tools/train.py", line 9, in from mmdet.apis import (get_root_logger, init_dist, set_random_seed, File "/home/fsr/FoveaBox-01/mmdet/apis/init.py", line 2, in from .inference import (inference_detector, init_detector, show_result, File "/home/fsr/FoveaBox-01/mmdet/apis/inference.py", line 13, in from mmdet.models import build_detector File "/home/fsr/FoveaBox-01/mmdet/models/init.py", line 1, in from .anchor_heads import * # noqa: F401,F403 File "/home/fsr/FoveaBox-01/mmdet/models/anchor_heads/init.py", line 10, in from .gfl_head import Integral, GFLHead File "/home/fsr/FoveaBox-01/mmdet/models/anchor_heads/gfl_head.py", line 5, in ImportError: cannot import name 'force_fp32' from 'mmcv.runner' (/home/fsr/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/mmcv/runner/init.py)

limeranceofyyqx commented 1 year ago

我也遇到了相同的问题,请问您解决了吗?

zhangkai07 commented 1 year ago

I have same question, My envs is mmcv 2.0.0+cu11.8+torch2.1 I think this is a version problem, but I cannot solve it

johnson-magic commented 1 year ago

我已收到,。

llelio272 commented 5 months ago

I use the "from mmcv.runner.fp16_utils import force_fp32" to replace "from mmcv.runner import force_fp32", and the problem solved.