UniDet
UniDet copied to clipboard
import error 'FastRCNNOutputs' from 'detectron2.modeling.roi_heads.fast_rcnn'
$ python projects/UniDet/demo/demo.py --config-file projects/UniDet/configs/Unified_learned_OCI_R50_6x.yaml --input images/34501842524_3c858b3080_k.jpg --opts MODEL.WEIGHTS models/Unified_learned_OCI_R50_6x.pth
Traceback (most recent call last):
File "projects/UniDet/demo/demo.py", line 18, in <module>
from unidet.config import add_unidet_config
File "projects/UniDet/unidet/__init__.py", line 17, in <module>
from .modeling.roi_heads.custom_roi_heads import CustomROIHeads, CustomCascadeROIHeads
File "projects/UniDet/unidet/modeling/roi_heads/custom_roi_heads.py", line 22, in <module>
from .custom_fast_rcnn import CustomFastRCNNOutputLayers
File "projects/UniDet/unidet/modeling/roi_heads/custom_fast_rcnn.py", line 16, in <module>
from detectron2.modeling.roi_heads.fast_rcnn import FastRCNNOutputLayers, FastRCNNOutputs
ImportError: cannot import name 'FastRCNNOutputs' from 'detectron2.modeling.roi_heads.fast_rcnn' (/ProjectRoot/pyprojects/venv/test2/lib/python3.7/site-packages/detectron2/modeling/roi_heads/fast_rcnn.py)
I install detectron2 v0.6 built from https://dl.fbaipublicfiles.com/detectron2/wheels/cu101/torch1.8/index.html
. The reason is detectron2 change its codebase, while ours is older one. So i follow the https://issueexplorer.com/issue/facebookresearch/unbiased-teacher/44
to fix the bug perfectly. I hope this can help someone who faces it.
Hi @youyuge34,
Thank you for sharing that. I am facing the same issue. I have followed this solution https://github.com/facebookresearch/unbiased-teacher/issues/44
However, it does not work. I have added fast_rcnn.py
file to UniDet/detectron2/modeling/roi_heads
.
Am I missing anything?
PLZ follow my solution in my link which is suitable for me. And I have no idea with your solution in your link.