-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add TSN dygraph model #4817
base: release/1.8
Are you sure you want to change the base?
add TSN dygraph model #4817
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. |
dygraph/tsn/REAMDE.md
Outdated
|
||
## 数据准备 | ||
|
||
TSN的训练数据采用由DeepMind公布的Kinetics-400动作识别数据集。数据下载及准备请参考[数据说明](./data/dataset/ucf101/README.md) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
【采用Kinetics-400动作识别数据集】,但数据说明链接给的是ucf-101?
dygraph/tsn/REAMDE.md
Outdated
@@ -0,0 +1,70 @@ | |||
# TSN 视频分类模型 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
README.md VS REAMDE.md
dygraph/tsn/REAMDE.md
Outdated
``` | ||
单卡训练所使用的gpu可以通过如下方式设置: | ||
- 首先,修改./configs/tsn.yaml 中的 num_gpus=1 (表示使用单卡进行训练) | ||
- 首先,修改run.sh 中的 export CUDA_VISIBLE_DEVICES=0 (表示使用gpu 0 进行模型训练) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
两个首先,单卡时batch_size要调吗
@@ -0,0 +1,3783 @@ | |||
ApplyEyeMakeup/v_ApplyEyeMakeup_g01_c01.avi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove data list
dygraph/tsn/REAMDE.md
Outdated
@@ -0,0 +1,70 @@ | |||
# TSN 视频分类模型 | |||
本目录下为基于PaddlePaddle 动态图实现的 TSM视频分类模型 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TSM -> TSN
dygraph/tsn/REAMDE.md
Outdated
|
||
## 模型简介 | ||
|
||
Temporal Segment Network (TSN) 是视频分类领域经典的基于2D-CNN的解决方案。该方法主要解决视频的长时间行为判断问题,通过稀疏采样视频帧的方式代替稠密采样,既能捕获视频全局信息,也能去除冗余,降低计算量。最终将每帧特征平均融合后得到视频的整体特征,并用于分类。本代码实现的模型为基于单路RGB图像的TSN网络结构,Backbone采用ResNet-50结构。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ResNet-50 -> ResNet50
dygraph/tsn/REAMDE.md
Outdated
bash multi-gpus-run.sh train ./configs/tsn.yaml | ||
``` | ||
多卡训练所使用的gpu可以通过如下方式设置: | ||
- 首先,修改./configs/tsn.yaml 中的 num_gpus (默认为4,表示使用4个gpu进行训练) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 (表示使用单卡进行训练) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
dygraph/tsn/REAMDE.md
Outdated
|
||
- 使用`run.sh`进行评估时,需要修改脚本中的`weights`参数指定需要评估的权重 | ||
|
||
- `./tsn-test.yaml` 是评估模型时所用的参数文件;`./weights/final.pdparams` 为模型训练完成后,保存的模型文件 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove
dygraph/tsn/reader/reader_utils.py
Outdated
@@ -0,0 +1,81 @@ | |||
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserve. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2020
dygraph/tsn/reader/ucf101_reader.py
Outdated
@@ -0,0 +1,905 @@ | |||
# copyright (c) 2019 PaddlePaddle Authors. All Rights Reserve. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
support frames and video
strategy) | ||
|
||
bs_denominator = 1 | ||
if args.use_gpu: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as remove gpu num
"_" + 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) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if validate
UCF101数据的详细信息可以参考网站[UCF101](https://www.crcv.ucf.edu/data/UCF101.php)。 为了方便用户使用,我们提供了UCF101数据的annotations文件和videos文件的下载脚本。 | ||
|
||
### 下载annotations文件 | ||
首先,请确保在`./data/dataset/ucf101/`目录下,输入如下UCF101数据集的标注文件的命令。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
输入如下命令下载UCF101数据集的标注文件。
生成视频文件的路径list,输入如下命令 | ||
|
||
```python | ||
python build_ucf101_file_list.py videos/ --level 2 --format videos --out_list_path ./ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(1) 生成list的时候建议不要shuffle,在Reader里做shuffle
(2) 最好直接生成绝对路径,Reader代码里不用再输入相对路径
(3) 可以示例一下生成的list文件内容
This PR