项目地址
https://github.com/facebookresearch/SlowFast
安装教程
首先参考官方安装必须的包并下载项目文件:https://github.com/facebookresearch/SlowFast/blob/main/INSTALL.md
安装注意:
- 最好使用Linux系统,如果是windows系统,请注意Vsual Studio的版本和CUDA的版本要对应,否则有些东西无法编译。
- 教程的最后一步先不要管:
运行前的准备
1.下载权重文件 ‘SLOWFAST_32x2_R101_50_50.pkl’
在终端输入下面的命令下载:
wget https://dl.fbaipublicfiles.com/pyslowfast/model_zoo/ava/SLOWFAST_32x2_R101_50_50_v2.1.pkl
下载后放到 AVA 目录下:
2.在AVA目录下新建ava.json标注文件,如上图
ava.json内容如下:
{
"bend/bow(at the waist)": 0,
"crawl": 1,
"crouch/kneel": 2,
"dance": 3,
"fall down": 4,
"get up": 5,
"jump/leap": 6,
"lie/sleep": 7,
"martial art": 8,
"run/jog": 9,
"sit": 10,
"stand": 11,
"swim": 12,
"walk": 13,
"answer phone": 14,
"brush teeth": 15,
"carry/hold (an object)": 16,
"catch (an object)": 17,
"chop": 18,
"climb (e.g. a mountain)": 19,
"clink glass": 20,
"close (e.g., a door, a box)": 21,
"cook": 22,
"cut": 23,
"dig": 24,
"dress/put on clothing": 25,
"drink": 26,
"drive (e.g., a car, a truck)": 27,
"eat": 28,
"enter": 29,
"exit": 30,
"extract": 31,
"fishing": 32,
"hit (an object)": 33,
"kick (an object)": 34,
"lift/pick up": 35,
"listen (e.g., to music)": 36,
"open (e.g., a window, a car door)": 37,
"paint": 38,
"play board game": 39,
"play musical instrument": 40,
"play with pets": 41,
"point to (an object)": 42,
"press": 43,
"pull (an object)": 44,
"push (an object)": 45,
"put down": 46,
"read": 47,
"ride (e.g., a bike, a car, a horse)": 48,
"row boat": 49,
"sail boat": 50,
"shoot": 51,
"shovel": 52,
"smoke": 53,
"stir": 54,
"take a photo": 55,
"text on/look at a cellphone": 56,
"throw": 57,
"touch (an object)": 58,
"turn (e.g., a screwdriver)": 59,
"watch (e.g., TV)": 60,
"work on a computer": 61,
"write": 62,
"fight/hit (a person)": 63,
"give/serve (an object) to (a person)": 64,
"grab (a person)": 65,
"hand clap": 66,
"hand shake": 67,
"hand wave": 68,
"hug (a person)": 69,
"kick (a person)": 70,
"kiss (a person)": 71,
"lift (a person)": 72,
"listen to (a person)": 73,
"play with kids": 74,
"push (another person)": 75,
"sing to (e.g., self, a person, a group)": 76
}
3.更改配置文件
在目录中找到 SLOWFAST_32x2_R101_50_50.yaml 文件
更改的内容如下:
其中 INPUT_VIDEO 和 OUTPUT_FILE需要自己添加。
INPUT_VIDEO 是要输入进行检测的视频。OUTPUT_FILE是检测后保存的检测结果。
路径都推荐用绝对路径。
WEBCAM要改成-1,默认为0,读取本地摄像头。
运行
运行命令(配置文件请替换成自己的路径):
python run_net.py --cfg /root/autodl-tmp/slowfast/demo/AVA/SLOWFAST_32x2_R101_50_50.yaml
运行成功(请忽略user warning):
视频检测结果: