add TSN dygraph model#4817
Open
LiuChaoXD wants to merge 7 commits intoPaddlePaddle:release/1.8from
LiuChaoXD:liuchao45-tsn
Open
add TSN dygraph model#4817LiuChaoXD wants to merge 7 commits intoPaddlePaddle:release/1.8from LiuChaoXD:liuchao45-tsn
LiuChaoXD wants to merge 7 commits intoPaddlePaddle:release/1.8from
LiuChaoXD:liuchao45-tsn
Conversation
|
root seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
huangjun12
reviewed
Aug 28, 2020
dygraph/tsn/REAMDE.md
Outdated
|
|
||
| ## 数据准备 | ||
|
|
||
| TSN的训练数据采用由DeepMind公布的Kinetics-400动作识别数据集。数据下载及准备请参考[数据说明](./data/dataset/ucf101/README.md) |
Contributor
There was a problem hiding this comment.
【采用Kinetics-400动作识别数据集】,但数据说明链接给的是ucf-101?
dygraph/tsn/REAMDE.md
Outdated
| @@ -0,0 +1,70 @@ | |||
| # TSN 视频分类模型 | |||
dygraph/tsn/REAMDE.md
Outdated
| ``` | ||
| 单卡训练所使用的gpu可以通过如下方式设置: | ||
| - 首先,修改./configs/tsn.yaml 中的 num_gpus=1 (表示使用单卡进行训练) | ||
| - 首先,修改run.sh 中的 export CUDA_VISIBLE_DEVICES=0 (表示使用gpu 0 进行模型训练) |
| @@ -0,0 +1,3783 @@ | |||
| ApplyEyeMakeup/v_ApplyEyeMakeup_g01_c01.avi | |||
shippingwang
requested changes
Aug 28, 2020
dygraph/tsn/REAMDE.md
Outdated
| @@ -0,0 +1,70 @@ | |||
| # TSN 视频分类模型 | |||
| 本目录下为基于PaddlePaddle 动态图实现的 TSM视频分类模型 | |||
dygraph/tsn/REAMDE.md
Outdated
|
|
||
| ## 模型简介 | ||
|
|
||
| Temporal Segment Network (TSN) 是视频分类领域经典的基于2D-CNN的解决方案。该方法主要解决视频的长时间行为判断问题,通过稀疏采样视频帧的方式代替稠密采样,既能捕获视频全局信息,也能去除冗余,降低计算量。最终将每帧特征平均融合后得到视频的整体特征,并用于分类。本代码实现的模型为基于单路RGB图像的TSN网络结构,Backbone采用ResNet-50结构。 |
dygraph/tsn/REAMDE.md
Outdated
| bash multi-gpus-run.sh train ./configs/tsn.yaml | ||
| ``` | ||
| 多卡训练所使用的gpu可以通过如下方式设置: | ||
| - 首先,修改./configs/tsn.yaml 中的 num_gpus (默认为4,表示使用4个gpu进行训练) |
Member
There was a problem hiding this comment.
It is unnecessary to keep num_gpus in configuration, GPU_ID can be obtained by gpu_id = int(os.environ.get('FLAGS_selected_gpus', 0))
dygraph/tsn/REAMDE.md
Outdated
| bash run.sh train ./configs/tsn.yaml | ||
| ``` | ||
| 单卡训练所使用的gpu可以通过如下方式设置: | ||
| - 首先,修改./configs/tsn.yaml 中的 num_gpus=1 (表示使用单卡进行训练) |
dygraph/tsn/REAMDE.md
Outdated
|
|
||
| - 使用`run.sh`进行评估时,需要修改脚本中的`weights`参数指定需要评估的权重 | ||
|
|
||
| - `./tsn-test.yaml` 是评估模型时所用的参数文件;`./weights/final.pdparams` 为模型训练完成后,保存的模型文件 |
Member
There was a problem hiding this comment.
use underline instead of dash name files
dygraph/tsn/model.py
Outdated
| y = fluid.layers.elementwise_add(x=short, y=conv2) | ||
| return fluid.layers.relu(y) | ||
|
|
||
| # layer_helper = LayerHelper(self.full_name(), act="relu") |
dygraph/tsn/reader/reader_utils.py
Outdated
| @@ -0,0 +1,81 @@ | |||
| # Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserve. | |||
dygraph/tsn/reader/ucf101_reader.py
Outdated
| @@ -0,0 +1,905 @@ | |||
| # copyright (c) 2019 PaddlePaddle Authors. All Rights Reserve. | |||
| strategy) | ||
|
|
||
| bs_denominator = 1 | ||
| if args.use_gpu: |
| "_" + model_path_pre + "_epoch{}".format(epoch)) | ||
| fluid.dygraph.save_dygraph(video_model.state_dict(), model_path) | ||
| fluid.dygraph.save_dygraph(optimizer.state_dict(), model_path) | ||
|
|
shippingwang
approved these changes
Sep 1, 2020
huangjun12
reviewed
Sep 9, 2020
| UCF101数据的详细信息可以参考网站[UCF101](https://www.crcv.ucf.edu/data/UCF101.php)。 为了方便用户使用,我们提供了UCF101数据的annotations文件和videos文件的下载脚本。 | ||
|
|
||
| ### 下载annotations文件 | ||
| 首先,请确保在`./data/dataset/ucf101/`目录下,输入如下UCF101数据集的标注文件的命令。 |
| 生成视频文件的路径list,输入如下命令 | ||
|
|
||
| ```python | ||
| python build_ucf101_file_list.py videos/ --level 2 --format videos --out_list_path ./ |
Contributor
There was a problem hiding this comment.
(1) 生成list的时候建议不要shuffle,在Reader里做shuffle
(2) 最好直接生成绝对路径,Reader代码里不用再输入相对路径
(3) 可以示例一下生成的list文件内容
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR