diff --git a/configs/ppyolo/ppyolo_r50vd_dcn_voc.yml b/configs/ppyolo/ppyolo_r50vd_dcn_voc.yml index b383deab0f9f6de315b5cbcb8d326ec780fffb8f..3a0a4aa921f41448df7093fda1777a0e121f70af 100644 --- a/configs/ppyolo/ppyolo_r50vd_dcn_voc.yml +++ b/configs/ppyolo/ppyolo_r50vd_dcn_voc.yml @@ -21,6 +21,10 @@ TrainReader: mixup_epoch: 350 batch_size: 12 +EvalReader: + batch_transforms: + - PadBatch: {pad_gt: True} + epoch: 583 LearningRate: diff --git a/configs/ssd/ssd_mobilenet_v1_300_120e_voc.yml b/configs/ssd/ssd_mobilenet_v1_300_120e_voc.yml index 45de7733a3f263b7dbf84a0f0bf933eedcc9b78e..3453f027682456f738be55d7b983efde0620a570 100644 --- a/configs/ssd/ssd_mobilenet_v1_300_120e_voc.yml +++ b/configs/ssd/ssd_mobilenet_v1_300_120e_voc.yml @@ -6,3 +6,7 @@ _BASE_: [ '_base_/ssd_mobilenet_reader.yml', ] weights: output/ssd_mobilenet_v1_300_120e_voc/model_final + +EvalReader: + batch_transforms: + - PadBatch: {pad_gt: True} diff --git a/configs/ssd/ssd_vgg16_300_240e_voc.yml b/configs/ssd/ssd_vgg16_300_240e_voc.yml index 58cf4b9855a4ca414faf67eae2179f40fc63bf77..e2e2d307cbf4a67c9ff8ee806892657bfe39768c 100644 --- a/configs/ssd/ssd_vgg16_300_240e_voc.yml +++ b/configs/ssd/ssd_vgg16_300_240e_voc.yml @@ -6,3 +6,7 @@ _BASE_: [ '_base_/ssd_reader.yml', ] weights: output/ssd_vgg16_300_240e_voc/model_final + +EvalReader: + batch_transforms: + - PadBatch: {pad_gt: True} diff --git a/configs/yolov3/yolov3_darknet53_270e_voc.yml b/configs/yolov3/yolov3_darknet53_270e_voc.yml index bb7a315ef29a09eb5d223447789af83ca40a1619..e24c01e311f2b084d950e6dacc95ed25ddfef774 100644 --- a/configs/yolov3/yolov3_darknet53_270e_voc.yml +++ b/configs/yolov3/yolov3_darknet53_270e_voc.yml @@ -8,3 +8,7 @@ _BASE_: [ snapshot_epoch: 5 weights: output/yolov3_darknet53_270e_voc/model_final + +EvalReader: + batch_transforms: + - PadBatch: {pad_gt: True} diff --git a/configs/yolov3/yolov3_mobilenet_v1_270e_voc.yml b/configs/yolov3/yolov3_mobilenet_v1_270e_voc.yml index a6b2303f9f9bdf6a85798cd36650888e069d1c5a..9952e7ea44dbccffe361aff53b198bd9ce1689f9 100644 --- a/configs/yolov3/yolov3_mobilenet_v1_270e_voc.yml +++ b/configs/yolov3/yolov3_mobilenet_v1_270e_voc.yml @@ -40,6 +40,10 @@ TrainReader: drop_last: true mixup_epoch: 250 +EvalReader: + batch_transforms: + - PadBatch: {pad_gt: True} + LearningRate: base_lr: 0.001 schedulers: diff --git a/configs/yolov3/yolov3_mobilenet_v1_ssld_270e_voc.yml b/configs/yolov3/yolov3_mobilenet_v1_ssld_270e_voc.yml index 37cce342ad96bcec7077a9c4048af123e34cc700..c5355941feaf734680c5f623153d4c0497fce0a8 100644 --- a/configs/yolov3/yolov3_mobilenet_v1_ssld_270e_voc.yml +++ b/configs/yolov3/yolov3_mobilenet_v1_ssld_270e_voc.yml @@ -41,6 +41,10 @@ TrainReader: drop_last: true mixup_epoch: 250 +EvalReader: + batch_transforms: + - PadBatch: {pad_gt: True} + LearningRate: base_lr: 0.001 schedulers: diff --git a/configs/yolov3/yolov3_mobilenet_v3_large_270e_voc.yml b/configs/yolov3/yolov3_mobilenet_v3_large_270e_voc.yml index 5725accb7b12e4115f6f21d8b9e4bb2f632dd68b..8c2facec78c92867781a430aa44ce8b83a8a03bc 100644 --- a/configs/yolov3/yolov3_mobilenet_v3_large_270e_voc.yml +++ b/configs/yolov3/yolov3_mobilenet_v3_large_270e_voc.yml @@ -40,6 +40,10 @@ TrainReader: drop_last: true mixup_epoch: 250 +EvalReader: + batch_transforms: + - PadBatch: {pad_gt: True} + LearningRate: base_lr: 0.001 schedulers: diff --git a/configs/yolov3/yolov3_mobilenet_v3_large_ssld_270e_voc.yml b/configs/yolov3/yolov3_mobilenet_v3_large_ssld_270e_voc.yml index 3099703b8e218779aa8cdc457080f3e0ddcbed21..13d81f45e4aaf411b499ef94bfdb10a01bf00f39 100644 --- a/configs/yolov3/yolov3_mobilenet_v3_large_ssld_270e_voc.yml +++ b/configs/yolov3/yolov3_mobilenet_v3_large_ssld_270e_voc.yml @@ -41,6 +41,10 @@ TrainReader: drop_last: true mixup_epoch: 250 +EvalReader: + batch_transforms: + - PadBatch: {pad_gt: True} + LearningRate: base_lr: 0.001 schedulers: diff --git a/ppdet/data/transform/batch_operators.py b/ppdet/data/transform/batch_operators.py index 85639c31d2517a698559bb06b42b23cf323daa25..3ae84774c714125f09875737b23b6d96ad0e46d7 100644 --- a/ppdet/data/transform/batch_operators.py +++ b/ppdet/data/transform/batch_operators.py @@ -115,6 +115,7 @@ class PadBatch(BaseOperator): gt_box_data = -np.ones([gt_num_max, 4], dtype=np.float32) gt_class_data = -np.ones([gt_num_max], dtype=np.int32) is_crowd_data = np.ones([gt_num_max], dtype=np.int32) + difficult_data = np.ones([gt_num_max], dtype=np.int32) if pad_mask: poly_num_max = max(poly_num) @@ -127,7 +128,12 @@ class PadBatch(BaseOperator): gt_num = data['gt_bbox'].shape[0] gt_box_data[0:gt_num, :] = data['gt_bbox'] gt_class_data[0:gt_num] = np.squeeze(data['gt_class']) - is_crowd_data[0:gt_num] = np.squeeze(data['is_crowd']) + if 'is_crowd' in data: + is_crowd_data[0:gt_num] = np.squeeze(data['is_crowd']) + data['is_crowd'] = is_crowd_data + if 'difficult' in data: + difficult_data[0:gt_num] = np.squeeze(data['difficult']) + data['difficult'] = difficult_data if pad_mask: for j, poly in enumerate(data['gt_poly']): for k, p_p in enumerate(poly): @@ -136,7 +142,6 @@ class PadBatch(BaseOperator): data['gt_poly'] = gt_masks_data data['gt_bbox'] = gt_box_data data['gt_class'] = gt_class_data - data['is_crowd'] = is_crowd_data return samples