diff --git a/PaddleCV/video/metrics/youtube8m/eval_util.py b/PaddleCV/video/metrics/youtube8m/eval_util.py index 67bc2e54d14df350ab659ebaedeec9dd9dd176bc..f7742236f1176073eae84fdc7c3a3a1a2e294fe0 100644 --- a/PaddleCV/video/metrics/youtube8m/eval_util.py +++ b/PaddleCV/video/metrics/youtube8m/eval_util.py @@ -37,7 +37,7 @@ def calculate_hit_at_one(predictions, actuals): float: The average hit at one across the entire batch. """ top_prediction = numpy.argmax(predictions, 1) - hits = actuals[:, top_prediction] + hits = actuals[numpy.arange(actuals.shape[0]), top_prediction] return numpy.average(hits) diff --git a/PaddleCV/video/models/bmn/bmn.py b/PaddleCV/video/models/bmn/bmn.py index 39638dd5b3590922e9ee93f72132f0de2c7e7ee4..e81b6abf2616a28d7b7c86e6f44d5b9eb1157639 100644 --- a/PaddleCV/video/models/bmn/bmn.py +++ b/PaddleCV/video/models/bmn/bmn.py @@ -27,7 +27,15 @@ __all__ = ["BMN"] class BMN(ModelBase): - """BMN model""" + """BMN model from + `"BMN: Boundary-Matching Network for Temporal Action Proposal Generation" `_ + Args: + tscale (int): sequence length, default 100. + dscale (int): max duration length, default 100. + prop_boundary_ratio (float): ratio of expanded temporal region in proposal boundary, default 0.5. + num_sample (int): number of samples betweent starting boundary and ending boundary of each propoasl, default 32. + num_sample_perbin (int): number of selected points in each sample, default 3. + """ def __init__(self, name, cfg, mode='train'): super(BMN, self).__init__(name, cfg, mode=mode) diff --git a/PaddleCV/video/reader/ctcn_reader.py b/PaddleCV/video/reader/ctcn_reader.py index 35ceca6e67bb754a3a480fd272a1a605043a70d6..7488cf988ac46aeb558b6b6b23322a41160f89d9 100644 --- a/PaddleCV/video/reader/ctcn_reader.py +++ b/PaddleCV/video/reader/ctcn_reader.py @@ -425,9 +425,9 @@ class CTCNReader(DataReader): tmp_list = fl[i * file_num:] reader_lists[i] = tmp_list - queue = multiprocessing.Queue(queue_size) + manager = multiprocessing.Manager() + queue = manager.Queue(queue_size) p_list = [None] * len(reader_lists) - # for reader_list in reader_lists: for i in range(len(reader_lists)): reader_list = reader_lists[i] p_list[i] = multiprocessing.Process( diff --git a/dygraph/slowfast/README.md b/dygraph/slowfast/README.md index 3a448d3cb104a2a7456f6a67980a9937d9941061..b7ab9d4bb9ce6604ee1d2eb97f1556825505291f 100644 --- a/dygraph/slowfast/README.md +++ b/dygraph/slowfast/README.md @@ -68,31 +68,8 @@ SlowFast Overview ## 数据准备 -SlowFast模型的训练数据采用Kinetics400数据集,直接输入mp4文件进行训练,数据准备方式如下: +SlowFast模型的训练数据采用Kinetics400数据集,数据下载及准备请参考[数据说明](../PaddleCV/video/data/dataset/README.md) -### mp4视频下载 - -在Code\_Root目录下创建文件夹 - -``` - cd $Code_Root/ && mkdir data - cd data && mkdir data_k400 && cd data_k400 - mkdir train_mp4 && mkdir val_mp4 -``` - -ActivityNet官方提供了Kinetics的下载工具,具体参考其[官方repo](https://github.com/activitynet/ActivityNet/tree/master/Crawler/Kinetics)即可下载Kinetics400的mp4视频集合。将kinetics400的训练与验证集合分别下载到data/data\_k400/train\_mp4与data/data\_k400/val\_mp4。 - -### 生成训练和验证集list - -验证(Validation)和评估(Evaluation)使用同一份数据集,预测(Predict)可以从验证数据集中挑选少量样本进行预测 - -``` - cd $Code_Root/data/ - ls $Code_Root/data/data_k400/train_mp4/* > train.csv - ls $Code_Root/data/data_k400/val_mp4/* > val.csv - ls $Code_Root/data/data_k400/val_mp4/* > test.csv - ls $Code_Root/data/data_k400/val_mp4/* > infer.csv -``` ## 模型训练 diff --git a/dygraph/slowfast/train.py b/dygraph/slowfast/train.py index 48dabcf4b4b1d4daad963785f2fc41373e54ae29..71391997519345ddb4ca364ae72e1c2a0af94f0e 100644 --- a/dygraph/slowfast/train.py +++ b/dygraph/slowfast/train.py @@ -268,7 +268,7 @@ def train(args): random.seed(0) np.random.seed(0) - paddle.framework.manual_seed(0) + paddle.framework.seed(0) with fluid.dygraph.guard(place): # 1. init net if args.use_data_parallel: