From 94f026831f9871668f30918abfcd11e854bbac05 Mon Sep 17 00:00:00 2001 From: wangxinxin08 <69842442+wangxinxin08@users.noreply.github.com> Date: Thu, 3 Dec 2020 00:47:17 +0800 Subject: [PATCH] correct RandomFlipOp (#1796) Co-authored-by: root --- configs/_base_/models/yolov3_darknet53.yml | 4 ++-- configs/_base_/runtime.yml | 2 +- ppdet/data/transform/operator.py | 5 ++++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/configs/_base_/models/yolov3_darknet53.yml b/configs/_base_/models/yolov3_darknet53.yml index 6e4bc216a..42efdfdb9 100644 --- a/configs/_base_/models/yolov3_darknet53.yml +++ b/configs/_base_/models/yolov3_darknet53.yml @@ -3,6 +3,7 @@ pretrain_weights: https://paddle-imagenet-models-name.bj.bcebos.com/DarkNet53_pr weights: output/yolov3_darknet/model_final use_fine_grained_loss: false load_static_weights: True +norm_type: sync_bn YOLOv3: backbone: DarkNet @@ -13,7 +14,6 @@ YOLOv3: DarkNet: depth: 53 return_idx: [2, 3, 4] - norm_type: sync_bn YOLOv3FPN: feat_channels: [1024, 768, 384] @@ -28,7 +28,7 @@ YOLOv3Head: YOLOv3Loss: ignore_thresh: 0.7 downsample: [32, 16, 8] - label_smooth: true + label_smooth: false BBoxPostProcess: decode: diff --git a/configs/_base_/runtime.yml b/configs/_base_/runtime.yml index b3564ad60..cfc9e5b17 100644 --- a/configs/_base_/runtime.yml +++ b/configs/_base_/runtime.yml @@ -1,4 +1,4 @@ use_gpu: true -log_iter: 50 +log_iter: 20 save_dir: output snapshot_epoch: 2 diff --git a/ppdet/data/transform/operator.py b/ppdet/data/transform/operator.py index 9aa691b77..3609ca010 100644 --- a/ppdet/data/transform/operator.py +++ b/ppdet/data/transform/operator.py @@ -523,7 +523,10 @@ class RandomFlipOp(BaseOperator): return image[:, ::-1, :] def apply_bbox(self, bbox, width): - bbox[:, 0::2] = width - bbox[:, 0::2] - 1 + oldx1 = bbox[:, 0].copy() + oldx2 = bbox[:, 2].copy() + bbox[:, 0] = width - oldx2 - 1 + bbox[:, 2] = width - oldx1 - 1 return bbox def apply(self, sample, context=None): -- GitLab