From 5e90c3f183880120a36e4ea56b7d997db454e3c1 Mon Sep 17 00:00:00 2001 From: liuhui29 Date: Wed, 16 Sep 2020 15:34:01 +0800 Subject: [PATCH] set use_fine_grained_loss=True as default, and remove use_fine_grained_loss=True from config --- configs/dcn/yolov3_enhance_reader.yml | 1 - .../yolov3_r50vd_dcn_db_iouaware_obj365_pretrained_coco.yml | 3 --- .../yolov3_r50vd_dcn_db_iouloss_obj365_pretrained_coco.yml | 3 --- configs/dcn/yolov3_r50vd_dcn_db_obj365_pretrained_coco.yml | 3 --- configs/dcn/yolov3_r50vd_dcn_obj365_pretrained_coco.yml | 3 --- configs/ppyolo/ppyolo.yml | 3 --- configs/ppyolo/ppyolo_2x.yml | 3 --- configs/ppyolo/ppyolo_r18vd.yml | 3 --- configs/ppyolo/ppyolo_test.yml | 2 -- configs/yolov4/yolov4_cspdarknet.yml | 1 - configs/yolov4/yolov4_cspdarknet_coco.yml | 1 - configs/yolov4/yolov4_cspdarknet_voc.yml | 1 - ppdet/data/reader.py | 2 +- ppdet/modeling/architectures/yolo.py | 4 ++-- ppdet/modeling/losses/yolo_loss.py | 2 +- 15 files changed, 4 insertions(+), 31 deletions(-) diff --git a/configs/dcn/yolov3_enhance_reader.yml b/configs/dcn/yolov3_enhance_reader.yml index 0cb379d25..db72a924b 100644 --- a/configs/dcn/yolov3_enhance_reader.yml +++ b/configs/dcn/yolov3_enhance_reader.yml @@ -2,7 +2,6 @@ TrainReader: inputs_def: fields: ['image', 'gt_bbox', 'gt_class', 'gt_score'] num_max_boxes: 50 - use_fine_grained_loss: true dataset: !COCODataSet image_dir: train2017 diff --git a/configs/dcn/yolov3_r50vd_dcn_db_iouaware_obj365_pretrained_coco.yml b/configs/dcn/yolov3_r50vd_dcn_db_iouaware_obj365_pretrained_coco.yml index 6177aaac7..f40622036 100755 --- a/configs/dcn/yolov3_r50vd_dcn_db_iouaware_obj365_pretrained_coco.yml +++ b/configs/dcn/yolov3_r50vd_dcn_db_iouaware_obj365_pretrained_coco.yml @@ -8,12 +8,10 @@ metric: COCO pretrain_weights: https://paddlemodels.bj.bcebos.com/object_detection/ResNet50_vd_dcn_db_obj365_pretrained.tar weights: output/yolov3_r50vd_dcn_db_iouaware_obj365_pretrained_coco/model_final num_classes: 80 -use_fine_grained_loss: true YOLOv3: backbone: ResNet yolo_head: YOLOv3Head - use_fine_grained_loss: true ResNet: norm_type: sync_bn @@ -47,7 +45,6 @@ YOLOv3Loss: batch_size: 8 ignore_thresh: 0.7 label_smooth: false - use_fine_grained_loss: true iou_loss: IouLoss iou_aware_loss: IouAwareLoss diff --git a/configs/dcn/yolov3_r50vd_dcn_db_iouloss_obj365_pretrained_coco.yml b/configs/dcn/yolov3_r50vd_dcn_db_iouloss_obj365_pretrained_coco.yml index 5e9431453..6f5ec51b7 100755 --- a/configs/dcn/yolov3_r50vd_dcn_db_iouloss_obj365_pretrained_coco.yml +++ b/configs/dcn/yolov3_r50vd_dcn_db_iouloss_obj365_pretrained_coco.yml @@ -8,12 +8,10 @@ metric: COCO pretrain_weights: https://paddlemodels.bj.bcebos.com/object_detection/ResNet50_vd_dcn_db_obj365_pretrained.tar weights: output/yolov3_r50vd_dcn_db_iouloss_obj365_pretrained_coco/model_final num_classes: 80 -use_fine_grained_loss: true YOLOv3: backbone: ResNet yolo_head: YOLOv3Head - use_fine_grained_loss: true ResNet: norm_type: sync_bn @@ -49,7 +47,6 @@ YOLOv3Loss: batch_size: 8 ignore_thresh: 0.7 label_smooth: false - use_fine_grained_loss: true iou_loss: IouLoss IouLoss: diff --git a/configs/dcn/yolov3_r50vd_dcn_db_obj365_pretrained_coco.yml b/configs/dcn/yolov3_r50vd_dcn_db_obj365_pretrained_coco.yml index 3c69e410a..e0e92d339 100755 --- a/configs/dcn/yolov3_r50vd_dcn_db_obj365_pretrained_coco.yml +++ b/configs/dcn/yolov3_r50vd_dcn_db_obj365_pretrained_coco.yml @@ -8,12 +8,10 @@ metric: COCO pretrain_weights: https://paddlemodels.bj.bcebos.com/object_detection/ResNet50_vd_dcn_db_obj365_pretrained.tar weights: output/yolov3_r50vd_dcn_db_obj365_pretrained_coco/model_final num_classes: 80 -use_fine_grained_loss: true YOLOv3: backbone: ResNet yolo_head: YOLOv3Head - use_fine_grained_loss: true ResNet: norm_type: sync_bn @@ -50,7 +48,6 @@ YOLOv3Loss: batch_size: 8 ignore_thresh: 0.7 label_smooth: false - use_fine_grained_loss: true LearningRate: base_lr: 0.001 diff --git a/configs/dcn/yolov3_r50vd_dcn_obj365_pretrained_coco.yml b/configs/dcn/yolov3_r50vd_dcn_obj365_pretrained_coco.yml index 014a7947e..4a7fe23a6 100755 --- a/configs/dcn/yolov3_r50vd_dcn_obj365_pretrained_coco.yml +++ b/configs/dcn/yolov3_r50vd_dcn_obj365_pretrained_coco.yml @@ -8,12 +8,10 @@ metric: COCO pretrain_weights: https://paddlemodels.bj.bcebos.com/object_detection/ResNet50_vd_dcn_db_obj365_pretrained.tar weights: output/yolov3_r50vd_dcn_db_obj365_pretrained_coco/model_final num_classes: 80 -use_fine_grained_loss: true YOLOv3: backbone: ResNet yolo_head: YOLOv3Head - use_fine_grained_loss: true ResNet: norm_type: sync_bn @@ -48,7 +46,6 @@ YOLOv3Loss: batch_size: 8 ignore_thresh: 0.7 label_smooth: false - use_fine_grained_loss: true LearningRate: base_lr: 0.001 diff --git a/configs/ppyolo/ppyolo.yml b/configs/ppyolo/ppyolo.yml index 59d5faa3a..6c6011d52 100644 --- a/configs/ppyolo/ppyolo.yml +++ b/configs/ppyolo/ppyolo.yml @@ -9,14 +9,12 @@ metric: COCO pretrain_weights: https://paddle-imagenet-models-name.bj.bcebos.com/ResNet50_vd_ssld_pretrained.tar weights: output/ppyolo/model_final num_classes: 80 -use_fine_grained_loss: true use_ema: true ema_decay: 0.9998 YOLOv3: backbone: ResNet yolo_head: YOLOv3Head - use_fine_grained_loss: true ResNet: norm_type: sync_bn @@ -48,7 +46,6 @@ YOLOv3Loss: ignore_thresh: 0.7 scale_x_y: 1.05 label_smooth: false - use_fine_grained_loss: true iou_loss: IouLoss iou_aware_loss: IouAwareLoss diff --git a/configs/ppyolo/ppyolo_2x.yml b/configs/ppyolo/ppyolo_2x.yml index 8c2493372..0ffb1ecc8 100644 --- a/configs/ppyolo/ppyolo_2x.yml +++ b/configs/ppyolo/ppyolo_2x.yml @@ -9,14 +9,12 @@ metric: COCO pretrain_weights: https://paddle-imagenet-models-name.bj.bcebos.com/ResNet50_vd_ssld_pretrained.tar weights: output/ppyolo/model_final num_classes: 80 -use_fine_grained_loss: true use_ema: true ema_decay: 0.9998 YOLOv3: backbone: ResNet yolo_head: YOLOv3Head - use_fine_grained_loss: true ResNet: norm_type: sync_bn @@ -48,7 +46,6 @@ YOLOv3Loss: ignore_thresh: 0.7 scale_x_y: 1.05 label_smooth: false - use_fine_grained_loss: true iou_loss: IouLoss iou_aware_loss: IouAwareLoss diff --git a/configs/ppyolo/ppyolo_r18vd.yml b/configs/ppyolo/ppyolo_r18vd.yml index c054d5f5d..fee2a55da 100755 --- a/configs/ppyolo/ppyolo_r18vd.yml +++ b/configs/ppyolo/ppyolo_r18vd.yml @@ -9,14 +9,12 @@ metric: COCO pretrain_weights: https://paddle-imagenet-models-name.bj.bcebos.com/ResNet18_vd_pretrained.tar weights: output/ppyolo_tiny/model_final num_classes: 80 -use_fine_grained_loss: true use_ema: true ema_decay: 0.9998 YOLOv3: backbone: ResNet yolo_head: YOLOv3Head - use_fine_grained_loss: true ResNet: norm_type: sync_bn @@ -43,7 +41,6 @@ YOLOv3Loss: ignore_thresh: 0.7 scale_x_y: 1.05 label_smooth: false - use_fine_grained_loss: true iou_loss: IouLoss IouLoss: diff --git a/configs/ppyolo/ppyolo_test.yml b/configs/ppyolo/ppyolo_test.yml index 840865a0b..bf2de1ae6 100644 --- a/configs/ppyolo/ppyolo_test.yml +++ b/configs/ppyolo/ppyolo_test.yml @@ -11,7 +11,6 @@ metric: COCO pretrain_weights: https://paddle-imagenet-models-name.bj.bcebos.com/ResNet50_vd_ssld_pretrained.tar weights: output/ppyolo/model_final num_classes: 80 -use_fine_grained_loss: true use_ema: true ema_decay: 0.9998 save_prediction_only: True @@ -19,7 +18,6 @@ save_prediction_only: True YOLOv3: backbone: ResNet yolo_head: YOLOv3Head - use_fine_grained_loss: true ResNet: norm_type: sync_bn diff --git a/configs/yolov4/yolov4_cspdarknet.yml b/configs/yolov4/yolov4_cspdarknet.yml index 4411b054f..a1e1308a3 100644 --- a/configs/yolov4/yolov4_cspdarknet.yml +++ b/configs/yolov4/yolov4_cspdarknet.yml @@ -8,7 +8,6 @@ metric: COCO pretrain_weights: https://paddlemodels.bj.bcebos.com/object_detection/yolov4_cspdarknet.pdparams weights: output/yolov4_cspdarknet/model_final num_classes: 80 -use_fine_grained_loss: true save_prediction_only: True YOLOv4: diff --git a/configs/yolov4/yolov4_cspdarknet_coco.yml b/configs/yolov4/yolov4_cspdarknet_coco.yml index 8b4a15dc5..ac12e748f 100644 --- a/configs/yolov4/yolov4_cspdarknet_coco.yml +++ b/configs/yolov4/yolov4_cspdarknet_coco.yml @@ -8,7 +8,6 @@ metric: COCO pretrain_weights: https://paddlemodels.bj.bcebos.com/object_detection/CSPDarkNet53_pretrained.pdparams weights: output/yolov4_cspdarknet_coco/model_final num_classes: 80 -use_fine_grained_loss: true YOLOv4: backbone: CSPDarkNet diff --git a/configs/yolov4/yolov4_cspdarknet_voc.yml b/configs/yolov4/yolov4_cspdarknet_voc.yml index beefaa0f1..9c717ec13 100644 --- a/configs/yolov4/yolov4_cspdarknet_voc.yml +++ b/configs/yolov4/yolov4_cspdarknet_voc.yml @@ -8,7 +8,6 @@ metric: VOC pretrain_weights: https://paddlemodels.bj.bcebos.com/object_detection/yolov4_cspdarknet.pdparams weights: output/yolov4_cspdarknet_voc/model_final num_classes: 20 -use_fine_grained_loss: true YOLOv4: backbone: CSPDarkNet diff --git a/ppdet/data/reader.py b/ppdet/data/reader.py index 3dce62d8e..01ce8aecd 100644 --- a/ppdet/data/reader.py +++ b/ppdet/data/reader.py @@ -199,7 +199,7 @@ class Reader(object): class_aware_sampling=False, worker_num=-1, use_process=False, - use_fine_grained_loss=False, + use_fine_grained_loss=True, num_classes=80, bufsize=-1, memsize='3G', diff --git a/ppdet/modeling/architectures/yolo.py b/ppdet/modeling/architectures/yolo.py index 80ac34e42..768c5d4c0 100644 --- a/ppdet/modeling/architectures/yolo.py +++ b/ppdet/modeling/architectures/yolo.py @@ -43,7 +43,7 @@ class YOLOv3(object): def __init__(self, backbone, yolo_head='YOLOv3Head', - use_fine_grained_loss=False): + use_fine_grained_loss=True): super(YOLOv3, self).__init__() self.backbone = backbone self.yolo_head = yolo_head @@ -182,7 +182,7 @@ class YOLOv4(YOLOv3): def __init__(self, backbone, yolo_head='YOLOv4Head', - use_fine_grained_loss=False): + use_fine_grained_loss=True): super(YOLOv4, self).__init__( backbone=backbone, yolo_head=yolo_head, diff --git a/ppdet/modeling/losses/yolo_loss.py b/ppdet/modeling/losses/yolo_loss.py index 6823c024b..243737102 100644 --- a/ppdet/modeling/losses/yolo_loss.py +++ b/ppdet/modeling/losses/yolo_loss.py @@ -45,7 +45,7 @@ class YOLOv3Loss(object): batch_size=8, ignore_thresh=0.7, label_smooth=True, - use_fine_grained_loss=False, + use_fine_grained_loss=True, iou_loss=None, iou_aware_loss=None, downsample=[32, 16, 8], -- GitLab