diff --git a/PaddleCV/yolov3/README.md b/PaddleCV/yolov3/README.md index b4547b3559c0c1e5218b2e284141fb2817db626a..679eeb0ccc37e2e997b9afd68e40528ab781aed9 100644 --- a/PaddleCV/yolov3/README.md +++ b/PaddleCV/yolov3/README.md @@ -134,11 +134,19 @@ Evaluation is to evaluate the performance of a trained model. This sample provid - Set ```export CUDA_VISIBLE_DEVICES=0``` to specifiy one GPU to eval. -Evalutaion result is shown as below: +If train with '--syncbn=False', Evalutaion result is shown as below: | input size | mAP(IoU=0.50:0.95) | mAP(IoU=0.50) | mAP(IoU=0.75) | | :------: | :------: | :------: | :------: | -| 608x608| 38.9 | 61.1 | 42.0 | +| 608x608 | 37.7 | 59.8 | 40.8 | +| 416x416 | 36.5 | 58.2 | 39.1 | +| 320x320 | 34.1 | 55.4 | 36.3 | + +If train with '--syncbn=True', Evalutaion result is shown as below: + +| input size | mAP(IoU=0.50:0.95) | mAP(IoU=0.50) | mAP(IoU=0.75) | +| :------: | :------: | :------: | :------: | +| 608x608 | 38.9 | 61.1 | 42.0 | | 416x416 | 37.5 | 59.6 | 40.2 | | 320x320 | 34.8 | 56.4 | 36.9 | diff --git a/PaddleCV/yolov3/README_cn.md b/PaddleCV/yolov3/README_cn.md index 6bc8dd4c23f414c7d03666891ed338867a501849..583594a997175b4a331748754f1e9f7d5c6363c5 100644 --- a/PaddleCV/yolov3/README_cn.md +++ b/PaddleCV/yolov3/README_cn.md @@ -134,15 +134,23 @@ Train Loss - 通过设置export CUDA\_VISIBLE\_DEVICES=0指定单卡GPU评估。 -模型评估结果: +若训练时指定'--syncbn=False', 模型评估精度如下: | input size | mAP(IoU=0.50:0.95) | mAP(IoU=0.50) | mAP(IoU=0.75) | | :------: | :------: | :------: | :------: | -| 608x608| 38.9 | 61.1 | 42.0 | +| 608x608 | 37.7 | 59.8 | 40.8 | +| 416x416 | 36.5 | 58.2 | 39.1 | +| 320x320 | 34.1 | 55.4 | 36.3 | + +若训练时指定'--syncbn=True', 模型评估精度如下: + +| input size | mAP(IoU=0.50:0.95) | mAP(IoU=0.50) | mAP(IoU=0.75) | +| :------: | :------: | :------: | :------: | +| 608x608 | 38.9 | 61.1 | 42.0 | | 416x416 | 37.5 | 59.6 | 40.2 | | 320x320 | 34.8 | 56.4 | 36.9 | -- **注意: **评估结果基于`pycocotools`评估器,没有滤除`score < 0.05`的预测框,其他框架有此滤除操作会导致精度下降。 +- **注意:** 评估结果基于`pycocotools`评估器,没有滤除`score < 0.05`的预测框,其他框架有此滤除操作会导致精度下降。 diff --git a/PaddleCV/yolov3/train.py b/PaddleCV/yolov3/train.py index 2ea618252c4eb1ea707a6f68443e0a40ecb25e1a..97d23d381dfcb732808d44a1c917db0013ee721e 100644 --- a/PaddleCV/yolov3/train.py +++ b/PaddleCV/yolov3/train.py @@ -82,7 +82,7 @@ def train(): build_strategy= fluid.BuildStrategy() build_strategy.memory_optimize = True - build_strategy.sync_batch_norm = True + build_strategy.sync_batch_norm = cfg.syncbn compile_program = fluid.compiler.CompiledProgram( fluid.default_main_program()).with_data_parallel( loss_name=loss.name, build_strategy=build_strategy) diff --git a/PaddleCV/yolov3/utility.py b/PaddleCV/yolov3/utility.py index e43ac033facc8ca12f7cf46c01423be80f17a91e..3f5c3c6e21ade4188068ad25f2c6d41795dcb0a2 100644 --- a/PaddleCV/yolov3/utility.py +++ b/PaddleCV/yolov3/utility.py @@ -112,6 +112,7 @@ def parse_args(): add_arg('no_mixup_iter', int, 40000, "Disable mixup in last N iter.") # TRAIN TEST INFER add_arg('input_size', int, 608, "Image input size of YOLOv3.") + add_arg('syncbn', bool, True, "Whether to use synchronized batch normalization.") add_arg('random_shape', bool, True, "Resize to random shape for train reader.") add_arg('valid_thresh', float, 0.005, "Valid confidence score for NMS.") add_arg('nms_thresh', float, 0.45, "NMS threshold.")