Article
SAMWISE 环境搭建与实验复现(RTX 5090)
NOTE要复现论文的github:SAMWISE
下载并安装 Miniconda
sudo apt updatecd ~wget https://repo.anaconda.com/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 samwise python=3.10conda activate samwise安装 RTX5090 必须的 PyTorch(Nightly cu128)
pip install --pre torch torchvision torchaudio \ --index-url https://download.pytorch.org/whl/nightly/cu128验证 GPU 是否正确支持
python - <<'PY'import torchprint("torch:", torch.__version__)print("cuda runtime:", torch.version.cuda)print("gpu available:", torch.cuda.is_available())print("gpu name:", torch.cuda.get_device_name(0))PY拉取 SAMWISE 工程
cd ~git clone https://github.com/ClaudiaCuttano/SAMWISE.gitcd SAMWISE安装依赖
pip install -U pip先删除 requirements.txt 中的 pyav ,之后单独装
pip install -r requirements.txtsudo apt install -y ffmpeg libavdevice-dev libavfilter-dev libavformat-dev libavcodec-dev libswscale-dev libswresample-devpip install av==12.0.0快速 sanity check
python -c "from models.samwise import build_samwise; print('SAMWISE import OK')"下载Ref-DAVIS17数据集
Downlaod the DAVIS2017 dataset from the website. Note that you only need to download the two zip files DAVIS-2017-Unsupervised-trainval-480p.zip and DAVIS-2017_semantics-480p.zip. Download the text annotations from the website. Then, put the zip files in the directory as follows.
SAMWISE├── data│ ├── ref-davis│ │ ├── DAVIS-2017_semantics-480p.zip│ │ ├── DAVIS-2017-Unsupervised-trainval-480p.zip│ │ ├── davis_text_annotations.zipwget https://data.vision.ee.ethz.ch/csergi/share/davis/DAVIS-2017-Unsupervised-trainval-480p.zipwget https://data.vision.ee.ethz.ch/csergi/share/davis/DAVIS-2017_semantics-480p.zipwget https://www.mpi-inf.mpg.de/fileadmin/inf/d2/khoreva/davis_text_annotations.zipUnzip these zip files.
unzip -o davis_text_annotations.zipunzip -o DAVIS-2017_semantics-480p.zipunzip -o DAVIS-2017-Unsupervised-trainval-480p.zipPreprocess the dataset to Ref-Youtube-VOS format. (Make sure you are in the main directory)
python tools/data/convert_davis_to_ytvos.pyFinally, unzip the file DAVIS-2017-Unsupervised-trainval-480p.zip again (since we use mv in preprocess for efficiency).
unzip -o DAVIS-2017-Unsupervised-trainval-480p.zip下载 Ref-DAVIS17 Model
SAMWISE├── pretrain│ ├── final_model_mevis.pth│ ├── final_model_ytvos.pth内网无法访问 google drive,自行下载到电脑上后,上传至服务器
| Dataset | Total Parameters | Trainable Params | J&F | Model | Zip |
|---|---|---|---|---|---|
| MeViS | 210 M | 4.9 M | 49.5 | Weights | Zip |
| MeViS - valid_u | 210 M | 4.9 M | 57.1 | Weights | - |
| Ref-Youtube-VOS | 210 M | 4.9 M | 69.2 | Weights | Zip |
| Ref-Davis | 210 M | 4.9 M | 70.6 | Weights | - |
验证 Ref-DAVIS17 实验数据
由于我用的是5090,所以 cuda 和 torch 版本都不太一样
先修改文件 /SAMWISE/inference_davis.py
我的服务器连接不上 huggingface.co ,所以重定向到国内镜像网站 hf-mirror.com
export HF_ENDPOINT=https://hf-mirror.comexport HF_HUB_ENABLE_HF_TRANSFER=0开始验证:
python3 inference_davis.py --resume=/root/SAMWISE/pretrain/final_model_ytvos.pth --name_exp Ref-DAVIS17-evaluate --HSA --use_cme_head SAMWISE 环境搭建与实验复现(RTX 5090)
https://anpier.cn/posts/deep_learning_samwise_environment/