question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

an ImportError: cannot import name 'FastRCNNOutputs'

See original GitHub issue

When I tried to use the Faster RCNN of detectron2, an unexpected error occurre

  1. Full runnable code or full changes you made:
from detectron2.modeling.roi_heads.fast_rcnn import (
   FastRCNNOutputLayers,
   FastRCNNOutputs
)
  1. What exact command you run: from detectron2.modeling.roi_heads.fast_rcnn import ( FastRCNNOutputLayers, FastRCNNOutputs )
  2. Full logs or other relevant observations:
ImportError: cannot import name 'FastRCNNOutputs' from 'detectron2.modeling.roi_heads.fast_rcnn' (/home/tony/detectron2/detectron2/modeling/roi_heads/fast_rcnn.py)

Environment:

Paste the output of the following command:

Name Version Build Channel

_libgcc_mutex 0.1 conda_forge conda-forge _openmp_mutex 4.5 1_gnu conda-forge absl-py 1.0.0 pypi_0 pypi antlr4-python3-runtime 4.8 pypi_0 pypi backports-entry-points-selectable 1.1.1 pypi_0 pypi black 21.4b2 pypi_0 pypi ca-certificates 2021.10.8 ha878542_0 conda-forge cachetools 4.2.4 pypi_0 pypi certifi 2021.10.8 pypi_0 pypi charset-normalizer 2.0.7 pypi_0 pypi click 8.0.3 pypi_0 pypi cloudpickle 2.0.0 pypi_0 pypi cycler 0.11.0 pypi_0 pypi cython 0.29.24 pypi_0 pypi filelock 3.4.0 pypi_0 pypi fonttools 4.28.2 pypi_0 pypi future 0.18.2 pypi_0 pypi fvcore 0.1.5.post20211023 pypi_0 pypi google-auth 2.3.3 pypi_0 pypi google-auth-oauthlib 0.4.6 pypi_0 pypi grpcio 1.42.0 pypi_0 pypi hydra-core 1.1.1 pypi_0 pypi idna 3.3 pypi_0 pypi importlib-metadata 4.8.2 pypi_0 pypi importlib-resources 5.4.0 pypi_0 pypi iopath 0.1.9 pypi_0 pypi kiwisolver 1.3.2 pypi_0 pypi ld_impl_linux-64 2.36.1 hea4e1c9_2 conda-forge libffi 3.4.2 h7f98852_5 conda-forge libgcc-ng 11.2.0 h1d223b6_11 conda-forge libgomp 11.2.0 h1d223b6_11 conda-forge libnsl 2.0.0 h7f98852_0 conda-forge libstdcxx-ng 11.2.0 he4da1e4_11 conda-forge libzlib 1.2.11 h36c2ea0_1013 conda-forge markdown 3.3.6 pypi_0 pypi matplotlib 3.5.0 pypi_0 pypi mypy-extensions 0.4.3 pypi_0 pypi ncurses 6.2 h58526e2_4 conda-forge numpy 1.21.4 pypi_0 pypi oauthlib 3.1.1 pypi_0 pypi omegaconf 2.1.1 pypi_0 pypi openssl 3.0.0 h7f98852_2 conda-forge packaging 21.3 pypi_0 pypi pathspec 0.9.0 pypi_0 pypi pillow 8.4.0 pypi_0 pypi pip 21.3.1 pyhd8ed1ab_0 conda-forge platformdirs 2.4.0 pypi_0 pypi portalocker 2.3.2 pypi_0 pypi protobuf 3.19.1 pypi_0 pypi pyasn1 0.4.8 pypi_0 pypi pyasn1-modules 0.2.8 pypi_0 pypi pycocotools 2.0.2 pypi_0 pypi pydot 1.4.2 pypi_0 pypi pyparsing 3.0.6 pypi_0 pypi python 3.7.12 hf930737_100_cpython conda-forge python-dateutil 2.8.2 pypi_0 pypi python_abi 3.7 2_cp37m conda-forge pyyaml 6.0 pypi_0 pypi readline 8.1 h46c0cb4_0 conda-forge regex 2021.11.10 pypi_0 pypi requests 2.26.0 pypi_0 pypi requests-oauthlib 1.3.0 pypi_0 pypi rsa 4.7.2 pypi_0 pypi setuptools 59.2.0 py37h89c1867_0 conda-forge setuptools-scm 6.3.2 pypi_0 pypi six 1.16.0 pypi_0 pypi sqlite 3.36.0 h9cd32fc_2 conda-forge tabulate 0.8.9 pypi_0 pypi tensorboard 2.7.0 pypi_0 pypi tensorboard-data-server 0.6.1 pypi_0 pypi tensorboard-plugin-wit 1.8.0 pypi_0 pypi termcolor 1.1.0 pypi_0 pypi tk 8.6.11 h27826a3_1 conda-forge tomli 1.2.2 pypi_0 pypi torch 1.8.0+cu101 pypi_0 pypi torchaudio 0.8.0 pypi_0 pypi torchvision 0.9.0+cu101 pypi_0 pypi tqdm 4.62.3 pypi_0 pypi typed-ast 1.5.0 pypi_0 pypi typing-extensions 4.0.0 pypi_0 pypi urllib3 1.26.7 pypi_0 pypi virtualenv 20.10.0 pypi_0 pypi werkzeug 2.0.2 pypi_0 pypi wheel 0.37.0 pyhd8ed1ab_1 conda-forge xz 5.2.5 h516909a_1 conda-forge yacs 0.1.8 pypi_0 pypi zlib 1.2.11 h36c2ea0_1013 conda-forge (sorry,It looks messy, but wget-nc-nvhttps://github.com/facebookresearch/detectron2/raw/master/detectron2/utils/collect_env.py &&python collect_env.py has no output,This file named “raw” does not exist) What should I do? thank you

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6

github_iconTop GitHub Comments

3reactions
gustavsmacommented, Apr 19, 2022

There is no FastRCNNOutputs, so the ImportError is expected.

thanks,now I have found the answer,the reason is detectron2 change its codebase, while mine is older one. 11528ce

do you know the solution?

FastRCNNOutputs was removed from detectron2.

Try installing version v0.5. For example: python -m pip install 'git+https://github.com/facebookresearch/detectron2.git@v0.5'

0reactions
leoliu37commented, Aug 18, 2022

This is the problem of detecron2 version, I solve it by installing suitable version in https://github.com/facebookresearch/detectron2/releases

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - ImportError about Detectron2 - Stack Overflow
It seems there might be some problems in my environment. Does anyone know how to fix it? ImportError: cannot import name 'is_fx_tracing' from...
Read more >
How to Fix ImportError: Cannot Import Name in Python - Rollbar
The Python ImportError: cannot import name error occurs when an imported class is not accessible or is in a circular dependency.
Read more >
[Solved] ImportError: Cannot Import Name - Python Pool
ImportError : Cannot Import Name: In this article, we will see what are the reasons for importerror cannot import name and find its...
Read more >
How do I fix the ImportError: cannot import name 'delayed'?
I am using the LORAS package from pyloras for imbalanced learning, but it requires importing the delayed package. I used the pip.main() to ......
Read more >
ImportError: cannot import name 'FastRCNNOutputs' - bytemeta
The detectron2.modeling.roi_heads.fast_rcnn have no FastRCNNOutputs for the ubteacher/modeling/roi_heads/fast_rcnn.py ImportError: cannot import name ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found