Article
RSRefSeg2 环境搭建与实验复现(RTX A800)
NOTE要复现论文的github:RSRefSeg2
下载并安装 Miniconda
sudo apt updatewget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
# 非代理服务器用下面这个wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-latest-Linux-x86_64.shbash Miniconda3-latest-Linux-x86_64.shDo you wish the installer to initialize Miniconda3? yes创建干净环境(Python 3.10)
conda create -n rsrefseg2 python=3.11conda activate rsrefseg2安装 A800 的 PyTorch
pip install torch==2.4.1 torchvision==0.19.1 torchaudio==2.4.1 -f https://mirrors.aliyun.com/pytorch-wheels/cu121/安装 MMCV2.2.x
pip install -U openmimmim install mmcv==2.2.0安装其他依赖项
pip install deepspeed==0.17.2pip install transformers==4.53.1 datasets==2.16.1pip install -U ipdb braceexpand mat4py pycocotools shapely ftfy scipy terminaltables wandb prettytable torchmetrics importlib_metadata einops peftpip install hydra-core iopath拉取 RSRefSeg 2 工程
cd ~git clone https://github.com/KyanChen/RSRefSeg2.gitcd RSRefSeg2下载 RefSegRS 数据集
export HF_ENDPOINT=https://hf-mirror.compip install hf_transferexport HF_HUB_ENABLE_HF_TRANSFER=1huggingface-cli download JessicaYuan/RefSegRS \ --repo-type dataset \ --local-dir /home/ubuntu/RSRefSeg2/datasets/refsegrssudo apt install unzipunzip RefSegRS.zip -d /home/ubuntu/RSRefSeg2/datasets/refsegrsRSRefSeg2/datasets/refsegrs├── images/├── masks/├── output_phrase_test.txt├── output_phrase_train.txt├── output_phrase_val.txt下载 RRSIS-D 数据集
huggingface-cli download \ --repo-type dataset VoyageWang/rrsis-d \ --local-dir /home/ubuntu/RSRefSeg2/datasets/rrsis_dunzip JPEGImages.zip -d /home/ubuntu/RSRefSeg2/datasets/rrsis_d/imagesann_split 自行下载unzip ann_split.zip -d /home/ubuntu/RSRefSeg2/datasets/rrsis_d/imagesRSRefSeg2/datasets/rrsis_d├── rrsisd│ ├── refs(unc).p│ └── instances.json├── images └── rrsisd ├── JPEGImages/ └── ann_split/下载官方 checkpoint
自己创建文件夹 /home/ubuntu/RSRefSeg2/checkpoints
Refsegrs
huggingface-cli download KyanChen/RSRefSeg2 \ --local-dir /home/ubuntu/RSRefSeg2/checkpoints \ --local-dir-use-symlinks False \ --include "refsegrs.pth"RRSIS-D
huggingface-cli download KyanChen/RSRefSeg2 \ --local-dir /home/ubuntu/RSRefSeg2/checkpoints \ --local-dir-use-symlinks False \ --include "rrsisd.pth"验证实验
Refsegrs
修改 /home/ubuntu/RSRefSeg2/configs_RSRefSeg2/refsegrs_infer.py 中的数据集与保存路径
work_dir = '/home/ubuntu/RSRefSeg2/work_dirs/refsegrs'data_root = '/home/ubuntu/RSRefSeg2/datasets/refsegrs/images'cache_dir = '/home/ubuntu/.cache/hf_models'python tools_mmseg/test.py configs_RSRefSeg2/refsegrs_infer.py checkpoints/refsegrs.pth02/14 05:06:32 - mmengine - INFO - per class results:02/14 05:06:32 - mmengine - INFO -+------------+-------+-------+---------+---------+---------+---------+---------+| class | cIoU | gIoU | seg_0.5 | seg_0.6 | seg_0.7 | seg_0.8 | seg_0.9 |+------------+-------+-------+---------+---------+---------+---------+---------+| background | 98.80 | 98.67 | 100.0 | 99.94 | 99.89 | 99.61 | 98.29 || mask | 81.21 | 77.36 | 88.11 | 82.94 | 73.97 | 60.81 | 34.40 |+------------+-------+-------+---------+---------+---------+---------+---------+RRSIS-D
修改 /home/ubuntu/RSRefSeg2/configs_RSRefSeg2/rrsisd_infer.py 中的数据集与保存路径
work_dir = '/home/ubuntu/RSRefSeg2/work_dirs/rrsis_d'data_root = '/home/ubuntu/RSRefSeg2/datasets/rrsis_d/images/JPEGImages'cache_dir = '/home/ubuntu/.cache/hf_models'python tools_mmseg/test.py configs_RSRefSeg2/rrsisd_infer.py checkpoints/rrsisd.pth02/14 05:27:16 - mmengine - INFO - per class results:02/14 05:27:16 - mmengine - INFO -+------------+-------+-------+---------+---------+---------+---------+---------+| class | cIoU | gIoU | seg_0.5 | seg_0.6 | seg_0.7 | seg_0.8 | seg_0.9 |+------------+-------+-------+---------+---------+---------+---------+---------+| background | 98.90 | 98.85 | 100.0 | 99.94 | 99.80 | 99.37 | 97.80 || mask | 79.66 | 69.06 | 80.03 | 75.64 | 65.18 | 50.59 | 31.08 |+------------+-------+-------+---------+---------+---------+---------+---------+`` RSRefSeg2 环境搭建与实验复现(RTX A800)
https://anpier.cn/posts/deep_learning_rsrefseg2_environment/