diff --git a/dygraph/configs/cascade_rcnn/_base_/cascade_mask_rcnn_r50_fpn.yml b/dygraph/configs/cascade_rcnn/_base_/cascade_mask_rcnn_r50_fpn.yml index 460b88c2c9cd9dba9d54adc2618ae7f594766609..8fef452e859ebf8171ff5bbc6d5e2a3d85929221 100644 --- a/dygraph/configs/cascade_rcnn/_base_/cascade_mask_rcnn_r50_fpn.yml +++ b/dygraph/configs/cascade_rcnn/_base_/cascade_mask_rcnn_r50_fpn.yml @@ -1,6 +1,5 @@ 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: diff --git a/dygraph/configs/cascade_rcnn/_base_/cascade_rcnn_r50_fpn.yml b/dygraph/configs/cascade_rcnn/_base_/cascade_rcnn_r50_fpn.yml index 24548315398408a27578cc89805ba9c0a29c7103..51905687ebbd16413504667493bce81d4b211e6a 100644 --- a/dygraph/configs/cascade_rcnn/_base_/cascade_rcnn_r50_fpn.yml +++ b/dygraph/configs/cascade_rcnn/_base_/cascade_rcnn_r50_fpn.yml @@ -1,6 +1,5 @@ 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: diff --git a/dygraph/configs/faster_rcnn/_base_/faster_rcnn_r50.yml b/dygraph/configs/faster_rcnn/_base_/faster_rcnn_r50.yml index 43a9dba90e19690f0b6103cadbe565ab97c67e25..fd29f5ea1a1df9e2599d3efcff344c5d3363945e 100644 --- a/dygraph/configs/faster_rcnn/_base_/faster_rcnn_r50.yml +++ b/dygraph/configs/faster_rcnn/_base_/faster_rcnn_r50.yml @@ -1,6 +1,5 @@ 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 diff --git a/dygraph/configs/faster_rcnn/_base_/faster_rcnn_r50_fpn.yml b/dygraph/configs/faster_rcnn/_base_/faster_rcnn_r50_fpn.yml index 62b5704b36bf09a492a6ba5a93de364b20e75316..aa5f5b28811e263bdc5c256d8b381e810c6b7196 100644 --- a/dygraph/configs/faster_rcnn/_base_/faster_rcnn_r50_fpn.yml +++ b/dygraph/configs/faster_rcnn/_base_/faster_rcnn_r50_fpn.yml @@ -1,6 +1,5 @@ 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 diff --git a/dygraph/configs/fcos/_base_/fcos_r50_fpn.yml b/dygraph/configs/fcos/_base_/fcos_r50_fpn.yml index fd8904cb06853cb843cc5644116cf8cb93e4122b..1124082ee32ded9e4ad74f2700918c030f2cad44 100644 --- a/dygraph/configs/fcos/_base_/fcos_r50_fpn.yml +++ b/dygraph/configs/fcos/_base_/fcos_r50_fpn.yml @@ -1,6 +1,5 @@ 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 diff --git a/dygraph/configs/hrnet/_base_/faster_rcnn_hrnetv2p_w18.yml b/dygraph/configs/hrnet/_base_/faster_rcnn_hrnetv2p_w18.yml index cc6cec5b05ea36e3d1bbdbb225a44acd994217c1..cf6645d1e338ca303876fed5c5f480cb505eeca6 100644 --- a/dygraph/configs/hrnet/_base_/faster_rcnn_hrnetv2p_w18.yml +++ b/dygraph/configs/hrnet/_base_/faster_rcnn_hrnetv2p_w18.yml @@ -1,6 +1,5 @@ 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 diff --git a/dygraph/configs/mask_rcnn/_base_/mask_rcnn_r50.yml b/dygraph/configs/mask_rcnn/_base_/mask_rcnn_r50.yml index fc2694a06cb68ae791e05b6c4638ad3c2d74e7f0..aa6e0db56920c15099a05f544d92ab3e3250b7a1 100644 --- a/dygraph/configs/mask_rcnn/_base_/mask_rcnn_r50.yml +++ b/dygraph/configs/mask_rcnn/_base_/mask_rcnn_r50.yml @@ -1,6 +1,5 @@ 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 diff --git a/dygraph/configs/mask_rcnn/_base_/mask_rcnn_r50_fpn.yml b/dygraph/configs/mask_rcnn/_base_/mask_rcnn_r50_fpn.yml index e0ee9355f111fcdacf18e3916db70f60e18a016d..74004b281096346e7127950bb6022a7cd55e90ba 100644 --- a/dygraph/configs/mask_rcnn/_base_/mask_rcnn_r50_fpn.yml +++ b/dygraph/configs/mask_rcnn/_base_/mask_rcnn_r50_fpn.yml @@ -1,6 +1,5 @@ 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 diff --git a/dygraph/configs/ppyolo/_base_/ppyolo_mbv3_large.yml b/dygraph/configs/ppyolo/_base_/ppyolo_mbv3_large.yml index 65ff63bbc8efab5f89987d1dd8ef0bb4ca10ed37..dc84ae75c5e3e2a94380e59c02b55934a1f51661 100644 --- a/dygraph/configs/ppyolo/_base_/ppyolo_mbv3_large.yml +++ b/dygraph/configs/ppyolo/_base_/ppyolo_mbv3_large.yml @@ -1,6 +1,5 @@ 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 diff --git a/dygraph/configs/ppyolo/_base_/ppyolo_mbv3_small.yml b/dygraph/configs/ppyolo/_base_/ppyolo_mbv3_small.yml index 76eb5b5bb82918583b9ba8f72feb5d7b5758d2fd..7e3a30c9a0dc6ebe29751e8dd0562e1f0fc78dec 100644 --- a/dygraph/configs/ppyolo/_base_/ppyolo_mbv3_small.yml +++ b/dygraph/configs/ppyolo/_base_/ppyolo_mbv3_small.yml @@ -1,6 +1,5 @@ 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 diff --git a/dygraph/configs/ppyolo/_base_/ppyolo_r18vd.yml b/dygraph/configs/ppyolo/_base_/ppyolo_r18vd.yml index e1caea7884e39896e27f73c092133c687a7af596..4b9e924be1d11a098e0b73a4592347bb1a8c2bbe 100644 --- a/dygraph/configs/ppyolo/_base_/ppyolo_r18vd.yml +++ b/dygraph/configs/ppyolo/_base_/ppyolo_r18vd.yml @@ -1,6 +1,5 @@ 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 diff --git a/dygraph/configs/ppyolo/_base_/ppyolo_r50vd_dcn.yml b/dygraph/configs/ppyolo/_base_/ppyolo_r50vd_dcn.yml index 2afcf80533cc01d355706c3b6c40cff78429a967..22cad952379161a58dd298b98c1ab36999dae28d 100644 --- a/dygraph/configs/ppyolo/_base_/ppyolo_r50vd_dcn.yml +++ b/dygraph/configs/ppyolo/_base_/ppyolo_r50vd_dcn.yml @@ -1,6 +1,5 @@ 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 diff --git a/dygraph/configs/slim/prune/yolov3_prune_fpgm.yml b/dygraph/configs/slim/prune/yolov3_prune_fpgm.yml index 38b15f683479861bbb806182c8e8fd4839dd564a..a1c72fde697606868596142ce4a99025f8157a3e 100644 --- a/dygraph/configs/slim/prune/yolov3_prune_fpgm.yml +++ b/dygraph/configs/slim/prune/yolov3_prune_fpgm.yml @@ -1,6 +1,5 @@ # 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 diff --git a/dygraph/configs/slim/prune/yolov3_prune_l1_norm.yml b/dygraph/configs/slim/prune/yolov3_prune_l1_norm.yml index 2f1c76d92f801eccd280151daa7c4bece13e833b..313ee541d99f896926fffc47ca54f999c8bccb2d 100644 --- a/dygraph/configs/slim/prune/yolov3_prune_l1_norm.yml +++ b/dygraph/configs/slim/prune/yolov3_prune_l1_norm.yml @@ -1,6 +1,5 @@ # 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 diff --git a/dygraph/configs/slim/quant/yolov3_mobilenet_v1_qat.yml b/dygraph/configs/slim/quant/yolov3_mobilenet_v1_qat.yml index 25cfc37068e88ae9a991249b9d921be36bcffe8e..f168f40ea47b79d03771c006c6cf7619630763c3 100644 --- a/dygraph/configs/slim/quant/yolov3_mobilenet_v1_qat.yml +++ b/dygraph/configs/slim/quant/yolov3_mobilenet_v1_qat.yml @@ -1,6 +1,5 @@ # 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 diff --git a/dygraph/configs/slim/quant/yolov3_mobilenet_v3_qat.yml b/dygraph/configs/slim/quant/yolov3_mobilenet_v3_qat.yml index 5ea8fc7aae05f052f9bceab84b74bc4adb76b44d..34a07449876c4f5815222be13dcf3fe4d5f48314 100644 --- a/dygraph/configs/slim/quant/yolov3_mobilenet_v3_qat.yml +++ b/dygraph/configs/slim/quant/yolov3_mobilenet_v3_qat.yml @@ -1,6 +1,5 @@ # 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 diff --git a/dygraph/configs/solov2/_base_/solov2_r50_fpn.yml b/dygraph/configs/solov2/_base_/solov2_r50_fpn.yml index 92ebe213e0f0c07ab388c59cbc803d3c17d2baf6..53ec3b288fbb1f2e39d7d4f504fb069e26faeaa8 100644 --- a/dygraph/configs/solov2/_base_/solov2_r50_fpn.yml +++ b/dygraph/configs/solov2/_base_/solov2_r50_fpn.yml @@ -1,6 +1,5 @@ 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 diff --git a/dygraph/configs/ssd/_base_/ssd_mobilenet_v1_300.yml b/dygraph/configs/ssd/_base_/ssd_mobilenet_v1_300.yml index 1eb9f68ef230962b733be1c24badcc6c28fb6561..b8fe6946eeaf43272a7bb5c7e94b7df5b420802e 100644 --- a/dygraph/configs/ssd/_base_/ssd_mobilenet_v1_300.yml +++ b/dygraph/configs/ssd/_base_/ssd_mobilenet_v1_300.yml @@ -1,6 +1,5 @@ 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 diff --git a/dygraph/configs/ssd/_base_/ssdlite_mobilenet_v1_300.yml b/dygraph/configs/ssd/_base_/ssdlite_mobilenet_v1_300.yml index 2e5a47485be13ad398840b15af9ddaed9316188e..db811ade9d7b89d2b407d40dec7e313feff11420 100644 --- a/dygraph/configs/ssd/_base_/ssdlite_mobilenet_v1_300.yml +++ b/dygraph/configs/ssd/_base_/ssdlite_mobilenet_v1_300.yml @@ -1,6 +1,5 @@ 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 diff --git a/dygraph/configs/ssd/_base_/ssdlite_mobilenet_v3_large_320.yml b/dygraph/configs/ssd/_base_/ssdlite_mobilenet_v3_large_320.yml index a3586ee2f2dad0591a312df1f77cfb41021a6ee1..cc6e3284a3ed961009128c6b7c51f6abd901f376 100644 --- a/dygraph/configs/ssd/_base_/ssdlite_mobilenet_v3_large_320.yml +++ b/dygraph/configs/ssd/_base_/ssdlite_mobilenet_v3_large_320.yml @@ -1,6 +1,5 @@ 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 diff --git a/dygraph/configs/ssd/_base_/ssdlite_mobilenet_v3_small_320.yml b/dygraph/configs/ssd/_base_/ssdlite_mobilenet_v3_small_320.yml index 6169d9759c29f4a125285590cb4b8f50e54cd2fd..887f95fa291c772d73d7b133f488e8282d315940 100644 --- a/dygraph/configs/ssd/_base_/ssdlite_mobilenet_v3_small_320.yml +++ b/dygraph/configs/ssd/_base_/ssdlite_mobilenet_v3_small_320.yml @@ -1,6 +1,5 @@ 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 diff --git a/dygraph/configs/ttfnet/_base_/ttfnet_darknet53.yml b/dygraph/configs/ttfnet/_base_/ttfnet_darknet53.yml index d175cadb2d907ca70e27824f88a7093b6e193ac1..90b0c3361b12c41d6556910efe09d2159b22e793 100644 --- a/dygraph/configs/ttfnet/_base_/ttfnet_darknet53.yml +++ b/dygraph/configs/ttfnet/_base_/ttfnet_darknet53.yml @@ -1,6 +1,5 @@ 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 diff --git a/dygraph/configs/yolov3/_base_/yolov3_darknet53.yml b/dygraph/configs/yolov3/_base_/yolov3_darknet53.yml index ec1200e69eb614a180a2ff2607cae66be70121f9..1187f6eac9d4e55eeea4d0b6e0c678ad01d724b0 100644 --- a/dygraph/configs/yolov3/_base_/yolov3_darknet53.yml +++ b/dygraph/configs/yolov3/_base_/yolov3_darknet53.yml @@ -1,6 +1,5 @@ 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: diff --git a/dygraph/configs/yolov3/_base_/yolov3_mobilenet_v1.yml b/dygraph/configs/yolov3/_base_/yolov3_mobilenet_v1.yml index e82d155608f61f1a6477e9de7fa8865baf8aa035..6452b5132b47203379bb3292eb0afc6958d4609f 100644 --- a/dygraph/configs/yolov3/_base_/yolov3_mobilenet_v1.yml +++ b/dygraph/configs/yolov3/_base_/yolov3_mobilenet_v1.yml @@ -1,6 +1,5 @@ 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: diff --git a/dygraph/configs/yolov3/_base_/yolov3_mobilenet_v3_large.yml b/dygraph/configs/yolov3/_base_/yolov3_mobilenet_v3_large.yml index 8c299f373e9fa5a226404e6653ec0945079e8944..94b5dea3ea6b2039ce5aaf8ccab44d651727bd21 100644 --- a/dygraph/configs/yolov3/_base_/yolov3_mobilenet_v3_large.yml +++ b/dygraph/configs/yolov3/_base_/yolov3_mobilenet_v3_large.yml @@ -1,6 +1,5 @@ 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: diff --git a/dygraph/configs/yolov3/_base_/yolov3_mobilenet_v3_small.yml b/dygraph/configs/yolov3/_base_/yolov3_mobilenet_v3_small.yml index 8ddf2965c9d2917a637f44672cc4f01aeef45981..f0f144b916c44da6de45de762310e3470179ac5a 100644 --- a/dygraph/configs/yolov3/_base_/yolov3_mobilenet_v3_small.yml +++ b/dygraph/configs/yolov3/_base_/yolov3_mobilenet_v3_small.yml @@ -1,6 +1,5 @@ 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: diff --git a/dygraph/configs/yolov3/_base_/yolov3_r50vd_dcn.yml b/dygraph/configs/yolov3/_base_/yolov3_r50vd_dcn.yml index 1c4e0dc68082622cc449aabebf481c2c6916a701..0d01148b476e5bbc4c9ae96cc7a215258e7d7042 100644 --- a/dygraph/configs/yolov3/_base_/yolov3_r50vd_dcn.yml +++ b/dygraph/configs/yolov3/_base_/yolov3_r50vd_dcn.yml @@ -1,6 +1,5 @@ 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: diff --git a/dygraph/configs/yolov3/yolov3_mobilenet_v1_roadsign.yml b/dygraph/configs/yolov3/yolov3_mobilenet_v1_roadsign.yml index f5048c2f7073455b9932a32445084dcbae3e0331..36936e1976f0d152150ff6c613a2f97b4c25d731 100644 --- a/dygraph/configs/yolov3/yolov3_mobilenet_v1_roadsign.yml +++ b/dygraph/configs/yolov3/yolov3_mobilenet_v1_roadsign.yml @@ -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 diff --git a/dygraph/ppdet/engine/callbacks.py b/dygraph/ppdet/engine/callbacks.py index 6c973d8b46ab5dd35d52044d5d913d91e46b8430..1419661ca6e5213f0012ca04f60964ac5092998a 100644 --- a/dygraph/ppdet/engine/callbacks.py +++ b/dygraph/ppdet/engine/callbacks.py @@ -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): diff --git a/dygraph/ppdet/engine/export_utils.py b/dygraph/ppdet/engine/export_utils.py index cfca44489617d43ae41fd003e2f88f30cbc5703a..7fa2403d53c345fc2c1b52830fab122954af3403 100644 --- a/dygraph/ppdet/engine/export_utils.py +++ b/dygraph/ppdet/engine/export_utils.py @@ -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 = { diff --git a/dygraph/ppdet/engine/trainer.py b/dygraph/ppdet/engine/trainer.py index ce4688ad7e3add30d917fe608562f9bf666819a7..5a944c8de19326577e8b339034750cafe3012e28 100644 --- a/dygraph/ppdet/engine/trainer.py +++ b/dygraph/ppdet/engine/trainer.py @@ -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)) diff --git a/dygraph/ppdet/utils/checkpoint.py b/dygraph/ppdet/utils/checkpoint.py index a0501c9727afc559d682f1d429bc4befaf3e5a83..193f415ad95f2dffef43a942f1e697f128f2e639 100644 --- a/dygraph/ppdet/utils/checkpoint.py +++ b/dygraph/ppdet/utils/checkpoint.py @@ -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)