conda create -n open-mmlab python=3.7 -y
conda activate open-mmlab
conda search cudnn
conda install cudatoolkit=11.3
conda install cudnn=8.2.1
https://pytorch.org/get-started/previous-versions/ (pytorch 官网)
# ROCM 5.1.1 (Linux only)
pip install torch==1.12.1+rocm5.1.1 torchvision==0.13.1+rocm5.1.1 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/rocm5.1.1
# CUDA 11.6
pip install torch==1.12.1+cu116 torchvision==0.13.1+cu116 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu116
# CUDA 11.3
pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu113
# CUDA 10.2
pip install torch==1.12.1+cu102 torchvision==0.13.1+cu102 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu102
# CPU only
pip install torch==1.12.1+cpu torchvision==0.13.1+cpu torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cpu
注意:torch和torchvison要对应一致且是GPU版本
pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu113
https://mmcv.readthedocs.io/en/latest/get_started/installation.html#install-mmcv
pip install mmcv-full==1.6.2 -f https://download.openmmlab.com/mmcv/dist/cu113/torch1.12/index.html
git clone https://github.com/open-mmlab/mmaction2.git
cd mmaction2
pip install -r requirements/build.txt
pip install -v -e .
pip install -r requirements.txt
pip install -v -e .
import torch
flag = torch.cuda.is_available()
if flag:
print("CUDA可使用")
else:
print("CUDA不可用")
python tools/train.py configs/recognition/tsn/tsn_r50_1x1x3_75e_ucf101_rgb.py --validate --seed 0 --deterministic --gpu-ids 0
下一步,你将可以根据官方文档去了解里面代码。祝你成功。
https://mmaction2.readthedocs.io/zh_CN/latest/install.html#mmaction2