Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
ebb8f1ee
M
models
项目概览
PaddlePaddle
/
models
1 年多 前同步成功
通知
222
Star
6828
Fork
2962
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
602
列表
看板
标记
里程碑
合并请求
255
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
models
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
602
Issue
602
列表
看板
标记
里程碑
合并请求
255
合并请求
255
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
ebb8f1ee
编写于
1月 31, 2019
作者:
S
SunGaofeng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix test and infer for new reader and metrics
上级
c5e356c9
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
27 addition
and
22 deletion
+27
-22
fluid/PaddleCV/video/configs/attention_cluster.txt
fluid/PaddleCV/video/configs/attention_cluster.txt
+1
-1
fluid/PaddleCV/video/configs/attention_lstm.txt
fluid/PaddleCV/video/configs/attention_lstm.txt
+1
-1
fluid/PaddleCV/video/datareader/kinetics_reader.py
fluid/PaddleCV/video/datareader/kinetics_reader.py
+6
-6
fluid/PaddleCV/video/infer.py
fluid/PaddleCV/video/infer.py
+4
-3
fluid/PaddleCV/video/scripts/infer/infer_attention_cluster.sh
...d/PaddleCV/video/scripts/infer/infer_attention_cluster.sh
+1
-1
fluid/PaddleCV/video/scripts/test/test_attention_cluster.sh
fluid/PaddleCV/video/scripts/test/test_attention_cluster.sh
+1
-1
fluid/PaddleCV/video/scripts/train/train_attention_cluster.sh
...d/PaddleCV/video/scripts/train/train_attention_cluster.sh
+1
-1
fluid/PaddleCV/video/test.py
fluid/PaddleCV/video/test.py
+5
-4
fluid/PaddleCV/video/train.py
fluid/PaddleCV/video/train.py
+7
-4
未找到文件。
fluid/PaddleCV/video/configs/attention_cluster.txt
浏览文件 @
ebb8f1ee
...
...
@@ -17,7 +17,7 @@ learning_rate = 0.001
pretrain_base = None
batch_size = 160
use_gpu = True
gpu_num
= 4
num_gpus
= 4
filelist = "data/youtube8m/train.list"
[VALID]
...
...
fluid/PaddleCV/video/configs/attention_lstm.txt
浏览文件 @
ebb8f1ee
...
...
@@ -21,7 +21,7 @@ num_samples = 5000000
pretrain_base = None
batch_size = 160
use_gpu = True
gpu_num
= 4
num_gpus
= 4
filelist = "data/youtube8m/train.list"
[VALID]
...
...
fluid/PaddleCV/video/datareader/kinetics_reader.py
浏览文件 @
ebb8f1ee
...
...
@@ -56,12 +56,12 @@ class KineticsReader(DataReader):
def
__init__
(
self
,
name
,
phase
,
cfg
):
self
.
name
=
name
self
.
phase
=
phase
self
.
format
=
cfg
.
MODEL
.
format
#cfg['format']
self
.
num_classes
=
cfg
.
MODEL
.
num_classes
#cfg['num_classes']
self
.
seg_num
=
cfg
.
MODEL
.
seg
num
#['seg_num']
self
.
seglen
=
cfg
.
MODEL
.
seglen
#['seglen']
self
.
short_size
=
cfg
[
phase
.
upper
()][
'short_size'
]
# ['short_size']
self
.
target_size
=
cfg
[
phase
.
upper
()][
'target_size'
]
#['target_size']
self
.
format
=
cfg
.
MODEL
.
format
self
.
num_classes
=
cfg
.
MODEL
.
num_classes
self
.
seg_num
=
cfg
.
MODEL
.
seg
_num
self
.
seglen
=
cfg
.
MODEL
.
seglen
self
.
short_size
=
cfg
[
phase
.
upper
()][
'short_size'
]
self
.
target_size
=
cfg
[
phase
.
upper
()][
'target_size'
]
self
.
num_reader_threads
=
cfg
[
phase
.
upper
()][
'num_reader_threads'
]
self
.
buf_size
=
cfg
[
phase
.
upper
()][
'buf_size'
]
...
...
fluid/PaddleCV/video/infer.py
浏览文件 @
ebb8f1ee
...
...
@@ -26,6 +26,7 @@ import paddle.fluid as fluid
from
config
import
*
import
models
from
datareader
import
get_reader
FORMAT
=
'[%(levelname)s: %(filename)s: %(lineno)4d]: %(message)s'
logging
.
basicConfig
(
level
=
logging
.
DEBUG
,
format
=
FORMAT
,
stream
=
sys
.
stdout
)
...
...
@@ -81,8 +82,7 @@ def infer(args):
# parse config
config
=
parse_config
(
args
.
config
)
infer_config
=
merge_configs
(
config
,
'infer'
,
vars
(
args
))
infer_model
=
models
.
get_model
(
args
.
model_name
,
infer_config
,
mode
=
'infer'
)
infer_model
=
models
.
get_model
(
args
.
model_name
,
infer_config
,
mode
=
'infer'
)
infer_model
.
build_input
(
use_pyreader
=
False
)
infer_model
.
build_model
()
...
...
@@ -97,7 +97,8 @@ def infer(args):
logger
.
error
(
"[INFER] --filelist unset."
)
return
assert
os
.
path
.
exists
(
args
.
filelist
),
"{} not exist."
.
format
(
args
.
filelist
)
infer_reader
=
infer_model
.
reader
()
infer_reader
=
get_reader
(
args
.
model_name
.
upper
(),
'infer'
,
infer_config
)
if
args
.
weights
:
assert
os
.
path
.
exists
(
...
...
fluid/PaddleCV/video/scripts/infer/infer_attention_cluster.sh
浏览文件 @
ebb8f1ee
python infer.py
--model-name
=
"AttentionCluster"
--config
=
./configs/attention_cluster.txt
\
python
3
infer.py
--model-name
=
"AttentionCluster"
--config
=
./configs/attention_cluster.txt
\
--filelist
=
./data/youtube8m/infer.list
\
--weights
=
./checkpoints/AttentionCluster_epoch0
\
--save-dir
=
"./save"
fluid/PaddleCV/video/scripts/test/test_attention_cluster.sh
浏览文件 @
ebb8f1ee
python test.py
--model-name
=
"AttentionCluster"
--config
=
./configs/attention_cluster.txt
\
python
3
test.py
--model-name
=
"AttentionCluster"
--config
=
./configs/attention_cluster.txt
\
--log-interval
=
5
--weights
=
./checkpoints/AttentionCluster_epoch0
fluid/PaddleCV/video/scripts/train/train_attention_cluster.sh
浏览文件 @
ebb8f1ee
python train.py
--model-name
=
"AttentionCluster"
--config
=
./configs/attention_cluster.txt
--epoch-num
=
5
\
python
3
train.py
--model-name
=
"AttentionCluster"
--config
=
./configs/attention_cluster.txt
--epoch-num
=
5
\
--valid-interval
=
1
--save-interval
=
1
--log-interval
=
10
fluid/PaddleCV/video/test.py
浏览文件 @
ebb8f1ee
...
...
@@ -22,6 +22,8 @@ import paddle.fluid as fluid
from
config
import
*
import
models
from
datareader
import
get_reader
from
metrics
import
get_metrics
logging
.
root
.
handlers
=
[]
FORMAT
=
'[%(levelname)s: %(filename)s: %(lineno)4d]: %(message)s'
...
...
@@ -68,8 +70,7 @@ def test(args):
test_config
=
merge_configs
(
config
,
'test'
,
vars
(
args
))
# build model
test_model
=
models
.
get_model
(
args
.
model_name
,
test_config
,
mode
=
'test'
)
test_model
=
models
.
get_model
(
args
.
model_name
,
test_config
,
mode
=
'test'
)
test_model
.
build_input
(
use_pyreader
=
False
)
test_model
.
build_model
()
test_feeds
=
test_model
.
feeds
()
...
...
@@ -90,8 +91,8 @@ def test(args):
fluid
.
io
.
load_vars
(
exe
,
weights
,
predicate
=
if_exist
)
# get reader and metrics
test_reader
=
test_model
.
reader
(
)
test_metrics
=
test_model
.
metrics
(
)
test_reader
=
get_reader
(
args
.
model_name
.
upper
(),
'test'
,
test_config
)
test_metrics
=
get_metrics
(
args
.
model_name
.
upper
(),
'test'
,
test_config
)
test_feeder
=
fluid
.
DataFeeder
(
place
=
place
,
feed_list
=
test_feeds
)
fetch_list
=
[
loss
.
name
]
+
[
x
.
name
...
...
fluid/PaddleCV/video/train.py
浏览文件 @
ebb8f1ee
...
...
@@ -165,16 +165,19 @@ def train(args):
main_program
=
valid_prog
)
# get reader
bs_denominator
=
1
if
(
not
args
.
no_use_pyreader
)
and
args
.
use_gpu
:
bs_denominator
=
train_config
.
TRAIN
.
num_gpus
train_config
.
TRAIN
.
batch_size
=
int
(
train_config
.
TRAIN
.
batch_size
/
bs_denominator
)
valid_config
.
VALID
.
batch_size
=
int
(
valid_config
.
VALID
.
batch_size
/
bs_denominator
)
train_reader
=
get_reader
(
args
.
model_name
.
upper
(),
'train'
,
train_config
)
valid_reader
=
get_reader
(
args
.
model_name
.
upper
(),
'valid'
,
valid_config
)
#train_reader = train_model.reader()
#valid_reader = valid_model.reader()
# get metrics
train_metrics
=
get_metrics
(
args
.
model_name
.
upper
(),
'train'
,
train_config
)
valid_metrics
=
get_metrics
(
args
.
model_name
.
upper
(),
'valid'
,
valid_config
)
#train_metrics = train_model.metrics()
#train_metrics = train_model.metrics()
train_fetch_list
=
[
train_loss
.
name
]
+
[
x
.
name
for
x
in
train_outputs
]
+
[
train_feeds
[
-
1
].
name
]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录