ViTAE-Transformer / ViTAE-Transformer-Remote-Sensing

A comprehensive list [SAMRS@NeurIPS'23, RVSA@TGRS'22, RSP@TGRS'22] of our research works related to remote sensing, including papers, codes, and citations. Note: The repo for [TGRS'22] "An Empirical Study of Remote Sensing Pretraining" has been moved to: https://github.com/ViTAE-Transformer/RSP
462 stars 53 forks source link

About Reproducing Training of Remote Sensing Semantic Segmentation Models #4

Open smallsnailrunning opened 2 years ago

smallsnailrunning commented 2 years ago

Hello, I am interested in the remote sensing semantic segmentation of this project. I have downloaded all the relevant Potsdam datasets and configured the program running environment, but the reproduction steps of the entire training are still unclear. The downloaded public datasets Whether preprocessing is required, images and label images need to be cut into small pieces. If you don't do distributed training, you can simply remove the distributed settings when training on one card. Do you have a more detailed description of the training steps? The description of the training parameter configuration config file allows us to reproduce the model training. Thank you.

DotWang commented 2 years ago

The original Potsdam image is large, so it is needed to be clipped to patches. For preparing the Potsdam dataset, you can refer to https://github.com/open-mmlab/mmsegmentation/blob/master/docs/en/dataset_prepare.md#prepare-datasets. Note there are some differences. We use '3_Ortho_IRRG.zip' and '5_Labels_all.zip'.

For reproduction, we have provided the command lines, config files, training logs, and saved model weights in the readme.md of https://github.com/ViTAE-Transformer/ViTAE-Transformer-Remote-Sensing/tree/main/Semantic%20Segmentation.

As I know, the default mmsegmentation adopts the distributed training. It doesn't affect the final result.

smallsnailrunning commented 2 years ago

Thank you, I have a try as you say. Hope to see the amazing results. your jop is very meaning.

smallsnailrunning commented 2 years ago

I tried the proiect in the windows, not in the linux, Did you have a try in the windows?It semms to be the problem about the path '\' in windows '/' in the linux, except the problem, I am not sure if there will have other problems between the difference in th windows and linux system, do you have a project with the windows edition?

smallsnailrunning commented 2 years ago

(rs) C:\Users\ly\PycharmProjects\ViTAE-Transformer-Remote-Sensing-main\Semantic Segmentation>python tools\test.py configs\swin\upernet_swin_tiny_patch4_window7_512x512_80k_potsdam.py --show-dir data\te st --eval mIoU 'mFscore' usage: test.py [-h] [--work-dir WORK_DIR] [--aug-test] [--out OUT] [--format-only] [--eval EVAL [EVAL ...]] [--show] [--show-dir SHOW_DIR] [--gpu-collect] [--gpu-id GPU_ID] [--tmpdir TMPDIR] [--options OPTIONS [OPTIONS ...]] [--cfg-options CFG_OPTIONS [CFG_OPTIONS ...]] [--eval-options EVAL_OPTIONS [EVAL_OPTIONS ...]] [--launcher {none,pytorch,slurm,mpi}] [--opacity OPACITY]
[--local_rank LOCAL_RANK] config checkpoint test.py: error: the following arguments are required: checkpoint

I directly adjusted the configuration file according to the file structure of my computer under the windows system: configs, I used the pre-trained model you uploaded for the inference test, the above error occurred, and the checkpoint was missing. I don't know where to find this. checkpoint? I need your help very much, thank you very much, there may be trouble in the future, and I am trying to reproduce the whole project myself.

smallsnailrunning commented 2 years ago

