MMaction2行为分析安装与测试

一、安装mmcv-full

GitHub - open-mmlab/mmcv: OpenMMLab Computer Vision Foundation

MMaction2行为分析安装与测试_第1张图片

不支持torch低的版本。

本机环境cuda10.1,python3.7,torch1.7.1,torchvision0.8.2 对应下载链接:

pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu101/torch1.7.1/index.html

MMaction2行为分析安装与测试_第2张图片

pip install mmpycocotools
pip install moviepy  terminaltables seaborn decord -i https://pypi.douban.com/simple
自行安装opencv:https://blog.csdn.net/qq_34717531/article/details/107763872?spm=1001.2014.3001.5502

二、安装 mmaction2

下载mmaction2 安装包:YFwinstony/JN-OpenLib-mmaction2

cd JN-OpenLib-mmaction2-main
python setup.py develop

MMaction2行为分析安装与测试_第3张图片 

注:会提示版本不符合

修改   __init__.py   ,

mmcv_maximum_version = '1.5.0'即可 ,我的mvcc-full版本是1.5.0

import mmcv

from .version import __version__, short_version


def digit_version(version_str):
    digit_version = []
    for x in version_str.split('.'):
        if x.isdigit():
            digit_version.append(int(x))
        elif x.find('rc') != -1:
            patch_version = x.split('rc')
            digit_version.append(int(patch_version[0]) - 1)
            digit_version.append(int(patch_version[1]))
    return digit_version


mmcv_minimum_version = '1.2.4'
mmcv_maximum_version = '1.5.0'
mmcv_version = digit_version(mmcv.__version__)


assert (mmcv_version >= digit_version(mmcv_minimum_version)
        and mmcv_version <= digit_version(mmcv_maximum_version)), \
    f'MMCV=={mmcv.__version__} is used but incompatible. ' \
    f'Please install mmcv>={mmcv_minimum_version}, <={mmcv_maximum_version}.'

__all__ = ['__version__', 'short_version']

三、测试

准备一个视频 4.mp4,执行:

python demo/demo_spatiotemporal_det.py --video demo/4.mp4 --config configs/detection/ava/slowonly_omnisource_pretrained_r101_8x8x1_20e_ava_rgb.py     --checkpoint https://download.openmmlab.com/mmaction/detection/ava/slowonly_omnisource_pretrained_r101_8x8x1_20e_ava_rgb/slowonly_omnisource_pretrained_r101_8x8x1_20e_ava_rgb_20201217-16378594.pth     --det-config demo/faster_rcnn_r50_fpn_2x_coco.py     --det-checkpoint http://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     --det-score-thr 0.9     --action-score-thr 0.5     --label-map demo/label_map_ava.txt     --predict-stepsize 8     --output-stepsize 4     --output-fps 6 --out-filename demo/out_4.mp4

结果:

MMaction2行为分析安装与测试_第4张图片

 

你可能感兴趣的