官网
创建conda环境
conda create --name openmmlab python=3.8 -y
进入创建的环境
conda activate openmmlab
安转pytorcch
conda install pytorch torchvision -c pytorch
要是想安装Openmmlab的部署库mmdeploy,最好安装pytorch==1.8.0版本
方法2
conda install pytorch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0 cudatoolkit=11.1 -c pytorch -c conda-forge
方法3
pip install torch==1.8.0+cu111 torchvision==0.9.0+cu111 torchaudio==0.8.0 -f https://download.pytorch.org/whl/torch_stable.html
安转openmim
pip install -U openmim
安转mmcv
mim install mmcv-full
下载mmclassification源码
下载地址:https://github.com/open-mmlab/mmclassification
git clone https://github.com/open-mmlab/mmclassification.git
进入mmclassification源码目录
cmd进入下载好的mmclassification源码目录,并激活创建好的环境
安转常用的软件包
pip install scikit-image -i https://pypi.mirrors.ustc.edu.cn/simple/
pip install pillow -i https://pypi.mirrors.ustc.edu.cn/simple/
pip install opencv-python -i https://pypi.mirrors.ustc.edu.cn/simple/
pip install tqdm -i https://pypi.mirrors.ustc.edu.cn/simple/
pip install matplotlib -i https://pypi.mirrors.ustc.edu.cn/simple/
pip install wandb -i https://pypi.mirrors.ustc.edu.cn/simple/
pip install tensorboard -i https://pypi.mirrors.ustc.edu.cn/simple/
安转mmclassification
pip install -v -e .
测试安转是否成功
下载权重
mim download mmcls --config resnet50_8xb32_in1k --dest .
运行检测命令
python demo/image_demo.py demo/demo.JPEG resnet50_8xb32_in1k.py resnet50_8xb32_in1k_20210831-ea4938fc.pth --device cpu
输出如上结果则代表安转成功