(rs) C:\Users\ly\PycharmProjects\ViTAE-Transformer-Remote-Sensing-main\Semantic Segmentation>python tools\test.py configs\swin\upernet_swin_tiny_patch4_window7_512x512_80k_potsdam.py --show-dir data\te st --eval mIoU 'mFscore' usage: test.py [-h] [--work-dir WORK_DIR] [--aug-test] [--out OUT] [--format-only] [--eval EVAL [EVAL ...]] [--show] [--show-dir SHOW_DIR] [--gpu-collect] [--gpu-id GPU_ID] [--tmpdir TMPDIR] [--options OPTIONS [OPTIONS ...]] [--cfg-options CFG_OPTIONS [CFG_OPTIONS ...]] [--eval-options EVAL_OPTIONS [EVAL_OPTIONS ...]] [--launcher {none,pytorch,slurm,mpi}] [--opacity OPACITY]
[--local_rank LOCAL_RANK] config checkpoint test.py: error: the following arguments are required: checkpoint

I directly adjusted the configuration file according to the file structure of my computer under the windows system: configs, I used the pre-trained model you uploaded for the inference test, the above error occurred, and there are some problems. I don't know how to fix the problem? I need your help very much, thank you very much, there may be trouble in the future, and I am trying to reproduce the whole project myself. thank you very much

DotWang commented 2 years ago

Sorry, we have not tried it on the windows yet.

I think you can try “\\" in shell, but I'm not sure whether it works

If the path is in python, you can try r'C:\Users\ly\PycharmProjects\xxxx'

Also, you can search for similar problems in the mmsegmentation issue.

smallsnailrunning commented 2 years ago

(rs) C:\Users\ly\PycharmProjects\ViTAE-Transformer-Remote-Sensing-main\Semantic Segmentation>python tools\test.py configs\swin\upernet_swin_tiny_patch4_window7_512x512_80k_potsdam.py --show-dir data\test\ --eval mIoU 'mFscore' usage: test.py [-h] [--work-dir WORK_DIR] [--aug-test] [--out OUT] [--format-only] [--eval EVAL [EVAL ...]] [--show] [--show-dir SHOW_DIR] [--gpu-collect] [--gpu-id GPU_ID] [--tmpdir TMPDIR] [--options OPTIONS [OPTIONS ...]] [--cfg-options CFG_OPTIONS [CFG_OPTIONS ...]] [--eval-options EVAL_OPTIONS [EVAL_OPTIONS ...]] [--launcher {none,pytorch,slurm,mpi}] [--opacity OPACITY]
[--local_rank LOCAL_RANK] config checkpoint test.py: error: the following arguments are required: checkpoint

