zcablii / LSKNet

(IJCV2024 & ICCV2023) LSKNet: A Foundation Lightweight Backbone for Remote Sensing
Other
492 stars 40 forks source link

Inference DOTA dataset with provided setting does not work. (NameError: name 'true'/'false/null' is not defined, or AttributeError: 'ConfigDict' object has no attribute 'data') #27

Closed zilunzhang closed 1 year ago

zilunzhang commented 1 year ago

Prerequisite

Task

I'm using the official example scripts/configs for the officially supported tasks/models/datasets.

Branch

master branch https://github.com/open-mmlab/mmrotate

Environment

sys.platform: linux Python: 3.8.18 (default, Sep 11 2023, 13:40:15) [GCC 11.2.0] CUDA available: True GPU 0,1: GeForce RTX 3090 CUDA_HOME: /usr/local/cuda NVCC: Cuda compilation tools, release 11.2, V11.2.67 GCC: gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 PyTorch: 2.0.1+cu117 PyTorch compiling details: PyTorch built with:

TorchVision: 0.15.2+cu117 OpenCV: 4.8.0 MMCV: 1.7.1 MMCV Compiler: GCC 7.5 MMCV CUDA Compiler: 11.2 MMRotate: 0.3.4+293d79c

Reproduces the problem - code sample

I am using config and checkpoint from here: https://github.com/zcablii/LSKNet/blob/main/configs/lsknet/lsk_s_fpn_1x_dota_le90.py and https://download.openmmlab.com/mmrotate/v1.0/lsknet/lsk_s_fpn_1x_dota_le90/lsk_s_fpn_1x_dota_le90_20230116-99749191.pth

The DOTA dataset is processed following: https://github.com/zcablii/LSKNet/blob/main/docs/en/get_started.md

I used the command following: https://github.com/zcablii/LSKNet/blob/main/docs/en/get_started.md

Reproduces the problem - command or script

/mnt/data/Large-Selective-Kernel-Network$ CUDA_VISIBLE_DEVICES=1 python tools/test.py /mnt/data/Large-Selective-Kernel-Network/checkpoints/lsk_s_fpn_1x_dota_le90.py /mnt/data/Large-Selective-Kernel-Network/checkpoints/lsk_s_fpn_1x_dota_le90_20230116-99749191.pth --eval mAP

Reproduces the problem - error message

Traceback (most recent call last):
  File "tools/test.py", line 263, in <module>
    main()
  File "tools/test.py", line 116, in main
    cfg = Config.fromfile(args.config)
  File "/mnt/data/anaconda3/envs/lsknet/lib/python3.8/site-packages/mmcv/utils/config.py", line 340, in fromfile
    cfg_dict, cfg_text = Config._file2dict(filename,
  File "/mnt/data/anaconda3/envs/lsknet/lib/python3.8/site-packages/mmcv/utils/config.py", line 208, in _file2dict
    mod = import_module(temp_module_name)                        
  File "/mnt/data/anaconda3/envs/lsknet/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)                                                     
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked                                                 
  File "<frozen importlib._bootstrap_external>", line 843, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/tmp/tmpmrlo1xus/tmp7glnglw1.py", line 1, in <module>    
NameError: name 'true' is not defined                            
Exception ignored in: <function _TemporaryFileCloser.__del__ at 0x7fe4528d1550>
Traceback (most recent call last):                               
  File "/mnt/data/anaconda3/envs/lsknet/lib/python3.8/tempfile.py", line 440, in __del__
    self.close()                                                 
  File "/mnt/data/anaconda3/envs/lsknet/lib/python3.8/tempfile.py", line 436, in close                       
    unlink(self.name)                                                                                               
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpmrlo1xus/tmp7glnglw1.py'

Additional information

When I change all true to True, false to False, null to None, and run again. The following error occurs:

Traceback (most recent call last):
  File "tools/test.py", line 263, in <module>
    main()
  File "tools/test.py", line 120, in main
    cfg = compat_cfg(cfg)
  File "/mnt/data/Large-Selective-Kernel-Network/mmrotate/utils/compat_config.py", line 16, in compat_cfg
    cfg = compat_imgs_per_gpu(cfg)
  File "/mnt/data/Large-Selective-Kernel-Network/mmrotate/utils/compat_config.py", line 39, in compat_imgs_per_gpu
    if 'imgs_per_gpu' in cfg.data:
  File "/mnt/data/anaconda3/envs/lsknet/lib/python3.8/site-packages/mmcv/utils/config.py", line 519, in __getattr__
    return getattr(self._cfg_dict, name)
  File "/mnt/data/anaconda3/envs/lsknet/lib/python3.8/site-packages/mmcv/utils/config.py", line 50, in __getattr__
    raise ex
AttributeError: 'ConfigDict' object has no attribute 'data'