Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleDetection
提交
287af3d1
P
PaddleDetection
项目概览
s920243400
/
PaddleDetection
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleDetection
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
287af3d1
编写于
3月 18, 2021
作者:
K
Kaipeng Deng
提交者:
GitHub
3月 18, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove load_static_weights & polish ppdet.engine log (#2366)
* remove load_static_weights
上级
b00be04e
变更
32
隐藏空白更改
内联
并排
Showing
32 changed file
with
41 addition
and
91 deletion
+41
-91
dygraph/configs/cascade_rcnn/_base_/cascade_mask_rcnn_r50_fpn.yml
...configs/cascade_rcnn/_base_/cascade_mask_rcnn_r50_fpn.yml
+1
-2
dygraph/configs/cascade_rcnn/_base_/cascade_rcnn_r50_fpn.yml
dygraph/configs/cascade_rcnn/_base_/cascade_rcnn_r50_fpn.yml
+1
-2
dygraph/configs/faster_rcnn/_base_/faster_rcnn_r50.yml
dygraph/configs/faster_rcnn/_base_/faster_rcnn_r50.yml
+1
-2
dygraph/configs/faster_rcnn/_base_/faster_rcnn_r50_fpn.yml
dygraph/configs/faster_rcnn/_base_/faster_rcnn_r50_fpn.yml
+1
-2
dygraph/configs/fcos/_base_/fcos_r50_fpn.yml
dygraph/configs/fcos/_base_/fcos_r50_fpn.yml
+1
-2
dygraph/configs/hrnet/_base_/faster_rcnn_hrnetv2p_w18.yml
dygraph/configs/hrnet/_base_/faster_rcnn_hrnetv2p_w18.yml
+1
-2
dygraph/configs/mask_rcnn/_base_/mask_rcnn_r50.yml
dygraph/configs/mask_rcnn/_base_/mask_rcnn_r50.yml
+1
-2
dygraph/configs/mask_rcnn/_base_/mask_rcnn_r50_fpn.yml
dygraph/configs/mask_rcnn/_base_/mask_rcnn_r50_fpn.yml
+1
-2
dygraph/configs/ppyolo/_base_/ppyolo_mbv3_large.yml
dygraph/configs/ppyolo/_base_/ppyolo_mbv3_large.yml
+1
-2
dygraph/configs/ppyolo/_base_/ppyolo_mbv3_small.yml
dygraph/configs/ppyolo/_base_/ppyolo_mbv3_small.yml
+1
-2
dygraph/configs/ppyolo/_base_/ppyolo_r18vd.yml
dygraph/configs/ppyolo/_base_/ppyolo_r18vd.yml
+1
-2
dygraph/configs/ppyolo/_base_/ppyolo_r50vd_dcn.yml
dygraph/configs/ppyolo/_base_/ppyolo_r50vd_dcn.yml
+1
-2
dygraph/configs/slim/prune/yolov3_prune_fpgm.yml
dygraph/configs/slim/prune/yolov3_prune_fpgm.yml
+0
-1
dygraph/configs/slim/prune/yolov3_prune_l1_norm.yml
dygraph/configs/slim/prune/yolov3_prune_l1_norm.yml
+0
-1
dygraph/configs/slim/quant/yolov3_mobilenet_v1_qat.yml
dygraph/configs/slim/quant/yolov3_mobilenet_v1_qat.yml
+0
-1
dygraph/configs/slim/quant/yolov3_mobilenet_v3_qat.yml
dygraph/configs/slim/quant/yolov3_mobilenet_v3_qat.yml
+0
-1
dygraph/configs/solov2/_base_/solov2_r50_fpn.yml
dygraph/configs/solov2/_base_/solov2_r50_fpn.yml
+1
-2
dygraph/configs/ssd/_base_/ssd_mobilenet_v1_300.yml
dygraph/configs/ssd/_base_/ssd_mobilenet_v1_300.yml
+1
-2
dygraph/configs/ssd/_base_/ssdlite_mobilenet_v1_300.yml
dygraph/configs/ssd/_base_/ssdlite_mobilenet_v1_300.yml
+1
-2
dygraph/configs/ssd/_base_/ssdlite_mobilenet_v3_large_320.yml
...aph/configs/ssd/_base_/ssdlite_mobilenet_v3_large_320.yml
+1
-2
dygraph/configs/ssd/_base_/ssdlite_mobilenet_v3_small_320.yml
...aph/configs/ssd/_base_/ssdlite_mobilenet_v3_small_320.yml
+1
-2
dygraph/configs/ttfnet/_base_/ttfnet_darknet53.yml
dygraph/configs/ttfnet/_base_/ttfnet_darknet53.yml
+1
-2
dygraph/configs/yolov3/_base_/yolov3_darknet53.yml
dygraph/configs/yolov3/_base_/yolov3_darknet53.yml
+1
-2
dygraph/configs/yolov3/_base_/yolov3_mobilenet_v1.yml
dygraph/configs/yolov3/_base_/yolov3_mobilenet_v1.yml
+1
-2
dygraph/configs/yolov3/_base_/yolov3_mobilenet_v3_large.yml
dygraph/configs/yolov3/_base_/yolov3_mobilenet_v3_large.yml
+1
-2
dygraph/configs/yolov3/_base_/yolov3_mobilenet_v3_small.yml
dygraph/configs/yolov3/_base_/yolov3_mobilenet_v3_small.yml
+1
-2
dygraph/configs/yolov3/_base_/yolov3_r50vd_dcn.yml
dygraph/configs/yolov3/_base_/yolov3_r50vd_dcn.yml
+1
-2
dygraph/configs/yolov3/yolov3_mobilenet_v1_roadsign.yml
dygraph/configs/yolov3/yolov3_mobilenet_v1_roadsign.yml
+0
-1
dygraph/ppdet/engine/callbacks.py
dygraph/ppdet/engine/callbacks.py
+13
-13
dygraph/ppdet/engine/export_utils.py
dygraph/ppdet/engine/export_utils.py
+1
-1
dygraph/ppdet/engine/trainer.py
dygraph/ppdet/engine/trainer.py
+3
-5
dygraph/ppdet/utils/checkpoint.py
dygraph/ppdet/utils/checkpoint.py
+1
-21
未找到文件。
dygraph/configs/cascade_rcnn/_base_/cascade_mask_rcnn_r50_fpn.yml
浏览文件 @
287af3d1
architecture
:
CascadeRCNN
pretrain_weights
:
https://paddle-imagenet-models-name.bj.bcebos.com/ResNet50_cos_pretrained.tar
load_static_weights
:
True
pretrain_weights
:
https://paddledet.bj.bcebos.com/models/pretrained/ResNet50_cos_pretrained.pdparams
CascadeRCNN
:
...
...
dygraph/configs/cascade_rcnn/_base_/cascade_rcnn_r50_fpn.yml
浏览文件 @
287af3d1
architecture
:
CascadeRCNN
pretrain_weights
:
https://paddle-imagenet-models-name.bj.bcebos.com/ResNet50_cos_pretrained.tar
load_static_weights
:
True
pretrain_weights
:
https://paddledet.bj.bcebos.com/models/pretrained/ResNet50_cos_pretrained.pdparams
CascadeRCNN
:
...
...
dygraph/configs/faster_rcnn/_base_/faster_rcnn_r50.yml
浏览文件 @
287af3d1
architecture
:
FasterRCNN
pretrain_weights
:
https://paddle-imagenet-models-name.bj.bcebos.com/ResNet50_cos_pretrained.tar
load_static_weights
:
True
pretrain_weights
:
https://paddledet.bj.bcebos.com/models/pretrained/ResNet50_cos_pretrained.pdparams
FasterRCNN
:
backbone
:
ResNet
...
...
dygraph/configs/faster_rcnn/_base_/faster_rcnn_r50_fpn.yml
浏览文件 @
287af3d1
architecture
:
FasterRCNN
pretrain_weights
:
https://paddle-imagenet-models-name.bj.bcebos.com/ResNet50_cos_pretrained.tar
load_static_weights
:
True
pretrain_weights
:
https://paddledet.bj.bcebos.com/models/pretrained/ResNet50_cos_pretrained.pdparams
FasterRCNN
:
backbone
:
ResNet
...
...
dygraph/configs/fcos/_base_/fcos_r50_fpn.yml
浏览文件 @
287af3d1
architecture
:
FCOS
pretrain_weights
:
https://paddle-imagenet-models-name.bj.bcebos.com/ResNet50_cos_pretrained.tar
load_static_weights
:
True
pretrain_weights
:
https://paddledet.bj.bcebos.com/models/pretrained/ResNet50_cos_pretrained.pdparams
FCOS
:
backbone
:
ResNet
...
...
dygraph/configs/hrnet/_base_/faster_rcnn_hrnetv2p_w18.yml
浏览文件 @
287af3d1
architecture
:
FasterRCNN
pretrain_weights
:
https://paddle-imagenet-models-name.bj.bcebos.com/HRNet_W18_C_pretrained.tar
load_static_weights
:
True
pretrain_weights
:
https://paddledet.bj.bcebos.com/models/pretrained/HRNet_W18_C_pretrained.pdparams
FasterRCNN
:
backbone
:
HRNet
...
...
dygraph/configs/mask_rcnn/_base_/mask_rcnn_r50.yml
浏览文件 @
287af3d1
architecture
:
MaskRCNN
pretrain_weights
:
https://paddle-imagenet-models-name.bj.bcebos.com/ResNet50_cos_pretrained.tar
load_static_weights
:
True
pretrain_weights
:
https://paddledet.bj.bcebos.com/models/pretrained/ResNet50_cos_pretrained.pdparams
MaskRCNN
:
backbone
:
ResNet
...
...
dygraph/configs/mask_rcnn/_base_/mask_rcnn_r50_fpn.yml
浏览文件 @
287af3d1
architecture
:
MaskRCNN
pretrain_weights
:
https://paddle-imagenet-models-name.bj.bcebos.com/ResNet50_cos_pretrained.tar
load_static_weights
:
True
pretrain_weights
:
https://paddledet.bj.bcebos.com/models/pretrained/ResNet50_cos_pretrained.pdparams
MaskRCNN
:
backbone
:
ResNet
...
...
dygraph/configs/ppyolo/_base_/ppyolo_mbv3_large.yml
浏览文件 @
287af3d1
architecture
:
YOLOv3
pretrain_weights
:
https://paddle-imagenet-models-name.bj.bcebos.com/MobileNetV3_large_x1_0_ssld_pretrained.tar
load_static_weights
:
true
pretrain_weights
:
https://paddledet.bj.bcebos.com/models/pretrained/MobileNetV3_large_x1_0_ssld_pretrained.pdparams
norm_type
:
sync_bn
use_ema
:
true
ema_decay
:
0.9998
...
...
dygraph/configs/ppyolo/_base_/ppyolo_mbv3_small.yml
浏览文件 @
287af3d1
architecture
:
YOLOv3
pretrain_weights
:
https://paddle-imagenet-models-name.bj.bcebos.com/MobileNetV3_small_x1_0_ssld_pretrained.tar
load_static_weights
:
true
pretrain_weights
:
https://paddledet.bj.bcebos.com/models/pretrained/MobileNetV3_small_x1_0_ssld_pretrained.pdparams
norm_type
:
sync_bn
use_ema
:
true
ema_decay
:
0.9998
...
...
dygraph/configs/ppyolo/_base_/ppyolo_r18vd.yml
浏览文件 @
287af3d1
architecture
:
YOLOv3
pretrain_weights
:
https://paddle-imagenet-models-name.bj.bcebos.com/ResNet18_vd_pretrained.tar
load_static_weights
:
true
pretrain_weights
:
https://paddledet.bj.bcebos.com/models/pretrained/ResNet18_vd_pretrained.pdparams
norm_type
:
sync_bn
use_ema
:
true
ema_decay
:
0.9998
...
...
dygraph/configs/ppyolo/_base_/ppyolo_r50vd_dcn.yml
浏览文件 @
287af3d1
architecture
:
YOLOv3
pretrain_weights
:
https://paddle-imagenet-models-name.bj.bcebos.com/ResNet50_vd_ssld_pretrained.tar
load_static_weights
:
true
pretrain_weights
:
https://paddledet.bj.bcebos.com/models/pretrained/ResNet50_vd_ssld_pretrained.pdparams
norm_type
:
sync_bn
use_ema
:
true
ema_decay
:
0.9998
...
...
dygraph/configs/slim/prune/yolov3_prune_fpgm.yml
浏览文件 @
287af3d1
# Weights of yolov3_mobilenet_v1_voc
pretrain_weights
:
https://paddlemodels.bj.bcebos.com/object_detection/dygraph/yolov3_mobilenet_v1_270e_voc.pdparams
load_static_weights
:
False
weight_type
:
resume
slim
:
Pruner
...
...
dygraph/configs/slim/prune/yolov3_prune_l1_norm.yml
浏览文件 @
287af3d1
# Weights of yolov3_mobilenet_v1_voc
pretrain_weights
:
https://paddlemodels.bj.bcebos.com/object_detection/dygraph/yolov3_mobilenet_v1_270e_voc.pdparams
load_static_weights
:
False
weight_type
:
resume
slim
:
Pruner
...
...
dygraph/configs/slim/quant/yolov3_mobilenet_v1_qat.yml
浏览文件 @
287af3d1
# Weights of yolov3_mobilenet_v1_coco
pretrain_weights
:
https://paddlemodels.bj.bcebos.com/object_detection/dygraph/yolov3_mobilenet_v1_270e_coco.pdparams
load_static_weights
:
False
weight_type
:
resume
slim
:
QAT
...
...
dygraph/configs/slim/quant/yolov3_mobilenet_v3_qat.yml
浏览文件 @
287af3d1
# Weights of yolov3_mobilenet_v3_coco
pretrain_weights
:
https://paddlemodels.bj.bcebos.com/object_detection/dygraph/yolov3_mobilenet_v3_large_270e_coco.pdparams
load_static_weights
:
False
weight_type
:
resume
slim
:
QAT
...
...
dygraph/configs/solov2/_base_/solov2_r50_fpn.yml
浏览文件 @
287af3d1
architecture
:
SOLOv2
pretrain_weights
:
https://paddle-imagenet-models-name.bj.bcebos.com/ResNet50_cos_pretrained.tar
load_static_weights
:
True
pretrain_weights
:
https://paddledet.bj.bcebos.com/models/pretrained/ResNet50_cos_pretrained.pdparams
SOLOv2
:
backbone
:
ResNet
...
...
dygraph/configs/ssd/_base_/ssd_mobilenet_v1_300.yml
浏览文件 @
287af3d1
architecture
:
SSD
pretrain_weights
:
https://paddlemodels.bj.bcebos.com/object_detection/ssd_mobilenet_v1_coco_pretrained.tar
load_static_weights
:
True
pretrain_weights
:
https://paddledet.bj.bcebos.com/models/pretrained/ssd_mobilenet_v1_coco_pretrained.pdparams
SSD
:
backbone
:
MobileNet
...
...
dygraph/configs/ssd/_base_/ssdlite_mobilenet_v1_300.yml
浏览文件 @
287af3d1
architecture
:
SSD
pretrain_weights
:
https://paddle-imagenet-models-name.bj.bcebos.com/MobileNetV1_ssld_pretrained.tar
load_static_weights
:
True
pretrain_weights
:
https://paddledet.bj.bcebos.com/models/pretrained/MobileNetV1_ssld_pretrained.pdparams
SSD
:
backbone
:
MobileNet
...
...
dygraph/configs/ssd/_base_/ssdlite_mobilenet_v3_large_320.yml
浏览文件 @
287af3d1
architecture
:
SSD
pretrain_weights
:
https://paddle-imagenet-models-name.bj.bcebos.com/MobileNetV3_large_x1_0_ssld_pretrained.tar
load_static_weights
:
True
pretrain_weights
:
https://paddledet.bj.bcebos.com/models/pretrained/MobileNetV3_large_x1_0_ssld_pretrained.pdparams
SSD
:
backbone
:
MobileNetV3
...
...
dygraph/configs/ssd/_base_/ssdlite_mobilenet_v3_small_320.yml
浏览文件 @
287af3d1
architecture
:
SSD
pretrain_weights
:
https://paddle-imagenet-models-name.bj.bcebos.com/MobileNetV3_small_x1_0_ssld_pretrained.tar
load_static_weights
:
True
pretrain_weights
:
https://paddledet.bj.bcebos.com/models/pretrained/MobileNetV3_small_x1_0_ssld_pretrained.pdparams
SSD
:
backbone
:
MobileNetV3
...
...
dygraph/configs/ttfnet/_base_/ttfnet_darknet53.yml
浏览文件 @
287af3d1
architecture
:
TTFNet
pretrain_weights
:
https://paddle-imagenet-models-name.bj.bcebos.com/DarkNet53_pretrained.tar
load_static_weights
:
True
pretrain_weights
:
https://paddledet.bj.bcebos.com/models/pretrained/DarkNet53_pretrained.pdparams
TTFNet
:
backbone
:
DarkNet
...
...
dygraph/configs/yolov3/_base_/yolov3_darknet53.yml
浏览文件 @
287af3d1
architecture
:
YOLOv3
pretrain_weights
:
https://paddle-imagenet-models-name.bj.bcebos.com/DarkNet53_pretrained.tar
load_static_weights
:
True
pretrain_weights
:
https://paddledet.bj.bcebos.com/models/pretrained/DarkNet53_pretrained.pdparams
norm_type
:
sync_bn
YOLOv3
:
...
...
dygraph/configs/yolov3/_base_/yolov3_mobilenet_v1.yml
浏览文件 @
287af3d1
architecture
:
YOLOv3
pretrain_weights
:
https://paddle-imagenet-models-name.bj.bcebos.com/MobileNetV1_pretrained.tar
load_static_weights
:
True
pretrain_weights
:
https://paddledet.bj.bcebos.com/models/pretrained/MobileNetV1_pretrained.pdparams
norm_type
:
sync_bn
YOLOv3
:
...
...
dygraph/configs/yolov3/_base_/yolov3_mobilenet_v3_large.yml
浏览文件 @
287af3d1
architecture
:
YOLOv3
pretrain_weights
:
https://paddle-imagenet-models-name.bj.bcebos.com/MobileNetV3_large_x1_0_pretrained.tar
load_static_weights
:
True
pretrain_weights
:
https://paddledet.bj.bcebos.com/models/pretrained/MobileNetV3_large_x1_0_ssld_pretrained.pdparams
norm_type
:
sync_bn
YOLOv3
:
...
...
dygraph/configs/yolov3/_base_/yolov3_mobilenet_v3_small.yml
浏览文件 @
287af3d1
architecture
:
YOLOv3
pretrain_weights
:
https://paddle-imagenet-models-name.bj.bcebos.com/MobileNetV3_small_x1_0_pretrained.tar
load_static_weights
:
True
pretrain_weights
:
https://paddledet.bj.bcebos.com/models/pretrained/MobileNetV3_small_x1_0_ssld_pretrained.pdparams
norm_type
:
sync_bn
YOLOv3
:
...
...
dygraph/configs/yolov3/_base_/yolov3_r50vd_dcn.yml
浏览文件 @
287af3d1
architecture
:
YOLOv3
pretrain_weights
:
https://paddle-imagenet-models-name.bj.bcebos.com/ResNet50_vd_ssld_pretrained.tar
load_static_weights
:
True
pretrain_weights
:
https://paddledet.bj.bcebos.com/models/pretrained/ResNet50_vd_ssld_pretrained.pdparams
norm_type
:
sync_bn
YOLOv3
:
...
...
dygraph/configs/yolov3/yolov3_mobilenet_v1_roadsign.yml
浏览文件 @
287af3d1
...
...
@@ -5,7 +5,6 @@ _BASE_: [
'
_base_/yolov3_reader.yml'
,
]
pretrain_weights
:
https://paddlemodels.bj.bcebos.com/object_detection/dygraph/yolov3_mobilenet_v1_270e_coco.pdparams
load_static_weights
:
false
norm_type
:
sync_bn
weights
:
output/yolov3_mobilenet_v1_roadsign/model_final
metric
:
VOC
...
...
dygraph/ppdet/engine/callbacks.py
浏览文件 @
287af3d1
...
...
@@ -29,7 +29,7 @@ from ppdet.utils.checkpoint import save_model
from
ppdet.optimizer
import
ModelEMA
from
ppdet.utils.logger
import
setup_logger
logger
=
setup_logger
(
__name__
)
logger
=
setup_logger
(
'ppdet.engine'
)
__all__
=
[
'Callback'
,
'ComposeCallback'
,
'LogPrinter'
,
'Checkpointer'
]
...
...
@@ -53,27 +53,27 @@ class Callback(object):
class
ComposeCallback
(
object
):
def
__init__
(
self
,
callbacks
):
callbacks
=
[
h
for
h
in
list
(
callbacks
)
if
h
is
not
None
]
for
h
in
callbacks
:
assert
isinstance
(
h
,
Callback
),
"hook shoule
be subclass of Callback"
callbacks
=
[
c
for
c
in
list
(
callbacks
)
if
c
is
not
None
]
for
c
in
callbacks
:
assert
isinstance
(
c
,
Callback
),
"callback should
be subclass of Callback"
self
.
_callbacks
=
callbacks
def
on_step_begin
(
self
,
status
):
for
h
in
self
.
_callbacks
:
h
.
on_step_begin
(
status
)
for
c
in
self
.
_callbacks
:
c
.
on_step_begin
(
status
)
def
on_step_end
(
self
,
status
):
for
h
in
self
.
_callbacks
:
h
.
on_step_end
(
status
)
for
c
in
self
.
_callbacks
:
c
.
on_step_end
(
status
)
def
on_epoch_begin
(
self
,
status
):
for
h
in
self
.
_callbacks
:
h
.
on_epoch_begin
(
status
)
for
c
in
self
.
_callbacks
:
c
.
on_epoch_begin
(
status
)
def
on_epoch_end
(
self
,
status
):
for
h
in
self
.
_callbacks
:
h
.
on_epoch_end
(
status
)
for
c
in
self
.
_callbacks
:
c
.
on_epoch_end
(
status
)
class
LogPrinter
(
Callback
):
...
...
dygraph/ppdet/engine/export_utils.py
浏览文件 @
287af3d1
...
...
@@ -23,7 +23,7 @@ from collections import OrderedDict
from
ppdet.metrics
import
get_categories
from
ppdet.utils.logger
import
setup_logger
logger
=
setup_logger
(
__name__
)
logger
=
setup_logger
(
'ppdet.engine'
)
# Global dictionary
TRT_MIN_SUBGRAPH
=
{
...
...
dygraph/ppdet/engine/trainer.py
浏览文件 @
287af3d1
...
...
@@ -38,7 +38,7 @@ from .callbacks import Callback, ComposeCallback, LogPrinter, Checkpointer, Wife
from
.export_utils
import
_dump_infer_config
from
ppdet.utils.logger
import
setup_logger
logger
=
setup_logger
(
__name__
)
logger
=
setup_logger
(
'ppdet.engine'
)
__all__
=
[
'Trainer'
]
...
...
@@ -157,7 +157,7 @@ class Trainer(object):
metric
.
reset
()
def
register_callbacks
(
self
,
callbacks
):
callbacks
=
[
h
for
h
in
list
(
callbacks
)
if
h
is
not
None
]
callbacks
=
[
c
for
c
in
list
(
callbacks
)
if
c
is
not
None
]
for
c
in
callbacks
:
assert
isinstance
(
c
,
Callback
),
\
"metrics shoule be instances of subclass of Metric"
...
...
@@ -179,9 +179,7 @@ class Trainer(object):
logger
.
debug
(
"Resume weights of epoch {}"
.
format
(
self
.
start_epoch
))
else
:
self
.
start_epoch
=
0
load_pretrain_weight
(
self
.
model
,
weights
,
self
.
cfg
.
get
(
'load_static_weights'
,
False
),
weight_type
)
load_pretrain_weight
(
self
.
model
,
weights
,
weight_type
)
logger
.
debug
(
"Load {} weights {} to start training"
.
format
(
weight_type
,
weights
))
...
...
dygraph/ppdet/utils/checkpoint.py
浏览文件 @
287af3d1
...
...
@@ -142,10 +142,7 @@ def load_weight(model, weight, optimizer=None):
return
last_epoch
def
load_pretrain_weight
(
model
,
pretrain_weight
,
load_static_weights
=
False
,
weight_type
=
'pretrain'
):
def
load_pretrain_weight
(
model
,
pretrain_weight
,
weight_type
=
'pretrain'
):
assert
weight_type
in
[
'pretrain'
,
'finetune'
]
if
is_url
(
pretrain_weight
):
...
...
@@ -161,23 +158,6 @@ def load_pretrain_weight(model,
model_dict
=
model
.
state_dict
()
if
load_static_weights
:
pre_state_dict
=
paddle
.
static
.
load_program_state
(
path
)
param_state_dict
=
{}
for
key
in
model_dict
.
keys
():
weight_name
=
model_dict
[
key
].
name
if
weight_name
in
pre_state_dict
.
keys
():
logger
.
info
(
'Load weight: {}, shape: {}'
.
format
(
weight_name
,
pre_state_dict
[
weight_name
].
shape
))
param_state_dict
[
key
]
=
pre_state_dict
[
weight_name
]
else
:
if
'backbone'
in
key
:
logger
.
info
(
'Lack weight: {}, structure name: {}'
.
format
(
weight_name
,
key
))
param_state_dict
[
key
]
=
model_dict
[
key
]
model
.
set_dict
(
param_state_dict
)
return
param_state_dict
=
paddle
.
load
(
path
+
'.pdparams'
)
if
weight_type
==
'pretrain'
:
model
.
backbone
.
set_dict
(
param_state_dict
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录