(rs) C:\Users\ly\PycharmProjects\ViTAE-Transformer-Remote-Sensing-main\Semantic Segmentation> File "C:\Users\ly\PycharmProjects\ViTAE-Transformer-Remote-Sensing-main\Semantic Segmentation\tools\test.py", line 303, in main() File "C:\Users\ly\PycharmProjects\ViTAE-Transformer-Remote-Sensing-main\Semantic Segmentation\tools\test.py", line 203, in main model = build_segmentor(cfg.model, test_cfg=cfg.get('test_cfg')) File "C:\Users\ly\anaconda3\envs\rs\lib\site-packages\mmseg\models\builder.py", line 48, in build_segmentor return SEGMENTORS.build( File "C:\Users\ly\anaconda3\envs\rs\lib\site-packages\mmcv\utils\registry.py", line 234, in build return self.build_func(*args, **kwargs, registry=self) File "C:\Users\ly\anaconda3\envs\rs\lib\site-packages\mmcv\cnn\builder.py", line 27, in build_model_from_cfg return build_from_cfg(cfg, registry, default_args) File "C:\Users\ly\anaconda3\envs\rs\lib\site-packages\mmcv\utils\registry.py", line 69, in build_from_cfg raise type(e)(f'{obj_cls.name}: {e}') KeyError: "EncoderDecoder: 'swin is not in the models registry'"

I tried,have the problem ,can you have a look ,thanks, I do not knows why I clone the project , swin is not in the models registry? very thanks if you know the reason, tell me how to solve the problem

smallsnailrunning commented 2 years ago

(rs) C:\Users\ly\PycharmProjects\ViTAE-Transformer-Remote-Sensing-main\Semantic Segmentation>python tools\test.py configs\swin\upernet_swin_tiny_patch4_window7_512x512_80k_potsdam.py --show-dir data\te st --eval mIoU 'mFscore' usage: test.py [-h] [--work-dir WORK_DIR] [--aug-test] [--out OUT] [--format-only] [--eval EVAL [EVAL ...]] [--show] [--show-dir SHOW_DIR] [--gpu-collect] [--gpu-id GPU_ID] [--tmpdir TMPDIR] [--options OPTIONS [OPTIONS ...]] [--cfg-options CFG_OPTIONS [CFG_OPTIONS ...]] [--eval-options EVAL_OPTIONS [EVAL_OPTIONS ...]] [--launcher {none,pytorch,slurm,mpi}] [--opacity OPACITY] [--local_rank LOCAL_RANK] config checkpoint test.py: error: the following arguments are required: checkpoint

I directly adjusted the configuration file according to the file structure of my computer under the windows system: configs, I used the pre-trained model you uploaded for the inference test, the above error occurred, and there are some problems. I don't know how to fix the problem? I need your help very much, thank you very much, there may be trouble in the future, and I am trying to reproduce the whole project myself. thank you very much

I know I miss the .pth file

DotWang commented 2 years ago

(rs) C:\Users\ly\PycharmProjects\ViTAE-Transformer-Remote-Sensing-main\Semantic Segmentation>python tools\test.py configs\swin\upernet_swin_tiny_patch4_window7_512x512_80k_potsdam.py --show-dir data\test\ --eval mIoU 'mFscore' usage: test.py [-h] [--work-dir WORK_DIR] [--aug-test] [--out OUT] [--format-only] [--eval EVAL [EVAL ...]] [--show] [--show-dir SHOW_DIR] [--gpu-collect] [--gpu-id GPU_ID] [--tmpdir TMPDIR] [--options OPTIONS [OPTIONS ...]] [--cfg-options CFG_OPTIONS [CFG_OPTIONS ...]] [--eval-options EVAL_OPTIONS [EVAL_OPTIONS ...]] [--launcher {none,pytorch,slurm,mpi}] [--opacity OPACITY] [--local_rank LOCAL_RANK] config checkpoint test.py: error: the following arguments are required: checkpoint

(rs) C:\Users\ly\PycharmProjects\ViTAE-Transformer-Remote-Sensing-main\Semantic Segmentation> File "C:\Users\ly\PycharmProjects\ViTAE-Transformer-Remote-Sensing-main\Semantic Segmentation\tools\test.py", line 303, in main() File "C:\Users\ly\PycharmProjects\ViTAE-Transformer-Remote-Sensing-main\Semantic Segmentation\tools\test.py", line 203, in main model = build_segmentor(cfg.model, test_cfg=cfg.get('test_cfg')) File "C:\Users\ly\anaconda3\envs\rs\lib\site-packages\mmseg\models\builder.py", line 48, in build_segmentor return SEGMENTORS.build( File "C:\Users\ly\anaconda3\envs\rs\lib\site-packages\mmcv\utils\registry.py", line 234, in build return self.build_func(*args, kwargs, registry=self) File "C:\Users\ly\anaconda3\envs\rs\lib\site-packages\mmcv\cnn\builder.py", line 27, in build_model_from_cfg return build_from_cfg(cfg, registry, default_args) File "C:\Users\ly\anaconda3\envs\rs\lib\site-packages\mmcv\utils\registry.py", line 69, in build_from_cfg raise type(e)(f'{obj_cls.name**}: {e}') KeyError: "EncoderDecoder: 'swin is not in the models registry'"

I tried,have the problem ,can you have a look ,thanks, I do not knows why I clone the project , swin is not in the models registry? very thanks if you know the reason, tell me how to solve the problem

'swin' is already contained in __init__.py, so can you post the commands?