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

import error 'FastRCNNOutputs' from 'detectron2.modeling.roi_heads.fast_rcnn' #13

Open
youyuge34 opened this issue Nov 17, 2021 · 2 comments

Comments

@youyuge34
Copy link

$ 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.

@MoaazAbdulrahman
Copy link

MoaazAbdulrahman commented Feb 9, 2022

Hi @youyuge34,
Thank you for sharing that. I am facing the same issue. I have followed this solution facebookresearch/unbiased-teacher#44
However, it does not work. I have added fast_rcnn.py file to UniDet/detectron2/modeling/roi_heads.
Am I missing anything?

@youyuge34
Copy link
Author

youyuge34 commented May 9, 2022

@MoaazAbdulrahman

PLZ follow my solution in my link which is suitable for me. And I have no idea with your solution in your link.

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

2 participants