Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleClas
提交
f7329ddf
P
PaddleClas
项目概览
PaddlePaddle
/
PaddleClas
大约 1 年 前同步成功
通知
115
Star
4999
Fork
1114
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
19
列表
看板
标记
里程碑
合并请求
6
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleClas
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
19
Issue
19
列表
看板
标记
里程碑
合并请求
6
合并请求
6
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
f7329ddf
编写于
7月 12, 2021
作者:
C
cuicheng01
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
support load pretrain from url
上级
c1f4e463
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
10 addition
and
9 deletion
+10
-9
ppcls/configs/Products/ResNet50_vd_Inshop.yaml
ppcls/configs/Products/ResNet50_vd_Inshop.yaml
+1
-3
ppcls/configs/Products/ResNet50_vd_SOP.yaml
ppcls/configs/Products/ResNet50_vd_SOP.yaml
+1
-3
ppcls/engine/trainer.py
ppcls/engine/trainer.py
+8
-3
未找到文件。
ppcls/configs/Products/ResNet50_vd_Inshop.yaml
浏览文件 @
f7329ddf
# global configs
# global configs
Global
:
Global
:
checkpoints
:
null
checkpoints
:
null
# please download pretrained model via this link:
pretrained_model
:
"
https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/rec/models/pretrain/product_ResNet50_vd_Aliproduct_v1.0_pretrained.pdparams"
# https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/rec/models/pretrain/product_ResNet50_vd_Aliproduct_v1.0_pretrained.pdparams
pretrained_model
:
product_ResNet50_vd_Aliproduct_v1.0_pretrained
output_dir
:
./output/
output_dir
:
./output/
device
:
gpu
device
:
gpu
save_interval
:
10
save_interval
:
10
...
...
ppcls/configs/Products/ResNet50_vd_SOP.yaml
浏览文件 @
f7329ddf
# global configs
# global configs
Global
:
Global
:
checkpoints
:
null
checkpoints
:
null
# please download pretrained model via this link:
pretrained_model
:
"
https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/rec/models/pretrain/product_ResNet50_vd_Aliproduct_v1.0_pretrained.pdparams"
# https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/rec/models/pretrain/product_ResNet50_vd_Aliproduct_v1.0_pretrained.pdparams
pretrained_model
:
product_ResNet50_vd_Aliproduct_v1.0_pretrained
output_dir
:
./output/
output_dir
:
./output/
device
:
gpu
device
:
gpu
save_interval
:
10
save_interval
:
10
...
...
ppcls/engine/trainer.py
浏览文件 @
f7329ddf
...
@@ -39,7 +39,7 @@ from ppcls.arch import apply_to_static
...
@@ -39,7 +39,7 @@ from ppcls.arch import apply_to_static
from
ppcls.loss
import
build_loss
from
ppcls.loss
import
build_loss
from
ppcls.metric
import
build_metrics
from
ppcls.metric
import
build_metrics
from
ppcls.optimizer
import
build_optimizer
from
ppcls.optimizer
import
build_optimizer
from
ppcls.utils.save_load
import
load_dygraph_pretrain
from
ppcls.utils.save_load
import
load_dygraph_pretrain
,
load_dygraph_pretrain_from_url
from
ppcls.utils.save_load
import
init_model
from
ppcls.utils.save_load
import
init_model
from
ppcls.utils
import
save_load
from
ppcls.utils
import
save_load
...
@@ -77,8 +77,12 @@ class Trainer(object):
...
@@ -77,8 +77,12 @@ class Trainer(object):
apply_to_static
(
self
.
config
,
self
.
model
)
apply_to_static
(
self
.
config
,
self
.
model
)
if
self
.
config
[
"Global"
][
"pretrained_model"
]
is
not
None
:
if
self
.
config
[
"Global"
][
"pretrained_model"
]
is
not
None
:
load_dygraph_pretrain
(
self
.
model
,
if
self
.
config
[
"Global"
][
"pretrained_model"
].
startswith
(
"http"
):
self
.
config
[
"Global"
][
"pretrained_model"
])
load_dygraph_pretrain_from_url
(
self
.
model
,
self
.
config
[
"Global"
][
"pretrained_model"
])
else
:
load_dygraph_pretrain
(
self
.
model
,
self
.
config
[
"Global"
][
"pretrained_model"
])
if
self
.
config
[
"Global"
][
"distributed"
]:
if
self
.
config
[
"Global"
][
"distributed"
]:
self
.
model
=
paddle
.
DataParallel
(
self
.
model
)
self
.
model
=
paddle
.
DataParallel
(
self
.
model
)
...
@@ -362,6 +366,7 @@ class Trainer(object):
...
@@ -362,6 +366,7 @@ class Trainer(object):
if
self
.
is_rec
:
if
self
.
is_rec
:
out
=
self
.
model
(
batch
[
0
],
batch
[
1
])
out
=
self
.
model
(
batch
[
0
],
batch
[
1
])
else
:
else
:
self
.
model
.
eval
()
out
=
self
.
model
(
batch
[
0
])
out
=
self
.
model
(
batch
[
0
])
# calc loss
# calc loss
if
self
.
eval_loss_func
is
not
None
:
if
self
.
eval_loss_func
is
not
None
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录