From 971509fab5baebca2bfb6fdb32d9b6199197a82a Mon Sep 17 00:00:00 2001 From: SunGaofeng Date: Mon, 27 May 2019 01:02:39 -0500 Subject: [PATCH] add pretrain related statement in readme (#2315) this is for issue #2232 add pretrain description in readme to show that some models need pertained models to begin training. --- PaddleCV/video/configs/nonlocal.txt | 1 + PaddleCV/video/models/nonlocal_model/README.md | 4 +++- PaddleCV/video/models/nonlocal_model/nonlocal_model.py | 5 ++++- PaddleCV/video/models/stnet/README.md | 3 +++ PaddleCV/video/models/tsm/README.md | 3 +++ PaddleCV/video/models/tsn/README.md | 3 +++ 6 files changed, 17 insertions(+), 2 deletions(-) diff --git a/PaddleCV/video/configs/nonlocal.txt b/PaddleCV/video/configs/nonlocal.txt index ff7dc81c..955ea402 100644 --- a/PaddleCV/video/configs/nonlocal.txt +++ b/PaddleCV/video/configs/nonlocal.txt @@ -34,6 +34,7 @@ use_bn = True use_affine = False [TRAIN] +epoch = 120 num_reader_threads = 8 batch_size = 64 num_gpus = 8 diff --git a/PaddleCV/video/models/nonlocal_model/README.md b/PaddleCV/video/models/nonlocal_model/README.md index ec5411bc..c551b6ea 100644 --- a/PaddleCV/video/models/nonlocal_model/README.md +++ b/PaddleCV/video/models/nonlocal_model/README.md @@ -93,9 +93,11 @@ Non-local模型的训练数据采用由DeepMind公布的Kinetics-400动作识别 --save_dir=checkpoints --log_interval=10 --valid_interval=1 - + --pretrain=${path_to_pretrain_model} bash scripts/train/train_nonlocal.sh +- 从头开始训练,需要加载在ImageNet上训练的ResNet50权重作为初始化参数(该模型参数转自Caffe2)。请下载此[模型参数](https://paddlemodels.bj.bcebos.com/video_classification/Nonlocal_ResNet50_pretrained.tar.gz)并解压,将上面启动脚本中的path\_to\_pretrain\_model设置为解压之后的模型参数存放路径。如果没有手动下载并设置path\_to\_pretrain\_model,则程序会自动下载并将参数保存在~/.paddle/weights/Nonlocal\_ResNet50\_pretrained目录下面 + - 可下载已发布模型[model](https://paddlemodels.bj.bcebos.com/video_classification/nonlocal_kinetics.tar.gz)通过`--resume`指定权重存放路径进行finetune等开发 **数据读取器说明:** 模型读取Kinetics-400数据集中的`mp4`数据,根据视频长度和采样频率随机选取起始帧的位置,每个视频抽取`video_length`帧图像,对每帧图像做随机增强,短边缩放至[256, 320]之间的某个随机数,长边根据长宽比计算出来,然后再截取出224x224的区域作为训练数据输入网络。 diff --git a/PaddleCV/video/models/nonlocal_model/nonlocal_model.py b/PaddleCV/video/models/nonlocal_model/nonlocal_model.py index 689106c1..cdb366eb 100644 --- a/PaddleCV/video/models/nonlocal_model/nonlocal_model.py +++ b/PaddleCV/video/models/nonlocal_model/nonlocal_model.py @@ -120,7 +120,10 @@ class NonLocal(ModelBase): self.feature_input + [self.label_input] def pretrain_info(self): - return None, None + return ( + 'Nonlocal_ResNet50_pretrained', + 'https://paddlemodels.bj.bcebos.com/video_classification/Nonlocal_ResNet50_pretrained.tar.gz' + ) def weights_info(self): pass diff --git a/PaddleCV/video/models/stnet/README.md b/PaddleCV/video/models/stnet/README.md index 15fe1ef3..6771cde1 100644 --- a/PaddleCV/video/models/stnet/README.md +++ b/PaddleCV/video/models/stnet/README.md @@ -35,9 +35,12 @@ StNet的训练数据采用由DeepMind公布的Kinetics-400动作识别数据集 --save_dir=checkpoints --log_interval=10 --valid_interval=1 + --pretrain=${path_to_pretrain_model} bash scripts/train/train_stnet.sh +- 从头开始训练,需要加载在ImageNet上训练的ResNet50权重作为初始化参数,请下载此[模型参数](https://paddlemodels.bj.bcebos.com/video_classification/ResNet50_pretrained.tar.gz)并解压,将上面启动脚本中的path\_to\_pretrain\_model设置为解压之后的模型参数存放路径。如果没有手动下载并设置path\_to\_pretrain\_model,则程序会自动下载并将参数保存在~/.paddle/weights/ResNet50\_pretrained目录下面 + - 可下载已发布模型[model](https://paddlemodels.bj.bcebos.com/video_classification/stnet_kinetics.tar.gz)通过`--resume`指定权重存放路径进行finetune等开发 **数据读取器说明:** 模型读取Kinetics-400数据集中的`mp4`数据,每条数据抽取`seg_num`段,每段抽取`seg_len`帧图像,对每帧图像做随机增强后,缩放至`target_size`。 diff --git a/PaddleCV/video/models/tsm/README.md b/PaddleCV/video/models/tsm/README.md index faa994e7..1e35d29b 100644 --- a/PaddleCV/video/models/tsm/README.md +++ b/PaddleCV/video/models/tsm/README.md @@ -42,9 +42,12 @@ TSM的训练数据采用由DeepMind公布的Kinetics-400动作识别数据集。 --save_dir=checkpoints --log_interval=10 --valid_interval=1 + --pretrain=${path_to_pretrain_model} bash scripts/train/train_tsm.sh +- 从头开始训练,需要加载在ImageNet上训练的ResNet50权重作为初始化参数,请下载此[模型参数](https://paddlemodels.bj.bcebos.com/video_classification/ResNet50_pretrained.tar.gz)并解压,将上面启动脚本中的path\_to\_pretrain\_model设置为解压之后的模型参数存放路径。如果没有手动下载并设置path\_to\_pretrain\_model,则程序会自动下载并将参数保存在~/.paddle/weights/ResNet50\_pretrained目录下面 + - 可下载已发布模型[model](https://paddlemodels.bj.bcebos.com/video_classification/tsm_kinetics.tar.gz)通过`--resume`指定权重存放路径进行finetune等开发 **数据读取器说明:** 模型读取Kinetics-400数据集中的`mp4`数据,每条数据抽取`seg_num`段,每段抽取1帧图像,对每帧图像做随机增强后,缩放至`target_size`。 diff --git a/PaddleCV/video/models/tsn/README.md b/PaddleCV/video/models/tsn/README.md index 800fdf95..ebb40ebb 100644 --- a/PaddleCV/video/models/tsn/README.md +++ b/PaddleCV/video/models/tsn/README.md @@ -30,9 +30,12 @@ TSN的训练数据采用由DeepMind公布的Kinetics-400动作识别数据集。 --save_dir=checkpoints --log_interval=10 --valid_interval=1 + --pretrain=${path_to_pretrain_model} bash scripts/train/train_tsn.sh +- 从头开始训练,需要加载在ImageNet上训练的ResNet50权重作为初始化参数,请下载此[模型参数](https://paddlemodels.bj.bcebos.com/video_classification/ResNet50_pretrained.tar.gz)并解压,将上面启动脚本中的path\_to\_pretrain\_model设置为解压之后的模型参数存放路径。如果没有手动下载并设置path\_to\_pretrain\_model,则程序会自动下载并将参数保存在~/.paddle/weights/ResNet50\_pretrained目录下面 + - 可下载已发布模型[model](https://paddlemodels.bj.bcebos.com/video_classification/tsn_kinetics.tar.gz)通过`--resume`指定权重存放路径进行finetune等开发 **数据读取器说明:** 模型读取Kinetics-400数据集中的`mp4`数据,每条数据抽取`seg_num`段,每段抽取1帧图像,对每帧图像做随机增强后,缩放至`target_size`。 -- GitLab