Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
485c7d5c
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看板
提交
485c7d5c
编写于
2月 12, 2019
作者:
D
dengkaipeng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add resume weights in train.py
上级
932be2e9
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
22 addition
and
8 deletion
+22
-8
fluid/PaddleCV/video/infer.py
fluid/PaddleCV/video/infer.py
+1
-0
fluid/PaddleCV/video/models/model.py
fluid/PaddleCV/video/models/model.py
+0
-2
fluid/PaddleCV/video/test.py
fluid/PaddleCV/video/test.py
+1
-0
fluid/PaddleCV/video/train.py
fluid/PaddleCV/video/train.py
+20
-6
未找到文件。
fluid/PaddleCV/video/infer.py
浏览文件 @
485c7d5c
...
...
@@ -28,6 +28,7 @@ from config import *
import
models
from
datareader
import
get_reader
logging
.
root
.
handlers
=
[]
FORMAT
=
'[%(levelname)s: %(filename)s: %(lineno)4d]: %(message)s'
logging
.
basicConfig
(
level
=
logging
.
DEBUG
,
format
=
FORMAT
,
stream
=
sys
.
stdout
)
logger
=
logging
.
getLogger
(
__name__
)
...
...
fluid/PaddleCV/video/models/model.py
浏览文件 @
485c7d5c
...
...
@@ -143,8 +143,6 @@ class ModelBase(object):
return
path
def
load_pretrain_params
(
self
,
exe
,
pretrain
,
prog
,
place
):
def
if_exist
(
var
):
return
os
.
path
.
exists
(
os
.
path
.
join
(
pretrained_base
,
var
.
name
))
fluid
.
io
.
load_params
(
exe
,
pretrain
,
main_program
=
prog
)
def
get_config_from_sec
(
self
,
sec
,
item
,
default
=
None
):
...
...
fluid/PaddleCV/video/test.py
浏览文件 @
485c7d5c
...
...
@@ -25,6 +25,7 @@ import models
from
datareader
import
get_reader
from
metrics
import
get_metrics
logging
.
root
.
handlers
=
[]
FORMAT
=
'[%(levelname)s: %(filename)s: %(lineno)4d]: %(message)s'
logging
.
basicConfig
(
level
=
logging
.
INFO
,
format
=
FORMAT
,
stream
=
sys
.
stdout
)
logger
=
logging
.
getLogger
(
__name__
)
...
...
fluid/PaddleCV/video/train.py
浏览文件 @
485c7d5c
...
...
@@ -26,6 +26,7 @@ from config import *
from
datareader
import
get_reader
from
metrics
import
get_metrics
logging
.
root
.
handlers
=
[]
FORMAT
=
'[%(levelname)s: %(filename)s: %(lineno)4d]: %(message)s'
logging
.
basicConfig
(
level
=
logging
.
INFO
,
format
=
FORMAT
,
stream
=
sys
.
stdout
)
logger
=
logging
.
getLogger
(
__name__
)
...
...
@@ -59,6 +60,12 @@ def parse_args():
default
=
None
,
help
=
'path to pretrain weights. None to use default weights path in ~/.paddle/weights.'
)
parser
.
add_argument
(
'--resume-weights'
,
type
=
str
,
default
=
None
,
help
=
'path to resume weights. If not None, only resume weigths will be loaded.'
)
parser
.
add_argument
(
'--use-gpu'
,
type
=
bool
,
default
=
True
,
help
=
'default use gpu.'
)
parser
.
add_argument
(
...
...
@@ -141,12 +148,19 @@ def train(args):
exe
=
fluid
.
Executor
(
place
)
exe
.
run
(
startup
)
if
args
.
pretrain
:
assert
os
.
path
.
exists
(
args
.
pretrain
),
\
"Given pretrain weight dir {} not exist."
.
format
(
args
.
pretrain
)
pretrain
=
args
.
pretrain
or
train_model
.
get_pretrain_weights
()
if
pretrain
:
train_model
.
load_pretrain_params
(
exe
,
pretrain
,
train_prog
,
place
)
if
args
.
resume_weights
:
# if resume weights is given, load resume weights directly
assert
os
.
path
.
exists
(
args
.
resume_weights
),
\
"Given resume weight dir {} not exist."
.
format
(
args
.
resume_weights
)
fluid
.
io
.
load_params
(
exe
,
args
.
resume_weights
,
main_program
=
train_prog
)
else
:
# if not in resume mode, load pretrain weights
if
args
.
pretrain
:
assert
os
.
path
.
exists
(
args
.
pretrain
),
\
"Given pretrain weight dir {} not exist."
.
format
(
args
.
pretrain
)
pretrain
=
args
.
pretrain
or
train_model
.
get_pretrain_weights
()
if
pretrain
:
train_model
.
load_pretrain_params
(
exe
,
pretrain
,
train_prog
,
place
)
train_exe
=
fluid
.
ParallelExecutor
(
use_cuda
=
args
.
use_gpu
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录