1. 准备工作
cuda | 11.3 |
cudnn | cuda11对应最新版即可 |
pytorch | 1.10.1 |
torchvision | 0.11.2 |
torchaudio | 0.10.1 |
2. 环境
conda create -n env_name python=3.9
conda activate env_name
conda install pytorch==1.10.1 torchvision==0.11.2 torchaudio==0.10.1 cudatoolkit=11.3 -c pytorch -c conda-forge#安装detectron2
git clone https://github.com/facebookresearch/detectron2.git
python -m pip install -e detectron2#克隆maskdino库
git clone https://github.com/IDEA-Research/MaskDINO.git
cd ./MaskDINO
pip install -r requirement.txt
cd maskdino/modeling/pixel_decoder/ops
python setup.py build install
3.运行demo
将图片和模型分别放在imgs和weights中,进行测试
python .\demo\demo.py --config-file .\configs\coco\instance-segmentation\maskdino_R50_bs16_50ep_3s.yaml --input .\img\1.jpg --output .\img\2.jpg --opts MODEL.WEIGHTS .\weights\maskdino_r50_50ep_300q_hid1024_3sd1_instance_maskenhanced_mask46.1ap_box51.5ap.pth
OK,顺利结束