TSN(Temporal Segment Networks)代码实验
前言:Temporal Segment Networks (TSN)是在 ECCV 2016 上提出的,作者是Limin Wang, Yuanjun Xiong, Zhe Wang, Yu Qiao, Dahua Lin, Xiaoou Tang, and Luc Van Gool,是一个用于视频中人的行为识别的框架。论文中数据集表现:HMDB51(69.4%)、UCF101(94.2%),在 AcitivityNet challenge 2016 “untrimmed video classification”项目上取得了第一名。
TSN 项目主页:http://yjxiong.me/others/tsn/
TSN 代码 & 模型:https://github.com/yjxiong/temporal-segment-networks
配置问题及解决方案
-
运行 build_all.sh 文件,首先输出报错“E: Unable to correct problems, you have held broken packages”
解决方案:apt-get upgrade apt-get update
参考自:解决 E: Unable to correct problems, you have held broken packages. 问题 - Wasdns - 博客园
-
运行 build_all.sh 文件编译 caffe 时出现“This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer headers. Please update your headers. fatal error: google/protobuf/arena.h: 没有那个文件或目录”
解决方案:
降低 protobuf 版本到 2.6.1,若计算机中有高版本,需要先卸载,再手动安装:wget https://github.com/google/protobuf/releases/download/v2.6.1/protobuf-2.6.1.tar.gz --no-check-certificate #下载 tar -zxvf protobuf-2.6.1.tar.gz # 解压 sudo apt-get install build-essential # 不装会报错 cd protobuf-2.6.1/ # 进入目录 ./configure # 配置安装文件 make # 编译 make check # 检测编译安装的环境 sudo make install # 安装 protoc --version #检查是否安装成功
参考自:
Ubuntu14.04下安装protobuf 2.6.1 - CSDN博客
编译pycaffe错误 –#error This file was generated by a newer version of protoc - CSDN博客 -
测试时遇到:“ImportError: No module named _caffe”,但之前运行 build_all.sh 文件已经提示“Caffe Built.”
解决方案:
build caffe 时需要 boost version ≥ 1.55,但对于一些 Ubuntu 环境,需要先卸载 libboost-all-dev:sudo apt-get remove libboost-all-dev
再安装 libboost1.55-all-dev:
sudo apt-get install libboost1.55-all-dev
参考自:
No module named _caffe · Issue #66 · yjxiong/temporal-segment-networks -
测试时遇到:“ImportError: No module named google.protobuf.internal”
解决方案:
由于计算机中含有多个 Python 环境,可能出现运行时环境未装 protobuf 的情况,故需要确保运行环境下已安装好 protobuf 2.6.1pip install protobuf==2.6.1
测试时遇到:“KeyError: ‘v_ApplyEyeMakeup_g01_c01’”
解决方案:
检查测试语句中 FRAME_PATH 路径
参考自:
Get a Key error when testing accuracy on UCF101 · Issue #102 · yjxiong/temporal-segment-networks
实验结果
在UCF101数据集split1上对TSN进行测试。
仅RGB图像
运行命令:
python tools/eval_net.py ucf101 1 rgb output/optical_flow/ models/ucf101/tsn_bn_inception_rgb_deploy.prototxt models/ucf101_split_1_tsn_rgb_reference_bn_inception.caffemodel --num_worker 1 --save_scores output/score_file.txt
结果:86.02%
仅光流
运行命令:
python tools/eval_net.py ucf101 1 flow output/optical_flow/ models/ucf101/tsn_bn_inception_flow_deploy.prototxt models/ucf101_split_1_tsn_flow_reference_bn_inception.caffemodel --num_worker 1 --save_scores output/flow_score_file
结果:87.66%
融合RGB和光流结果
运行命令:
python tools/eval_scores.py output/rgb_score_file.npz output/flow_score_file.npz --score_weights 1 1.5
结果:93.51%