diff --git a/README.md b/README.md
index ede5f15a4deffb05bf50ec590bbce7535b0e4dd5..f23075d846b078d976fb51a9ca5f4f6843f26a1f 100644
--- a/README.md
+++ b/README.md
@@ -44,7 +44,14 @@
| BlazeFace | ✗ | ✗ | ✗ | ✗ | ✗ | ✗ | ✗ |
| Faceboxes | ✗ | ✗ | ✗ | ✗ | ✗ | ✗ | ✗ |
-[1] [ResNet-vd](https://arxiv.org/pdf/1812.01187) 模型提供了较大的精度提高和较少的性能损失。
+[1] [ResNet-vd](https://arxiv.org/pdf/1812.01187) 模型预测速度基本不变的情况下提高了精度。
+
+更多的模型:
+
+- EfficientDet
+- FCOS
+- CornerNet-Squeeze
+- YOLOv4
更多的Backone:
@@ -52,10 +59,11 @@
- VGG
- GCNet
- CBNet
+- Hourglass
扩展特性:
-- [x] **Synchronized Batch Norm**: 目前在YOLOv3中使用。
+- [x] **Synchronized Batch Norm**
- [x] **Group Norm**
- [x] **Modulated Deformable Convolution**
- [x] **Deformable PSRoI Pooling**
@@ -107,12 +115,14 @@
## 模型库
- [模型库](docs/MODEL_ZOO_cn.md)
-- [人脸检测模型](docs/featured_model/FACE_DETECTION.md) 开源BlazeFace系列模型,Wider-Face数据集上最高精度达到91.5%,同时具备了较高的预测性能
-- [行人检测和车辆检测预训练模型](docs/featured_model/CONTRIB_cn.md) 针对不同场景的检测模型
-- [YOLOv3增强模型](docs/featured_model/YOLOv3_ENHANCEMENT.md) 改进原始YOLOv3,精度达到43.6%,原论文精度为33.0%,同时预测速度也得到提升
-- [Objects365 2019 Challenge夺冠模型](docs/featured_model/CACascadeRCNN.md) Objects365 Full Track任务中最好的单模型之一,精度达到31.7%
-- [Open Images V5和Objects365数据集模型](docs/featured_model/OIDV5_BASELINE_MODEL.md)
- [移动端模型](configs/mobile/README.md)
+- [Anchor free模型](configs/anchor_free/README.md)
+- [人脸检测模型](docs/featured_model/FACE_DETECTION.md)
+- [YOLOv3增强模型](docs/featured_model/YOLOv3_ENHANCEMENT.md): COCO mAP高达43.6%,原论文精度为33.0%
+- [行人检测预训练模型](docs/featured_model/CONTRIB_cn.md)
+- [车辆检测预训练模型](docs/featured_model/CONTRIB_cn.md)
+- [Objects365 2019 Challenge夺冠模型](docs/featured_model/CACascadeRCNN.md)
+- [Open Images 2019-Object Detction比赛最佳单模型](docs/featured_model/OIDV5_BASELINE_MODEL.md)
## 许可证书
diff --git a/README_en.md b/README_en.md
index 9a3d4697c43135f11dc4e1a873b28690f5c8385b..9b7f12c686bd5a976b2ecca510d04966aaf88b61 100644
--- a/README_en.md
+++ b/README_en.md
@@ -59,6 +59,13 @@ Supported Architectures:
[1] [ResNet-vd](https://arxiv.org/pdf/1812.01187) models offer much improved accuracy with negligible performance cost.
+More models:
+
+- EfficientDet
+- FCOS
+- CornerNet-Squeeze
+- YOLOv4
+
More Backbones:
- DarkNet
@@ -68,7 +75,7 @@ More Backbones:
Advanced Features:
-- [x] **Synchronized Batch Norm**: currently used by YOLOv3.
+- [x] **Synchronized Batch Norm**
- [x] **Group Norm**
- [x] **Modulated Deformable Convolution**
- [x] **Deformable PSRoI Pooling**
@@ -121,12 +128,14 @@ The following is the relationship between COCO mAP and FPS on Tesla V100 of repr
## Model Zoo
- Pretrained models are available in the [PaddleDetection model zoo](docs/MODEL_ZOO.md).
-- [Face detection models](docs/featured_model/FACE_DETECTION_en.md) BlazeFace series model with the highest precision of 91.5% on Wider-Face dataset and outstanding inference performance.
-- [Pretrained models for pedestrian and vehicle detection](docs/featured_model/CONTRIB.md) Models for object detection in specific scenarios.
-- [YOLOv3 enhanced model](docs/featured_model/YOLOv3_ENHANCEMENT.md) Compared to MAP of 33.0% in paper, enhanced YOLOv3 reaches the MAP of 43.6% and inference speed is improved as well
-- [Objects365 2019 Challenge champion model](docs/featured_model/CACascadeRCNN.md) One of the best single models in Objects365 Full Track of which MAP reaches 31.7%.
-- [Open Images Dataset V5 and Objects365 Dataset models](docs/featured_model/OIDV5_BASELINE_MODEL.md)
- [Mobile models](configs/mobile/README.md)
+- [Anchor free models](configs/anchor_free/README.md)
+- [Face detection models](docs/featured_model/FACE_DETECTION_en.md)
+- [Pretrained models for pedestrian detection](docs/featured_model/CONTRIB.md)
+- [Pretrained models for vehicle detection](docs/featured_model/CONTRIB.md)
+- [YOLOv3 enhanced model](docs/featured_model/YOLOv3_ENHANCEMENT.md): Compared to MAP of 33.0% in paper, enhanced YOLOv3 reaches the MAP of 43.6%, and inference speed is improved as well
+- [Objects365 2019 Challenge champion model](docs/featured_model/CACascadeRCNN.md)
+- [Best single model of Open Images 2019-Object Detction](docs/featured_model/OIDV5_BASELINE_MODEL.md)
## License
diff --git a/docs/advanced_tutorials/TRANSFER_LEARNING_cn.md b/docs/advanced_tutorials/TRANSFER_LEARNING_cn.md
index 7db411ac4c2f04b3ce0d4472b48e1b7c359eb763..dd5e525f1095211d00e83f03c418e3f27ca66037 100644
--- a/docs/advanced_tutorials/TRANSFER_LEARNING_cn.md
+++ b/docs/advanced_tutorials/TRANSFER_LEARNING_cn.md
@@ -2,11 +2,10 @@
迁移学习为利用已有知识,对新知识进行学习。例如利用ImageNet分类预训练模型做初始化来训练检测模型,利用在COCO数据集上的检测模型做初始化来训练基于PascalVOC数据集的检测模型。
-在进行迁移学习时,由于会使用不同的数据集,数据类别数与COCO/VOC数据类别不同,导致在加载PaddlePaddle开源模型时,与类别数相关的权重(例如分类模块的fc层)会出现维度不匹配的问题;另外,如果需要结构更加复杂的模型,需要对已有开源模型结构进行调整,对应权重也需要选择性加载。因此,需要检测库能够指定参数字段,在加载模型时不加载匹配的权重。
+在进行迁移学习时,由于会使用不同的数据集,数据类别数与COCO/VOC数据类别不同,导致在加载开源模型(如COCO预训练模型)时,与类别数相关的权重(例如分类模块的fc层)会出现维度不匹配的问题;另外,如果需要结构更加复杂的模型,需要对已有开源模型结构进行调整,对应权重也需要选择性加载。因此,需要检测库能够指定参数字段,在加载模型时不加载匹配的权重。
-## PaddleDetection进行迁移学习
-在迁移学习中,对预训练模型进行选择性加载,PaddleDetection支持如下两种迁移学习方式:
+在迁移学习中,对预训练模型进行选择性加载,支持如下两种迁移学习方式:
#### 直接加载预训练权重(**推荐方式**)
@@ -38,7 +37,7 @@ python -u tools/train.py -c configs/faster_rcnn_r50_1x.yml \
1. pretrain\_weights的路径为COCO数据集上开源的faster RCNN模型链接,完整模型链接可参考[MODEL_ZOO](../MODEL_ZOO_cn.md)
2. finetune\_exclude\_pretrained\_params中设置参数字段,如果参数名能够匹配以上参数字段(通配符匹配方式),则在模型加载时忽略该参数。
-如果用户需要利用自己的数据进行finetune,模型结构不变,只需要忽略与类别数相关的参数。PaddleDetection给出了不同模型类型所对应的忽略参数字段。如下表所示:
+如果用户需要利用自己的数据进行finetune,模型结构不变,只需要忽略与类别数相关的参数,不同模型类型所对应的忽略参数字段如下表所示:
| 模型类型 | 忽略参数字段 |
| :----------------: | :---------------------------------------: |
diff --git a/docs/tutorials/GETTING_STARTED.md b/docs/tutorials/GETTING_STARTED.md
index fb3105079813f94e537dd50291cd42b25b319efc..405f1eb0e09c0be1b577184df235b8a06ffdf0cd 100644
--- a/docs/tutorials/GETTING_STARTED.md
+++ b/docs/tutorials/GETTING_STARTED.md
@@ -11,6 +11,8 @@ instructions](INSTALL.md).
PaddleDetection provides scripots for training, evalution and inference with various features according to different configure.
```bash
+# set PYTHONPATH
+export PYTHONPATH=$PYTHONPATH:.
# training in single-GPU and multi-GPU. specify different GPU numbers by CUDA_VISIBLE_DEVICES
export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
python tools/train.py -c configs/faster_rcnn_r50_1x.yml
diff --git a/docs/tutorials/GETTING_STARTED_cn.md b/docs/tutorials/GETTING_STARTED_cn.md
index 6b44b0fcd95d818442ae5a55a3b9b08cd9064faf..47751bb49571084febe74cc31153a93155ee94b9 100644
--- a/docs/tutorials/GETTING_STARTED_cn.md
+++ b/docs/tutorials/GETTING_STARTED_cn.md
@@ -8,6 +8,8 @@
PaddleDetection提供了训练/评估/推断三个功能的使用脚本,支持通过不同可选参数实现特定功能
```bash
+# 设置PYTHONPATH路径
+export PYTHONPATH=$PYTHONPATH:.
# GPU训练 支持单卡,多卡训练,通过CUDA_VISIBLE_DEVICES指定卡号
export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
python tools/train.py -c configs/faster_rcnn_r50_1x.yml
diff --git a/slim/distillation/distill.py b/slim/distillation/distill.py
index 68003757d5a1c6cd4224553b9552f05c514a63fb..59e5593ec43f8bd1dd89225f608e4ca49f16918a 100644
--- a/slim/distillation/distill.py
+++ b/slim/distillation/distill.py
@@ -16,11 +16,16 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
-import os
+import os, sys
+# add python path of PadleDetection to sys.path
+parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 3)))
+if parent_path not in sys.path:
+ sys.path.append(parent_path)
+
import numpy as np
from collections import OrderedDict
-from paddleslim.dist.single_distiller import merge, l2_loss
+from paddleslim.dist.single_distiller import merge, l2_loss
from paddle import fluid
from ppdet.core.workspace import load_config, merge_config, create
from ppdet.data.reader import create_reader
diff --git a/slim/extensions/distill_pruned_model/distill_pruned_model.py b/slim/extensions/distill_pruned_model/distill_pruned_model.py
index c154bafb45d9a8987bd35c8918a021b2a37c5bb9..3302f278cec21d92260c68f039a820d83456a172 100644
--- a/slim/extensions/distill_pruned_model/distill_pruned_model.py
+++ b/slim/extensions/distill_pruned_model/distill_pruned_model.py
@@ -16,7 +16,13 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
-import os
+import os, sys
+
+# add python path of PadleDetection to sys.path
+parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 4)))
+if parent_path not in sys.path:
+ sys.path.append(parent_path)
+
import numpy as np
from collections import OrderedDict
from paddleslim.dist.single_distiller import merge, l2_loss
diff --git a/slim/nas/train_nas.py b/slim/nas/train_nas.py
index d025cd9504ba5edea6b8e97614bc01e0c481a3b5..f4eca0e31baee8b4cfeb717814ec5c24baf955e9 100644
--- a/slim/nas/train_nas.py
+++ b/slim/nas/train_nas.py
@@ -16,29 +16,19 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
-import os
+import os, sys
+# add python path of PadleDetection to sys.path
+parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 3)))
+if parent_path not in sys.path:
+ sys.path.append(parent_path)
+
import time
import numpy as np
import datetime
from collections import deque
-
-def set_paddle_flags(**kwargs):
- for key, value in kwargs.items():
- if os.environ.get(key, None) is None:
- os.environ[key] = str(value)
-
-
-# NOTE(paddle-dev): All of these flags should be set before
-# `import paddle`. Otherwise, it would not take any effect.
-set_paddle_flags(
- FLAGS_eager_delete_tensor_gb=0, # enable GC to save memory
-)
-
from paddle import fluid
-import sys
-sys.path.append("../../")
from ppdet.experimental import mixed_precision_context
from ppdet.core.workspace import load_config, merge_config, create, register
from ppdet.data.reader import create_reader
diff --git a/slim/prune/eval.py b/slim/prune/eval.py
index b5d685c1d92baf97a878d3ada80db9ac12d68da1..4607f208d455253e69c747abe59be9eff568439b 100644
--- a/slim/prune/eval.py
+++ b/slim/prune/eval.py
@@ -16,20 +16,12 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
-import os
+import os, sys
-
-def set_paddle_flags(**kwargs):
- for key, value in kwargs.items():
- if os.environ.get(key, None) is None:
- os.environ[key] = str(value)
-
-
-# NOTE(paddle-dev): All of these flags should be set before
-# `import paddle`. Otherwise, it would not take any effect.
-set_paddle_flags(
- FLAGS_eager_delete_tensor_gb=0, # enable GC to save memory
-)
+# add python path of PadleDetection to sys.path
+parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 3)))
+if parent_path not in sys.path:
+ sys.path.append(parent_path)
import paddle.fluid as fluid
from paddleslim.prune import Pruner
diff --git a/slim/prune/export_model.py b/slim/prune/export_model.py
index 1d986b48da3c285b4c003d3bbbe95702bb8e8082..808af9f3b0a7be1b0ed7c76481d0c67c3ddddc46 100644
--- a/slim/prune/export_model.py
+++ b/slim/prune/export_model.py
@@ -16,7 +16,11 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
-import os
+import os, sys
+# add python path of PadleDetection to sys.path
+parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 3)))
+if parent_path not in sys.path:
+ sys.path.append(parent_path)
from paddle import fluid
diff --git a/slim/prune/prune.py b/slim/prune/prune.py
index cdfa255ee64e2ee5a414908acb584b918a473e96..c907df9cda83ec72922049d2a20f564b114e2674 100644
--- a/slim/prune/prune.py
+++ b/slim/prune/prune.py
@@ -16,7 +16,13 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
-import os
+import os, sys
+
+# add python path of PadleDetection to sys.path
+parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 3)))
+if parent_path not in sys.path:
+ sys.path.append(parent_path)
+
import time
import numpy as np
import datetime
@@ -24,6 +30,7 @@ from collections import deque
from paddleslim.prune import Pruner
from paddleslim.analysis import flops
from paddle import fluid
+
from ppdet.experimental import mixed_precision_context
from ppdet.core.workspace import load_config, merge_config, create
from ppdet.data.reader import create_reader
diff --git a/slim/quantization/eval.py b/slim/quantization/eval.py
index d95c17f9d8dbb2dc369c7066987e974240d4087d..037bbcfd3f6feb5a2245231aef3f870f95a0d6fd 100644
--- a/slim/quantization/eval.py
+++ b/slim/quantization/eval.py
@@ -16,8 +16,12 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
-import os
-import sys
+import os, sys
+
+# add python path of PadleDetection to sys.path
+parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 3)))
+if parent_path not in sys.path:
+ sys.path.append(parent_path)
import paddle.fluid as fluid
diff --git a/slim/quantization/export_model.py b/slim/quantization/export_model.py
index 07f618ba36be1b0211aa7c7cf44b941d6bb3c4f2..ab219fa3c853ec3fa7de09f16d8549a31633db6d 100644
--- a/slim/quantization/export_model.py
+++ b/slim/quantization/export_model.py
@@ -16,8 +16,12 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
-import os
-import sys
+import os, sys
+# add python path of PadleDetection to sys.path
+parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 3)))
+if parent_path not in sys.path:
+ sys.path.append(parent_path)
+
from paddle import fluid
from ppdet.core.workspace import load_config, merge_config, create
diff --git a/slim/quantization/infer.py b/slim/quantization/infer.py
index e126029e8760ad8ab3c9d9eef327d47ae13a931d..cb16d3b95f8e6c4d51763593db97d48692476042 100644
--- a/slim/quantization/infer.py
+++ b/slim/quantization/infer.py
@@ -16,17 +16,19 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
-import os
-import glob
-import sys
+import os, sys
+# add python path of PadleDetection to sys.path
+parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 3)))
+if parent_path not in sys.path:
+ sys.path.append(parent_path)
+import glob
import numpy as np
from PIL import Image
from paddle import fluid
from ppdet.core.workspace import load_config, merge_config, create
-
from ppdet.utils.eval_utils import parse_fetches
from ppdet.utils.cli import ArgsParser
from ppdet.utils.check import check_gpu, check_version, check_config
diff --git a/slim/quantization/train.py b/slim/quantization/train.py
index f0a84e7c218c3ed0c3ccf78cb7b21b361da109d6..2e89dc09abd78bf87df0fd1b6829ca1060984f63 100644
--- a/slim/quantization/train.py
+++ b/slim/quantization/train.py
@@ -16,8 +16,12 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
-import os
-import sys
+import os, sys
+# add python path of PadleDetection to sys.path
+parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 3)))
+if parent_path not in sys.path:
+ sys.path.append(parent_path)
+
import time
import numpy as np
import datetime
@@ -28,7 +32,6 @@ from paddle import fluid
from ppdet.core.workspace import load_config, merge_config, create
from ppdet.data.reader import create_reader
-
from ppdet.utils import dist_utils
from ppdet.utils.eval_utils import parse_fetches, eval_run, eval_results
from ppdet.utils.stats import TrainingStats
diff --git a/slim/sensitive/sensitive.py b/slim/sensitive/sensitive.py
index c04c38e1cce34b777c9e2c08978f896067ffd381..d57699ad3b3026eff7ce8c7cfbf3222fe11bdf50 100644
--- a/slim/sensitive/sensitive.py
+++ b/slim/sensitive/sensitive.py
@@ -16,25 +16,17 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
-import os
+import os, sys
+# add python path of PadleDetection to sys.path
+parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 3)))
+if parent_path not in sys.path:
+ sys.path.append(parent_path)
+
import time
import numpy as np
import datetime
from collections import deque
-
-def set_paddle_flags(**kwargs):
- for key, value in kwargs.items():
- if os.environ.get(key, None) is None:
- os.environ[key] = str(value)
-
-
-# NOTE(paddle-dev): All of these flags should be set before
-# `import paddle`. Otherwise, it would not take any effect.
-set_paddle_flags(
- FLAGS_eager_delete_tensor_gb=0, # enable GC to save memory
-)
-
from paddle import fluid
from ppdet.experimental import mixed_precision_context
from ppdet.core.workspace import load_config, merge_config, create
diff --git a/tools/eval.py b/tools/eval.py
index bdf93180e26f1ca9725d56b3cec5c23aa86e31d8..40840503fda541dadb37e43c7b63d304edcf7938 100644
--- a/tools/eval.py
+++ b/tools/eval.py
@@ -16,26 +16,12 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
-import os
-import sys
+import os, sys
# add python path of PadleDetection to sys.path
parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 2)))
if parent_path not in sys.path:
sys.path.append(parent_path)
-
-def set_paddle_flags(**kwargs):
- for key, value in kwargs.items():
- if os.environ.get(key, None) is None:
- os.environ[key] = str(value)
-
-
-# NOTE(paddle-dev): All of these flags should be set before
-# `import paddle`. Otherwise, it would not take any effect.
-set_paddle_flags(
- FLAGS_eager_delete_tensor_gb=0, # enable GC to save memory
-)
-
import paddle.fluid as fluid
from ppdet.utils.eval_utils import parse_fetches, eval_run, eval_results, json_eval_results
diff --git a/tools/infer.py b/tools/infer.py
index 699c48bcd10e567b96f97e66ddbae574482fc968..f889eff816fe0e151fe7bf771ad90190a103655a 100644
--- a/tools/infer.py
+++ b/tools/infer.py
@@ -16,30 +16,16 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
-import os
-import glob
-import sys
+import os, sys
# add python path of PadleDetection to sys.path
parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 2)))
if parent_path not in sys.path:
sys.path.append(parent_path)
+import glob
import numpy as np
from PIL import Image
-
-def set_paddle_flags(**kwargs):
- for key, value in kwargs.items():
- if os.environ.get(key, None) is None:
- os.environ[key] = str(value)
-
-
-# NOTE(paddle-dev): All of these flags should be set before
-# `import paddle`. Otherwise, it would not take any effect.
-set_paddle_flags(
- FLAGS_eager_delete_tensor_gb=0, # enable GC to save memory
-)
-
from paddle import fluid
from ppdet.core.workspace import load_config, merge_config, create
diff --git a/tools/train.py b/tools/train.py
index 7fc8b4b87eda3b892ab37a09c4439c62ef2cd793..c6464abb90228f13c53f2d37d5c29ff1689a6be5 100644
--- a/tools/train.py
+++ b/tools/train.py
@@ -16,31 +16,18 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
-import os
+import os, sys
+# add python path of PadleDetection to sys.path
+parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 2)))
+if parent_path not in sys.path:
+ sys.path.append(parent_path)
+
import time
import numpy as np
import random
import datetime
from collections import deque
from paddle.fluid import profiler
-import sys
-# add python path of PadleDetection to sys.path
-parent_path = os.path.abspath(os.path.join(__file__, *(['..'] * 2)))
-if parent_path not in sys.path:
- sys.path.append(parent_path)
-
-
-def set_paddle_flags(**kwargs):
- for key, value in kwargs.items():
- if os.environ.get(key, None) is None:
- os.environ[key] = str(value)
-
-
-# NOTE(paddle-dev): All of these flags should be set before
-# `import paddle`. Otherwise, it would not take any effect.
-set_paddle_flags(
- FLAGS_eager_delete_tensor_gb=0, # enable GC to save memory
-)
from paddle import fluid
from paddle.fluid.layers.learning_rate_scheduler import _decay_step_counter