Commit 15030086 authored by chenych's avatar chenych
Browse files

Merge branch 'master' into 'master'

Add icon and chenge SCNET

See merge request !1
parents 481ca115 087e4a1a
# TSM # TSM
## 论文 ## 论文
`TSM: Temporal Shift Module for Efficient Video Understanding` `TSM: Temporal Shift Module for Efficient Video Understanding`
- https://openaccess.thecvf.com/content_ICCV_2019/html/Lin_TSM_Temporal_Shift_Module_for_Efficient_Video_Understanding_ICCV_2019_paper.html
- [TSM: Temporal Shift Module for Efficient Video Understanding](https://openaccess.thecvf.com/content_ICCV_2019/html/Lin_TSM_Temporal_Shift_Module_for_Efficient_Video_Understanding_ICCV_2019_paper.html)
## 模型结构 ## 模型结构
TSM模型的结构由一个时间偏移模块和一个分类器组成,其中时间偏移模块通过将输入的视频特征序列进行平移来利用不同时间偏移版本的信息,而分类器则用于对经过时间偏移的特征进行分类。 TSM模型的结构由一个时间偏移模块和一个分类器组成,其中时间偏移模块通过将输入的视频特征序列进行平移来利用不同时间偏移版本的信息,而分类器则用于对经过时间偏移的特征进行分类。
![TSM_model](TSM_model.png) ![TSM_model](TSM_model.png)
## 算法原理 ## 算法原理
TSM模型通过在时间维度上应用偏移操作,将输入的视频特征序列进行平移,从而利用时间信息的不同偏移版本来增强模型对视频动态变化的感知能力。 TSM模型通过在时间维度上应用偏移操作,将输入的视频特征序列进行平移,从而利用时间信息的不同偏移版本来增强模型对视频动态变化的感知能力。
![TSM_model2](TSM_model2.png) ![TSM_model2](TSM_model2.png)
## 环境配置 ## 环境配置
### Docker(方法一) ### Docker(方法一)
此处提供[光源](https://www.sourcefind.cn/#/service-details)拉取docker镜像的地址与使用步骤
``` ```
docker pull image.sourcefind.cn:5000/dcu/admin/base/pytorch:1.10.0-centos7.6-dtk-22.10-py38-latest docker pull image.sourcefind.cn:5000/dcu/admin/base/pytorch:1.10.0-centos7.6-dtk-22.10-py38-latest
docker run -it -v /path/your_code_data/:/path/your_code_data/ --shm-size=32G --privileged=true --device=/dev/kfd --device=/dev/dri/ --group-add video --name docker_name imageID bash docker run -it -v /path/your_code_data/:/path/your_code_data/ --shm-size=32G --privileged=true --device=/dev/kfd --device=/dev/dri/ --group-add video --name docker_name imageID bash
``` ```
### Dockerfile(方法二) ### Dockerfile(方法二)
此处提供dockerfile的使用方法
``` ```
cd ./docker cd ./docker
docker build --no-cache -t tsm:1.0 . docker build --no-cache -t tsm:1.0 .
docker run -it -v /path/your_code_data/:/path/your_code_data/ --shm-size=32G --privileged=true --device=/dev/kfd --device=/dev/dri/ --group-add video --name docker_name imageID bash docker run -it -v /path/your_code_data/:/path/your_code_data/ --shm-size=32G --privileged=true --device=/dev/kfd --device=/dev/dri/ --group-add video --name docker_name imageID bash
``` ```
### Anaconda(方法三) ### Anaconda(方法三)
此处提供本地配置、编译的详细步骤,例如:
关于本项目DCU显卡所需的特殊深度学习库可从[光合](https://developer.hpccube.com/tool/)开发者社区下载安装。 关于本项目DCU显卡所需的特殊深度学习库可从[光合](https://developer.hpccube.com/tool/)开发者社区下载安装。
``` ```
DTK驱动:dtk22.10 DTK驱动:dtk22.10
...@@ -51,44 +45,39 @@ pip3 install yapf==0.32.0 ...@@ -51,44 +45,39 @@ pip3 install yapf==0.32.0
## 数据集 ## 数据集
`something v2` `something v2`
- http://113.200.138.88:18080/aidatasets/project-dependency/something
- 百度网盘: 数据预处理步骤:
https://pan.baidu.com/s/1NCqL7JVoFZO6D131zGls-A#list/path=%2F&parentPath=%2Fsharelink3725532333-553839935448680 密码:07ka
预训练模型文件:[resnet50_8xb32_in1k_20210831-ea4938fc.pth](https://download.openmmlab.com/mmclassification/v0/resnet/resnet50_8xb32_in1k_20210831-ea4938fc.pth)
### 数据预处理 1. 进入工程目录后,创建data子目录,进入data目录,创建软链接指向数据集实际路径:
进入工程目录后,创建data子目录,进入data目录,创建软链接指向数据集实际路径:
``` ```
cd tsm_pytorch cd tsm_pytorch
mkdir data mkdir data
cd data cd data
ln -s /dataset/ sthv2 ln -s /dataset/ sthv2
``` ```
使用如下指令进行解压
2. 使用如下指令进行解压
``` ```
cat 20bn-something-something-v2-?? | tar zx cat 20bn-something-something-v2-?? | tar zx
``` ```
将解压之后得到的20bn-something-something-v2文件夹重命名为videos
解压完成后使用如下命令抽取RGB帧 3. 将解压之后得到的20bn-something-something-v2文件夹重命名为videos
``` 4. 解压完成后使用如下命令抽取RGB帧
```bash
cd /workspace/tools/data/sthv2/ cd /workspace/tools/data/sthv2/
bash extract_rgb_frames_opencv.sh bash extract_rgb_frames_opencv.sh
``` ```
抽帧结束后,在sthv2里面创建annotations目录,将标注文件(something-something-v2-labels.json、something-something-v2-test.json、something-something-v2-train.json、something-something-v2-validation.json)移动到annotations子目录中 5. 抽帧结束后,在sthv2里面创建annotations目录,将标注文件(something-something-v2-labels.json、something-something-v2-test.json、something-something-v2-train.json、something-something-v2-validation.json)移动到annotations子目录中
``` ```bash
cd /workspace/tools/data/sthv2/ cd /workspace/tools/data/sthv2/
bash generate_rawframes_filelist.sh bash generate_rawframes_filelist.sh
``` ```
预处理之后,目录结构如下: 预处理之后,目录结构如下:
``` ```
...@@ -118,6 +107,7 @@ bash generate_rawframes_filelist.sh ...@@ -118,6 +107,7 @@ bash generate_rawframes_filelist.sh
├── sthv2_val_list_rawframes.txt ├── sthv2_val_list_rawframes.txt
└── videos └── videos
``` ```
## 训练 ## 训练
### 单机多卡 ### 单机多卡
``` ```
...@@ -125,13 +115,11 @@ bash train.sh ...@@ -125,13 +115,11 @@ bash train.sh
``` ```
### 单机单卡 ### 单机单卡
``` ```
bash train_single.sh bash train_single.sh
``` ```
## result ## result
测试的日志会以tsm_dcu_date.log的形式保存在工程的根目录中 测试的日志会以tsm_dcu_date.log的形式保存在工程的根目录中
<figure> <figure>
...@@ -142,21 +130,25 @@ bash train_single.sh ...@@ -142,21 +130,25 @@ bash train_single.sh
</figure> </figure>
### 精度 ### 精度
测试数据:something v2,使用的加速卡:Z100L。 测试数据:something v2,使用的加速卡:Z100L。
根据测试结果情况填写表格: 根据测试结果情况填写表格:
| 卡数 | 准确率 | | 卡数 | 准确率 |
| :------: | :------: | | :------: | :------: |
| 4 | 59.14% | | 4 | 59.14% |
## 应用场景 ## 应用场景
### 算法类别 ### 算法类别
`动作识别` 动作识别
### 热点应用行业 ### 热点应用行业
`交通,政府,家居` 交通,政府,家居
## 预训练权重
[resnet50_8xb32_in1k_20210831-ea4938fc.pth](http://113.200.138.88:18080/aimodels/findsource-dependency/resnet50_8xb32_in1k_20210831-ea4938fc/-/raw/master/resnet50_8xb32_in1k_20210831-ea4938fc.pth)
## 源码仓库及问题反馈 ## 源码仓库及问题反馈
- http://developer.hpccube.com/codes/modelzoo/tsm_pytorch.git - http://developer.hpccube.com/codes/modelzoo/tsm_pytorch.git
## 参考资料 ## 参考资料
- https://github.com/open-mmlab/mmaction2 - https://github.com/open-mmlab/mmaction2
icon.png

48.5 KB

Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment