mapillary / seamseg

Seamless Scene Segmentation
BSD 3-Clause "New" or "Revised" License
289 stars 53 forks source link

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

Open tymwitko opened 1 month ago

tymwitko commented 1 month ago

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>