Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

ImportError during testing pre-trained model with test_panoptic.py, possibly a circular import?

Open
#38 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
38/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Quiet
Tech stack
python, pytorch

Research direction

Start with scripts/test_panoptic.py and follow its imports into seamseg/algos/detection.py, seamseg/utils/bbx/init.py, and seamseg/utils/bbx/bbx.py. Check how the _backend module is provided and reproduce the pretrained-model test. Done means test_panoptic.py starts without the ImportError.

Written by the indexing model from the issue text.

Description

I've been trying to run the test_panoptic.py inference test on the pre-trained model available through the README.
I've tried renaming the backend files to check whether it could be a naming issue, but nothing changed.

Traceback (most recent call last):
  File "seamseg/scripts/test_panoptic.py", line 22, in <module>
    from seamseg.algos.detection import PredictionGenerator as BbxPredictionGenerator, DetectionLoss, \
  File "seamseg/seamseg/algos/detection.py", line 8, in <module>
    from seamseg.utils.bbx import ious, calculate_shift, bbx_overlap, mask_overlap
  File "seamseg/seamseg/utils/bbx/__init__.py", line 1, in <module>
    from .bbx import *
  File "seamseg/seamseg/utils/bbx/bbx.py", line 7, in <module>
    from . import _backend
ImportError: cannot import name '_backend' from partially initialized module 'seamseg.utils.bbx' (most likely due to a circular import) (seamseg/seamseg/utils/bbx/__init__.py)
E0712 15:54:19.384609 139737663112000 torch/distributed/elastic/multiprocessing/api.py:826] failed (exitcode: 1) local_rank: 0 (pid: 39771) of binary: seamseg/env/bin/python
Traceback (most recent call last):
  File "anaconda3/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "anaconda3/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "seamseg/env/lib/python3.9/site-packages/torch/distributed/launch.py", line 198, in <module>
    main()
  File "seamseg/env/lib/python3.9/site-packages/torch/distributed/launch.py", line 194, in main
    launch(args)
  File "seamseg/env/lib/python3.9/site-packages/torch/distributed/launch.py", line 179, in launch
    run(args)
  File "seamseg/env/lib/python3.9/site-packages/torch/distributed/run.py", line 870, in run
    elastic_launch(
  File "seamseg/env/lib/python3.9/site-packages/torch/distributed/launcher/api.py", line 132, in __call__
    return launch_agent(self._config, self._entrypoint, list(args))
  File "seamseg/env/lib/python3.9/site-packages/torch/distributed/launcher/api.py", line 263, in launch_agent
    raise ChildFailedError(
torch.distributed.elastic.multiprocessing.errors.ChildFailedError: 
============================================================
scripts/test_panoptic.py FAILED
------------------------------------------------------------
Failures:
  <NO_OTHER_FAILURES>
Dominant language
Python
Stars
301
Forks
53
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from mapillary/seamseg

All issues in mapillary/seamseg

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.