#pytorch 1.10.0
#python=3.8
#cpu
创建环境
conda create -n mmact python=3.8
conda activate mmact
1.Pytorch安装:
官网寻找自己对应的版本。
# CPU Only
conda install pytorch==1.10.0 torchvision==0.11.0 torchaudio==0.10.0 cpuonly -c pytorch
2.MMCV-full安装:
在对应位置看一下当前mmaction2版本兼容最低和最高版本。
官网寻找自己对应的版本。
安装
pip install mmcv-full==1.4.7 -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.10/index.html
3.ffmpeg安装
到ffmpeg官网https://ffmpeg.org/download.html
下载对应版本。
解压文件,进入bin目录,能看到ffmpeg.exe、ffplay.exe、ffprobe.exe三个文件。不用管它,进行下一步。
设置环境变量
点击“系统属性->高级系统设置->环境变量->用户变量”,选择“Path”条目,点击“编辑->新建”,把第一步的bin文件夹路径复制粘贴进去,然后点击确定即可。
4.安装mmaction2
git clone https://github.com/open-mmlab/mmaction2.git
cd mmaction2
pip install -r requirements.txt
python setup.py develop
5.安装mmdetection2
git clone https://github.com/open-mmlab/mmdetection.git
cd mmdetection
conda install git
pip install -r requirements.txt
pip intall 出现 error: subprocess-exited-with-error 错误的解决办法:
pip install --upgrade setuptools
若mmtracting还报错
pip install git+https://github.com/open-mmlab/mmtracking#egg=mmtrack
之后会报错关于error: Microsoft Visual C++ 14.0 or greater is required,
pycocotools安装失败。
默认安装VisualCppBuildToolsFull.exe
下载:https://pan.baidu.com/s/11y0p4bI-S_XC0jBNTqFPzw
点击装载,
然后双击exe,安装默认安装即可。
之后运行
python setup.py develop
6.demo测试
将mmdetection中的mmdet复制到mmaction中
下载训练权重
wget https://download.openmmlab.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_r50_fpn_2x_coco/faster_rcnn_r50_fpn_2x_coco_bbox_mAP-0.384_20200504_210434-a5d8aa15.pth -P ./Checkpionts/mmdetection/
wget https://download.openmmlab.com/mmaction/recognition/slowfast/slowfast_r50_8x8x1_256e_kinetics400_rgb/slowfast_r50_8x8x1_256e_kinetics400_rgb_20200716-73547d2b.pth -P ./Checkpionts/mmaction/
demo运行
python demo/demo_spatiotemporal_det.py --config configs/detection/ava/slowfast_kinetics_pretrained_r50_8x8x1_20e_ava_rgb.py --checkpoint Checkpionts/mmaction/slowfast_r50_8x8x1_256e_kinetics400_rgb_20200716-73547d2b.pth --det-config demo/faster_rcnn_r50_fpn_2x_coco.py --det-checkpoint Checkpionts/mmdetection/faster_rcnn_r50_fpn_2x_coco_bbox_mAP-0.384_20200504_210434-a5d8aa15.pth --video demo/demo.mp4 --out-filename demo/demoOut.mp4 --det-score-thr 0.9 --action-score-thr 0.5 --output-stepsize 4 --output-fps 6