Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleClas
提交
5cd7a05d
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
5cd7a05d
编写于
7月 13, 2021
作者:
W
Wei Shengyu
提交者:
GitHub
7月 13, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1034 from cuicheng01/develop
support load pretrain from url
上级
4af9f510
c965193f
变更
46
隐藏空白更改
内联
并排
Showing
46 changed file
with
78 addition
and
54 deletion
+78
-54
ppcls/arch/gears/cosmargin.py
ppcls/arch/gears/cosmargin.py
+1
-1
ppcls/configs/ImageNet/DPN/DPN107.yaml
ppcls/configs/ImageNet/DPN/DPN107.yaml
+1
-1
ppcls/configs/ImageNet/DPN/DPN131.yaml
ppcls/configs/ImageNet/DPN/DPN131.yaml
+1
-1
ppcls/configs/ImageNet/DPN/DPN68.yaml
ppcls/configs/ImageNet/DPN/DPN68.yaml
+1
-1
ppcls/configs/ImageNet/DPN/DPN92.yaml
ppcls/configs/ImageNet/DPN/DPN92.yaml
+1
-1
ppcls/configs/ImageNet/DPN/DPN98.yaml
ppcls/configs/ImageNet/DPN/DPN98.yaml
+1
-1
ppcls/configs/ImageNet/DarkNet/DarkNet53.yaml
ppcls/configs/ImageNet/DarkNet/DarkNet53.yaml
+1
-1
ppcls/configs/ImageNet/DataAugment/ResNet50_Cutmix.yaml
ppcls/configs/ImageNet/DataAugment/ResNet50_Cutmix.yaml
+1
-1
ppcls/configs/ImageNet/DataAugment/ResNet50_Mixup.yaml
ppcls/configs/ImageNet/DataAugment/ResNet50_Mixup.yaml
+1
-1
ppcls/configs/ImageNet/Inception/InceptionV3.yaml
ppcls/configs/ImageNet/Inception/InceptionV3.yaml
+1
-1
ppcls/configs/ImageNet/Inception/InceptionV4.yaml
ppcls/configs/ImageNet/Inception/InceptionV4.yaml
+1
-1
ppcls/configs/ImageNet/Res2Net/Res2Net101_vd_26w_4s.yaml
ppcls/configs/ImageNet/Res2Net/Res2Net101_vd_26w_4s.yaml
+1
-1
ppcls/configs/ImageNet/Res2Net/Res2Net200_vd_26w_4s.yaml
ppcls/configs/ImageNet/Res2Net/Res2Net200_vd_26w_4s.yaml
+1
-1
ppcls/configs/ImageNet/Res2Net/Res2Net50_14w_8s.yaml
ppcls/configs/ImageNet/Res2Net/Res2Net50_14w_8s.yaml
+1
-1
ppcls/configs/ImageNet/Res2Net/Res2Net50_26w_4s.yaml
ppcls/configs/ImageNet/Res2Net/Res2Net50_26w_4s.yaml
+1
-1
ppcls/configs/ImageNet/Res2Net/Res2Net50_vd_26w_4s.yaml
ppcls/configs/ImageNet/Res2Net/Res2Net50_vd_26w_4s.yaml
+1
-1
ppcls/configs/ImageNet/ResNeSt/ResNeSt101.yaml
ppcls/configs/ImageNet/ResNeSt/ResNeSt101.yaml
+1
-1
ppcls/configs/ImageNet/ResNeSt/ResNeSt50.yaml
ppcls/configs/ImageNet/ResNeSt/ResNeSt50.yaml
+1
-1
ppcls/configs/ImageNet/ResNeSt/ResNeSt50_fast_1s1x64d.yaml
ppcls/configs/ImageNet/ResNeSt/ResNeSt50_fast_1s1x64d.yaml
+1
-1
ppcls/configs/ImageNet/ResNeXt/ResNeXt101_vd_32x4d.yaml
ppcls/configs/ImageNet/ResNeXt/ResNeXt101_vd_32x4d.yaml
+1
-1
ppcls/configs/ImageNet/ResNeXt/ResNeXt101_vd_64x4d.yaml
ppcls/configs/ImageNet/ResNeXt/ResNeXt101_vd_64x4d.yaml
+1
-1
ppcls/configs/ImageNet/ResNeXt/ResNeXt152_vd_32x4d.yaml
ppcls/configs/ImageNet/ResNeXt/ResNeXt152_vd_32x4d.yaml
+1
-1
ppcls/configs/ImageNet/ResNeXt/ResNeXt152_vd_64x4d.yaml
ppcls/configs/ImageNet/ResNeXt/ResNeXt152_vd_64x4d.yaml
+1
-1
ppcls/configs/ImageNet/ResNeXt/ResNeXt50_vd_32x4d.yaml
ppcls/configs/ImageNet/ResNeXt/ResNeXt50_vd_32x4d.yaml
+1
-1
ppcls/configs/ImageNet/ResNeXt/ResNeXt50_vd_64x4d.yaml
ppcls/configs/ImageNet/ResNeXt/ResNeXt50_vd_64x4d.yaml
+1
-1
ppcls/configs/ImageNet/ResNet/ResNet101_vd.yaml
ppcls/configs/ImageNet/ResNet/ResNet101_vd.yaml
+1
-1
ppcls/configs/ImageNet/ResNet/ResNet152_vd.yaml
ppcls/configs/ImageNet/ResNet/ResNet152_vd.yaml
+1
-1
ppcls/configs/ImageNet/ResNet/ResNet18_vd.yaml
ppcls/configs/ImageNet/ResNet/ResNet18_vd.yaml
+1
-1
ppcls/configs/ImageNet/ResNet/ResNet200_vd.yaml
ppcls/configs/ImageNet/ResNet/ResNet200_vd.yaml
+1
-1
ppcls/configs/ImageNet/ResNet/ResNet34_vd.yaml
ppcls/configs/ImageNet/ResNet/ResNet34_vd.yaml
+1
-1
ppcls/configs/ImageNet/ResNet/ResNet50_vd.yaml
ppcls/configs/ImageNet/ResNet/ResNet50_vd.yaml
+1
-1
ppcls/configs/ImageNet/SENet/SENet154_vd.yaml
ppcls/configs/ImageNet/SENet/SENet154_vd.yaml
+1
-1
ppcls/configs/ImageNet/SENet/SE_ResNeXt101_32x4d.yaml
ppcls/configs/ImageNet/SENet/SE_ResNeXt101_32x4d.yaml
+1
-1
ppcls/configs/ImageNet/SENet/SE_ResNeXt50_32x4d.yaml
ppcls/configs/ImageNet/SENet/SE_ResNeXt50_32x4d.yaml
+1
-1
ppcls/configs/ImageNet/SENet/SE_ResNeXt50_vd_32x4d.yaml
ppcls/configs/ImageNet/SENet/SE_ResNeXt50_vd_32x4d.yaml
+1
-1
ppcls/configs/ImageNet/SENet/SE_ResNet18_vd.yaml
ppcls/configs/ImageNet/SENet/SE_ResNet18_vd.yaml
+1
-1
ppcls/configs/ImageNet/SENet/SE_ResNet34_vd.yaml
ppcls/configs/ImageNet/SENet/SE_ResNet34_vd.yaml
+1
-1
ppcls/configs/ImageNet/SENet/SE_ResNet50_vd.yaml
ppcls/configs/ImageNet/SENet/SE_ResNet50_vd.yaml
+1
-1
ppcls/configs/ImageNet/Xception/Xception65.yaml
ppcls/configs/ImageNet/Xception/Xception65.yaml
+1
-1
ppcls/configs/ImageNet/Xception/Xception71.yaml
ppcls/configs/ImageNet/Xception/Xception71.yaml
+1
-1
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
+12
-5
ppcls/loss/__init__.py
ppcls/loss/__init__.py
+1
-2
ppcls/loss/celoss.py
ppcls/loss/celoss.py
+22
-0
ppcls/utils/save_load.py
ppcls/utils/save_load.py
+1
-1
未找到文件。
ppcls/arch/gears/cosmargin.py
浏览文件 @
5cd7a05d
...
...
@@ -38,7 +38,7 @@ class CosMargin(paddle.nn.Layer):
input_norm
=
paddle
.
sqrt
(
paddle
.
sum
(
paddle
.
square
(
input
),
axis
=
1
,
keepdim
=
True
))
input
=
paddle
.
divide
(
input
,
x
_norm
)
input
=
paddle
.
divide
(
input
,
input
_norm
)
weight
=
self
.
fc
.
weight
weight_norm
=
paddle
.
sqrt
(
...
...
ppcls/configs/ImageNet/DPN/DPN107.yaml
浏览文件 @
5cd7a05d
...
...
@@ -22,7 +22,7 @@ Arch:
# loss function config for traing/eval process
Loss
:
Train
:
-
CELoss
:
-
Mix
CELoss
:
weight
:
1.0
epsilon
:
0.1
Eval
:
...
...
ppcls/configs/ImageNet/DPN/DPN131.yaml
浏览文件 @
5cd7a05d
...
...
@@ -22,7 +22,7 @@ Arch:
# loss function config for traing/eval process
Loss
:
Train
:
-
CELoss
:
-
Mix
CELoss
:
weight
:
1.0
epsilon
:
0.1
Eval
:
...
...
ppcls/configs/ImageNet/DPN/DPN68.yaml
浏览文件 @
5cd7a05d
...
...
@@ -22,7 +22,7 @@ Arch:
# loss function config for traing/eval process
Loss
:
Train
:
-
CELoss
:
-
Mix
CELoss
:
weight
:
1.0
epsilon
:
0.1
Eval
:
...
...
ppcls/configs/ImageNet/DPN/DPN92.yaml
浏览文件 @
5cd7a05d
...
...
@@ -22,7 +22,7 @@ Arch:
# loss function config for traing/eval process
Loss
:
Train
:
-
CELoss
:
-
Mix
CELoss
:
weight
:
1.0
epsilon
:
0.1
Eval
:
...
...
ppcls/configs/ImageNet/DPN/DPN98.yaml
浏览文件 @
5cd7a05d
...
...
@@ -22,7 +22,7 @@ Arch:
# loss function config for traing/eval process
Loss
:
Train
:
-
CELoss
:
-
Mix
CELoss
:
weight
:
1.0
epsilon
:
0.1
Eval
:
...
...
ppcls/configs/ImageNet/DarkNet/DarkNet53.yaml
浏览文件 @
5cd7a05d
...
...
@@ -22,7 +22,7 @@ Arch:
# loss function config for traing/eval process
Loss
:
Train
:
-
CELoss
:
-
Mix
CELoss
:
weight
:
1.0
epsilon
:
0.1
Eval
:
...
...
ppcls/configs/ImageNet/DataAugment/ResNet50_Cutmix.yaml
浏览文件 @
5cd7a05d
...
...
@@ -22,7 +22,7 @@ Arch:
# loss function config for traing/eval process
Loss
:
Train
:
-
CELoss
:
-
Mix
CELoss
:
weight
:
1.0
Eval
:
-
CELoss
:
...
...
ppcls/configs/ImageNet/DataAugment/ResNet50_Mixup.yaml
浏览文件 @
5cd7a05d
...
...
@@ -22,7 +22,7 @@ Arch:
# loss function config for traing/eval process
Loss
:
Train
:
-
CELoss
:
-
Mix
CELoss
:
weight
:
1.0
Eval
:
-
CELoss
:
...
...
ppcls/configs/ImageNet/Inception/InceptionV3.yaml
浏览文件 @
5cd7a05d
...
...
@@ -22,7 +22,7 @@ Arch:
# loss function config for traing/eval process
Loss
:
Train
:
-
CELoss
:
-
Mix
CELoss
:
weight
:
1.0
epsilon
:
0.1
Eval
:
...
...
ppcls/configs/ImageNet/Inception/InceptionV4.yaml
浏览文件 @
5cd7a05d
...
...
@@ -22,7 +22,7 @@ Arch:
# loss function config for traing/eval process
Loss
:
Train
:
-
CELoss
:
-
Mix
CELoss
:
weight
:
1.0
epsilon
:
0.1
Eval
:
...
...
ppcls/configs/ImageNet/Res2Net/Res2Net101_vd_26w_4s.yaml
浏览文件 @
5cd7a05d
...
...
@@ -22,7 +22,7 @@ Arch:
# loss function config for traing/eval process
Loss
:
Train
:
-
CELoss
:
-
Mix
CELoss
:
weight
:
1.0
epsilon
:
0.1
Eval
:
...
...
ppcls/configs/ImageNet/Res2Net/Res2Net200_vd_26w_4s.yaml
浏览文件 @
5cd7a05d
...
...
@@ -22,7 +22,7 @@ Arch:
# loss function config for traing/eval process
Loss
:
Train
:
-
CELoss
:
-
Mix
CELoss
:
weight
:
1.0
epsilon
:
0.1
Eval
:
...
...
ppcls/configs/ImageNet/Res2Net/Res2Net50_14w_8s.yaml
浏览文件 @
5cd7a05d
...
...
@@ -22,7 +22,7 @@ Arch:
# loss function config for traing/eval process
Loss
:
Train
:
-
CELoss
:
-
Mix
CELoss
:
weight
:
1.0
epsilon
:
0.1
Eval
:
...
...
ppcls/configs/ImageNet/Res2Net/Res2Net50_26w_4s.yaml
浏览文件 @
5cd7a05d
...
...
@@ -22,7 +22,7 @@ Arch:
# loss function config for traing/eval process
Loss
:
Train
:
-
CELoss
:
-
Mix
CELoss
:
weight
:
1.0
epsilon
:
0.1
Eval
:
...
...
ppcls/configs/ImageNet/Res2Net/Res2Net50_vd_26w_4s.yaml
浏览文件 @
5cd7a05d
...
...
@@ -22,7 +22,7 @@ Arch:
# loss function config for traing/eval process
Loss
:
Train
:
-
CELoss
:
-
Mix
CELoss
:
weight
:
1.0
epsilon
:
0.1
Eval
:
...
...
ppcls/configs/ImageNet/ResNeSt/ResNeSt101.yaml
浏览文件 @
5cd7a05d
...
...
@@ -22,7 +22,7 @@ Arch:
# loss function config for traing/eval process
Loss
:
Train
:
-
CELoss
:
-
Mix
CELoss
:
weight
:
1.0
epsilon
:
0.1
Eval
:
...
...
ppcls/configs/ImageNet/ResNeSt/ResNeSt50.yaml
浏览文件 @
5cd7a05d
...
...
@@ -22,7 +22,7 @@ Arch:
# loss function config for traing/eval process
Loss
:
Train
:
-
CELoss
:
-
Mix
CELoss
:
weight
:
1.0
epsilon
:
0.1
Eval
:
...
...
ppcls/configs/ImageNet/ResNeSt/ResNeSt50_fast_1s1x64d.yaml
浏览文件 @
5cd7a05d
...
...
@@ -22,7 +22,7 @@ Arch:
# loss function config for traing/eval process
Loss
:
Train
:
-
CELoss
:
-
Mix
CELoss
:
weight
:
1.0
epsilon
:
0.1
Eval
:
...
...
ppcls/configs/ImageNet/ResNeXt/ResNeXt101_vd_32x4d.yaml
浏览文件 @
5cd7a05d
...
...
@@ -22,7 +22,7 @@ Arch:
# loss function config for traing/eval process
Loss
:
Train
:
-
CELoss
:
-
Mix
CELoss
:
weight
:
1.0
epsilon
:
0.1
Eval
:
...
...
ppcls/configs/ImageNet/ResNeXt/ResNeXt101_vd_64x4d.yaml
浏览文件 @
5cd7a05d
...
...
@@ -22,7 +22,7 @@ Arch:
# loss function config for traing/eval process
Loss
:
Train
:
-
CELoss
:
-
Mix
CELoss
:
weight
:
1.0
epsilon
:
0.1
Eval
:
...
...
ppcls/configs/ImageNet/ResNeXt/ResNeXt152_vd_32x4d.yaml
浏览文件 @
5cd7a05d
...
...
@@ -22,7 +22,7 @@ Arch:
# loss function config for traing/eval process
Loss
:
Train
:
-
CELoss
:
-
Mix
CELoss
:
weight
:
1.0
epsilon
:
0.1
Eval
:
...
...
ppcls/configs/ImageNet/ResNeXt/ResNeXt152_vd_64x4d.yaml
浏览文件 @
5cd7a05d
...
...
@@ -22,7 +22,7 @@ Arch:
# loss function config for traing/eval process
Loss
:
Train
:
-
CELoss
:
-
Mix
CELoss
:
weight
:
1.0
epsilon
:
0.1
Eval
:
...
...
ppcls/configs/ImageNet/ResNeXt/ResNeXt50_vd_32x4d.yaml
浏览文件 @
5cd7a05d
...
...
@@ -22,7 +22,7 @@ Arch:
# loss function config for traing/eval process
Loss
:
Train
:
-
CELoss
:
-
Mix
CELoss
:
weight
:
1.0
epsilon
:
0.1
Eval
:
...
...
ppcls/configs/ImageNet/ResNeXt/ResNeXt50_vd_64x4d.yaml
浏览文件 @
5cd7a05d
...
...
@@ -22,7 +22,7 @@ Arch:
# loss function config for traing/eval process
Loss
:
Train
:
-
CELoss
:
-
Mix
CELoss
:
weight
:
1.0
epsilon
:
0.1
Eval
:
...
...
ppcls/configs/ImageNet/ResNet/ResNet101_vd.yaml
浏览文件 @
5cd7a05d
...
...
@@ -22,7 +22,7 @@ Arch:
# loss function config for traing/eval process
Loss
:
Train
:
-
CELoss
:
-
Mix
CELoss
:
weight
:
1.0
epsilon
:
0.1
Eval
:
...
...
ppcls/configs/ImageNet/ResNet/ResNet152_vd.yaml
浏览文件 @
5cd7a05d
...
...
@@ -22,7 +22,7 @@ Arch:
# loss function config for traing/eval process
Loss
:
Train
:
-
CELoss
:
-
Mix
CELoss
:
weight
:
1.0
epsilon
:
0.1
Eval
:
...
...
ppcls/configs/ImageNet/ResNet/ResNet18_vd.yaml
浏览文件 @
5cd7a05d
...
...
@@ -22,7 +22,7 @@ Arch:
# loss function config for traing/eval process
Loss
:
Train
:
-
CELoss
:
-
Mix
CELoss
:
weight
:
1.0
epsilon
:
0.1
Eval
:
...
...
ppcls/configs/ImageNet/ResNet/ResNet200_vd.yaml
浏览文件 @
5cd7a05d
...
...
@@ -22,7 +22,7 @@ Arch:
# loss function config for traing/eval process
Loss
:
Train
:
-
CELoss
:
-
Mix
CELoss
:
weight
:
1.0
epsilon
:
0.1
Eval
:
...
...
ppcls/configs/ImageNet/ResNet/ResNet34_vd.yaml
浏览文件 @
5cd7a05d
...
...
@@ -22,7 +22,7 @@ Arch:
# loss function config for traing/eval process
Loss
:
Train
:
-
CELoss
:
-
Mix
CELoss
:
weight
:
1.0
epsilon
:
0.1
Eval
:
...
...
ppcls/configs/ImageNet/ResNet/ResNet50_vd.yaml
浏览文件 @
5cd7a05d
...
...
@@ -22,7 +22,7 @@ Arch:
# loss function config for traing/eval process
Loss
:
Train
:
-
CELoss
:
-
Mix
CELoss
:
weight
:
1.0
epsilon
:
0.1
Eval
:
...
...
ppcls/configs/ImageNet/SENet/SENet154_vd.yaml
浏览文件 @
5cd7a05d
...
...
@@ -22,7 +22,7 @@ Arch:
# loss function config for traing/eval process
Loss
:
Train
:
-
CELoss
:
-
Mix
CELoss
:
weight
:
1.0
epsilon
:
0.1
Eval
:
...
...
ppcls/configs/ImageNet/SENet/SE_ResNeXt101_32x4d.yaml
浏览文件 @
5cd7a05d
...
...
@@ -22,7 +22,7 @@ Arch:
# loss function config for traing/eval process
Loss
:
Train
:
-
CELoss
:
-
Mix
CELoss
:
weight
:
1.0
epsilon
:
0.1
Eval
:
...
...
ppcls/configs/ImageNet/SENet/SE_ResNeXt50_32x4d.yaml
浏览文件 @
5cd7a05d
...
...
@@ -22,7 +22,7 @@ Arch:
# loss function config for traing/eval process
Loss
:
Train
:
-
CELoss
:
-
Mix
CELoss
:
weight
:
1.0
epsilon
:
0.1
Eval
:
...
...
ppcls/configs/ImageNet/SENet/SE_ResNeXt50_vd_32x4d.yaml
浏览文件 @
5cd7a05d
...
...
@@ -22,7 +22,7 @@ Arch:
# loss function config for traing/eval process
Loss
:
Train
:
-
CELoss
:
-
Mix
CELoss
:
weight
:
1.0
epsilon
:
0.1
Eval
:
...
...
ppcls/configs/ImageNet/SENet/SE_ResNet18_vd.yaml
浏览文件 @
5cd7a05d
...
...
@@ -22,7 +22,7 @@ Arch:
# loss function config for traing/eval process
Loss
:
Train
:
-
CELoss
:
-
Mix
CELoss
:
weight
:
1.0
epsilon
:
0.1
Eval
:
...
...
ppcls/configs/ImageNet/SENet/SE_ResNet34_vd.yaml
浏览文件 @
5cd7a05d
...
...
@@ -22,7 +22,7 @@ Arch:
# loss function config for traing/eval process
Loss
:
Train
:
-
CELoss
:
-
Mix
CELoss
:
weight
:
1.0
epsilon
:
0.1
Eval
:
...
...
ppcls/configs/ImageNet/SENet/SE_ResNet50_vd.yaml
浏览文件 @
5cd7a05d
...
...
@@ -22,7 +22,7 @@ Arch:
# loss function config for traing/eval process
Loss
:
Train
:
-
CELoss
:
-
Mix
CELoss
:
weight
:
1.0
epsilon
:
0.1
Eval
:
...
...
ppcls/configs/ImageNet/Xception/Xception65.yaml
浏览文件 @
5cd7a05d
...
...
@@ -22,7 +22,7 @@ Arch:
# loss function config for traing/eval process
Loss
:
Train
:
-
CELoss
:
-
Mix
CELoss
:
weight
:
1.0
epsilon
:
0.1
Eval
:
...
...
ppcls/configs/ImageNet/Xception/Xception71.yaml
浏览文件 @
5cd7a05d
...
...
@@ -22,7 +22,7 @@ Arch:
# loss function config for traing/eval process
Loss
:
Train
:
-
CELoss
:
-
Mix
CELoss
:
weight
:
1.0
epsilon
:
0.1
Eval
:
...
...
ppcls/configs/Products/ResNet50_vd_Inshop.yaml
浏览文件 @
5cd7a05d
# global configs
Global
:
checkpoints
:
null
# please download pretrained model via this link:
# 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
pretrained_model
:
"
https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/rec/models/pretrain/product_ResNet50_vd_Aliproduct_v1.0_pretrained.pdparams"
output_dir
:
./output/
device
:
gpu
save_interval
:
10
...
...
ppcls/configs/Products/ResNet50_vd_SOP.yaml
浏览文件 @
5cd7a05d
# global configs
Global
:
checkpoints
:
null
# please download pretrained model via this link:
# 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
pretrained_model
:
"
https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/rec/models/pretrain/product_ResNet50_vd_Aliproduct_v1.0_pretrained.pdparams"
output_dir
:
./output/
device
:
gpu
save_interval
:
10
...
...
ppcls/engine/trainer.py
浏览文件 @
5cd7a05d
...
...
@@ -40,7 +40,7 @@ from ppcls.arch import apply_to_static
from
ppcls.loss
import
build_loss
from
ppcls.metric
import
build_metrics
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
import
save_load
...
...
@@ -78,8 +78,12 @@ class Trainer(object):
apply_to_static
(
self
.
config
,
self
.
model
)
if
self
.
config
[
"Global"
][
"pretrained_model"
]
is
not
None
:
load_dygraph_pretrain
(
self
.
model
,
self
.
config
[
"Global"
][
"pretrained_model"
])
if
self
.
config
[
"Global"
][
"pretrained_model"
].
startswith
(
"http"
):
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"
]:
self
.
model
=
paddle
.
DataParallel
(
self
.
model
)
...
...
@@ -174,9 +178,12 @@ class Trainer(object):
out
=
self
.
model
(
batch
[
0
])
else
:
out
=
self
.
model
(
batch
[
0
],
batch
[
1
])
# calc loss
loss_dict
=
self
.
train_loss_func
(
out
,
batch
[
1
])
if
self
.
config
[
"DataLoader"
][
"Train"
][
"dataset"
].
get
(
"batch_transform_ops"
,
None
):
loss_dict
=
self
.
train_loss_func
(
out
,
batch
[
1
:])
else
:
loss_dict
=
self
.
train_loss_func
(
out
,
batch
[
1
])
for
key
in
loss_dict
:
if
not
key
in
output_info
:
...
...
ppcls/loss/__init__.py
浏览文件 @
5cd7a05d
...
...
@@ -4,7 +4,7 @@ import paddle
import
paddle.nn
as
nn
from
ppcls.utils
import
logger
from
.celoss
import
CELoss
from
.celoss
import
CELoss
,
MixCELoss
from
.googlenetloss
import
GoogLeNetLoss
from
.centerloss
import
CenterLoss
from
.emlloss
import
EmlLoss
...
...
@@ -30,7 +30,6 @@ class CombinedLoss(nn.Layer):
assert
isinstance
(
config_list
,
list
),
(
'operator config should be a list'
)
for
config
in
config_list
:
print
(
config
)
assert
isinstance
(
config
,
dict
)
and
len
(
config
)
==
1
,
"yaml format error"
name
=
list
(
config
)[
0
]
...
...
ppcls/loss/celoss.py
浏览文件 @
5cd7a05d
...
...
@@ -18,6 +18,10 @@ import paddle.nn.functional as F
class
CELoss
(
nn
.
Layer
):
"""
Cross entropy loss
"""
def
__init__
(
self
,
epsilon
=
None
):
super
().
__init__
()
if
epsilon
is
not
None
and
(
epsilon
<=
0
or
epsilon
>=
1
):
...
...
@@ -50,3 +54,21 @@ class CELoss(nn.Layer):
loss
=
F
.
cross_entropy
(
x
,
label
=
label
,
soft_label
=
soft_label
)
loss
=
loss
.
mean
()
return
{
"CELoss"
:
loss
}
class
MixCELoss
(
CELoss
):
"""
Cross entropy loss with mix(mixup, cutmix, fixmix)
"""
def
__init__
(
self
,
epsilon
=
None
):
super
().
__init__
()
self
.
epsilon
=
epsilon
def
__call__
(
self
,
input
,
batch
):
target0
,
target1
,
lam
=
batch
loss0
=
super
().
forward
(
input
,
target0
)[
"CELoss"
]
loss1
=
super
().
forward
(
input
,
target1
)[
"CELoss"
]
loss
=
lam
*
loss0
+
(
1.0
-
lam
)
*
loss1
loss
=
paddle
.
mean
(
loss
)
return
{
"MixCELoss"
:
loss
}
ppcls/utils/save_load.py
浏览文件 @
5cd7a05d
...
...
@@ -54,7 +54,7 @@ def load_dygraph_pretrain(model, path=None):
return
def
load_dygraph_pretrain_from_url
(
model
,
pretrained_url
,
use_ssld
):
def
load_dygraph_pretrain_from_url
(
model
,
pretrained_url
,
use_ssld
=
False
):
if
use_ssld
:
pretrained_url
=
pretrained_url
.
replace
(
"_pretrained"
,
"_ssld_pretrained"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录