425
Article
RSRefSeg2 环境搭建与实验复现(RTX A800)
NOTE

要复现论文的github:RSRefSeg2

下载并安装 Miniconda#

Terminal window
sudo apt update
Terminal window
wget 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.sh
Terminal window
bash Miniconda3-latest-Linux-x86_64.sh
Terminal window
Do you wish the installer to initialize Miniconda3? yes

创建干净环境(Python 3.10)#

Terminal window
conda create -n rsrefseg2 python=3.11
Terminal window
conda activate rsrefseg2

安装 A800 的 PyTorch#

Terminal window
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#

Terminal window
pip install -U openmim
Terminal window
mim install mmcv==2.2.0

安装其他依赖项#

Terminal window
pip install deepspeed==0.17.2
Terminal window
pip install transformers==4.53.1 datasets==2.16.1
Terminal window
pip install -U ipdb braceexpand mat4py pycocotools shapely ftfy scipy terminaltables wandb prettytable torchmetrics importlib_metadata einops peft
Terminal window
pip install hydra-core iopath

拉取 RSRefSeg 2 工程#

Terminal window
cd ~
Terminal window
git clone https://github.com/KyanChen/RSRefSeg2.git
Terminal window
cd RSRefSeg2

下载 RefSegRS 数据集#

Terminal window
export HF_ENDPOINT=https://hf-mirror.com
Terminal window
pip install hf_transfer
Terminal window
export HF_HUB_ENABLE_HF_TRANSFER=1
Terminal window
huggingface-cli download JessicaYuan/RefSegRS \
--repo-type dataset \
--local-dir /home/ubuntu/RSRefSeg2/datasets/refsegrs
Terminal window
sudo apt install unzip
Terminal window
unzip RefSegRS.zip -d /home/ubuntu/RSRefSeg2/datasets/refsegrs
RSRefSeg2/datasets/refsegrs
├── images/
├── masks/
├── output_phrase_test.txt
├── output_phrase_train.txt
├── output_phrase_val.txt

下载 RRSIS-D 数据集#

Terminal window
huggingface-cli download \
--repo-type dataset VoyageWang/rrsis-d \
--local-dir /home/ubuntu/RSRefSeg2/datasets/rrsis_d
Terminal window
unzip JPEGImages.zip -d /home/ubuntu/RSRefSeg2/datasets/rrsis_d/images
ann_split 自行下载
Terminal window
unzip ann_split.zip -d /home/ubuntu/RSRefSeg2/datasets/rrsis_d/images
RSRefSeg2/datasets/rrsis_d
├── rrsisd
│ ├── refs(unc).p
│ └── instances.json
├── images
└── rrsisd
├── JPEGImages/
└── ann_split/

下载官方 checkpoint#

自己创建文件夹 /home/ubuntu/RSRefSeg2/checkpoints

Refsegrs#

Terminal window
huggingface-cli download KyanChen/RSRefSeg2 \
--local-dir /home/ubuntu/RSRefSeg2/checkpoints \
--local-dir-use-symlinks False \
--include "refsegrs.pth"

RRSIS-D#

Terminal window
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'
Terminal window
python tools_mmseg/test.py configs_RSRefSeg2/refsegrs_infer.py checkpoints/refsegrs.pth
Terminal window
02/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'
Terminal window
python tools_mmseg/test.py configs_RSRefSeg2/rrsisd_infer.py checkpoints/rrsisd.pth
Terminal window
02/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/
作者
Adrian Pierre
发布于
2026-02-14
许可协议
CC BY-NC-SA 4.0
体温电台
I Really Want to Stay at Your House
Rosa Walton & Hallie Coggins