BubblyYi / MMPedestron

[ECCV2024] Official implementation of the paper "When Pedestrian Detection Meets Multi-Modal Learning: Generalist Model and Benchmark Dataset"
Other
42 stars 3 forks source link

BUG: failed to import mmdet_custom #6

Open gustavofuhr opened 1 week ago

gustavofuhr commented 1 week ago

When I try to import mmdet_custom I got the following error:

>>> import mmdet_custom
/opt/homebrew/Caskroom/miniconda/base/envs/mmpedestron/lib/python3.8/site-packages/mmcv/__init__.py:20: UserWarning: On January 1, 2023, MMCV will release v2.0.0, in which it will remove components related to the training process and add a data transformation module. In addition, it will rename the package names mmcv to mmcv-lite and mmcv-full to mmcv. See https://github.com/open-mmlab/mmcv/blob/master/docs/en/compatibility.md for more details.
  warnings.warn(
/opt/homebrew/Caskroom/miniconda/base/envs/mmpedestron/lib/python3.8/site-packages/torchvision/io/image.py:11: UserWarning: Failed to load image Python extension:
  warn(f"Failed to load image Python extension: {e}")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/gustavofuhr/projects/immediate_action/MMPedestron/mmdet_custom/__init__.py", line 7, in <module>
    from .models import *  # noqa: F401,F403
  File "/Users/gustavofuhr/projects/immediate_action/MMPedestron/mmdet_custom/models/__init__.py", line 6, in <module>
    from .co_detr_heads import *  # noqa: F401,F403
  File "/Users/gustavofuhr/projects/immediate_action/MMPedestron/mmdet_custom/models/co_detr_heads/__init__.py", line 6, in <module>
    from .co_deformable_detr_head import CoDeformDETRHead
  File "/Users/gustavofuhr/projects/immediate_action/MMPedestron/mmdet_custom/models/co_detr_heads/co_deformable_detr_head.py", line 15, in <module>
    from mmdet_custom.models.co_detr_heads import DETRHead_Fix
ImportError: cannot import name 'DETRHead_Fix' from partially initialized module 'mmdet_custom.models.co_detr_heads' (most likely due to a circular import) (/Users/gustavofuhr/projects/immediate_action/MMPedestron/mmdet_custom/models/co_detr_heads/__init__.py)

Also, if possible, can you provide how to run inference without slurm?

developer0hye commented 1 week ago

I have the same problem.

developer0hye commented 6 days ago

Hello, @gustavofuhr

I solved this issue in #7 by modifying mmdet_custom/models/co_detr_heads/init.py as shown below:

# @Time    : 29/08/2023 13:35
# @Author  : BubblyYi
# @FileName: __init__.py
# @Software: PyCharm
from .co_atss_head import CoATSSHead
from .detr_head import DETRHead_Fix
from .co_deformable_detr_head import CoDeformDETRHead
from .co_dino_head import CoDINOCoodHead, CoDINOHead
from .query_denoising import build_dn_generator
from .transformer import (BaseTransformerLayer_CP, CoDeformableDetrTransformer,
                          CoDeformableDetrTransformerDecoder,
                          CoDinoTransformer, DinoTransformerDecoder)

__all__ = [
    'CoATSSHead', 'CoDeformDETRHead', 'CoDINOCoodHead', 'CoDINOHead',
    'build_dn_generator', 'BaseTransformerLayer_CP',
    'CoDeformableDetrTransformer', 'CoDeformableDetrTransformerDecoder',
    'CoDinoTransformer', 'DinoTransformerDecoder', 'DETRHead_Fix'
]

image