diff --git a/fluid/README.md b/fluid/README.md index e8417d2b542cf262ce13d5dbc095bde3ba851f29..2da327bec4a70f0d4f2176f9257797960da64adb 100644 --- a/fluid/README.md +++ b/fluid/README.md @@ -28,8 +28,11 @@ Fluid模型配置和参数文件的工具。 开放环境中的检测人脸,尤其是小的、模糊的和部分遮挡的人脸也是一个具有挑战的任务。我们也介绍了如何基于 [WIDER FACE](http://mmlab.ie.cuhk.edu.hk/projects/WIDERFace) 数据训练百度自研的人脸检测PyramidBox模型,该算法于2018年3月份在WIDER FACE的多项评测中均获得 [第一名](http://mmlab.ie.cuhk.edu.hk/projects/WIDERFace/WiderFace_Results.html)。 +Faster RCNN 是典型的两阶段目标检测器,相较于传统提取区域的方法,Faster RCNN中RPN网络通过共享卷积层参数大幅提高提取区域的效率,并提出高质量的候选区域。 + - [Single Shot MultiBox Detector](https://github.com/PaddlePaddle/models/blob/develop/fluid/object_detection/README_cn.md) - [Face Detector: PyramidBox](https://github.com/PaddlePaddle/models/tree/develop/fluid/face_detection/README_cn.md) +- [Faster RCNN](https://github.com/PaddlePaddle/models/tree/develop/fluid/faster_rcnn/README_cn.md) 图像语义分割 ------------ diff --git a/fluid/faster_rcnn/README.md b/fluid/faster_rcnn/README.md index 99438c6768197238d7889d8c63e1e8bdbfde0202..617a103278e29c22e5aef73830605522159b4a86 100644 --- a/fluid/faster_rcnn/README.md +++ b/fluid/faster_rcnn/README.md @@ -43,7 +43,7 @@ After data preparation, one can start the training step by: python train.py \ --max_size=1333 \ - --scales=800 \ + --scales=[800] \ --batch_size=8 \ --model_save_dir=output/ @@ -58,6 +58,21 @@ After data preparation, one can start the training step by: Set `pretrained_model` to load pre-trained model. In addition, this parameter is used to load trained model when finetuning as well. +**Install the [cocoapi](https://github.com/cocodataset/cocoapi):** + +To train the model, [cocoapi](https://github.com/cocodataset/cocoapi) is needed. Install the cocoapi: + + # COCOAPI=/path/to/clone/cocoapi + git clone https://github.com/cocodataset/cocoapi.git $COCOAPI + cd $COCOAPI/PythonAPI + # if cython is not installed + pip install Cython + # Install into global site-packages + make install + # Alternatively, if you do not have permissions or prefer + # not to install the COCO API into global site-packages + python2 setup.py install --user + **data reader introduction:** * Data reader is defined in `reader.py`. @@ -103,18 +118,7 @@ Finetuning is to finetune model weights in a specific task by loading pretrained ## Evaluation -Evaluation is to evaluate the performance of a trained model. This sample provides `eval_coco_map.py` which uses a COCO-specific mAP metric defined by [COCO committee](http://cocodataset.org/#detections-eval). To use `eval_coco_map.py` , [cocoapi](https://github.com/cocodataset/cocoapi) is needed. Install the cocoapi: - - # COCOAPI=/path/to/clone/cocoapi - git clone https://github.com/cocodataset/cocoapi.git $COCOAPI - cd $COCOAPI/PythonAPI - # if cython is not installed - pip install Cython - # Install into global site-packages - make install - # Alternatively, if you do not have permissions or prefer - # not to install the COCO API into global site-packages - python2 setup.py install --user +Evaluation is to evaluate the performance of a trained model. This sample provides `eval_coco_map.py` which uses a COCO-specific mAP metric defined by [COCO committee](http://cocodataset.org/#detections-eval). `eval_coco_map.py` is the main executor for evalution, one can start evalution step by: @@ -136,7 +140,7 @@ Faster RCNN mAP | Detectron | 8 | 180000 | 0.315 | | Fluid minibatch padding | 8 | 180000 | 0.314 | | Fluid all padding | 8 | 180000 | 0.308 | -| Fluid no padding |6 | 240000 | 0.317 | +| Fluid no padding |8 | 180000 | 0.316 | * Fluid all padding: Each image padding to 1333\*1333. * Fluid minibatch padding: Images in one batch padding to the same size. This method is same as detectron. diff --git a/fluid/faster_rcnn/README_cn.md b/fluid/faster_rcnn/README_cn.md index cd238a86c8ec82f1519280c5552699c1b75438ec..6f9e892e6b64008fdf23bc53466d504d04266fb7 100644 --- a/fluid/faster_rcnn/README_cn.md +++ b/fluid/faster_rcnn/README_cn.md @@ -42,7 +42,7 @@ Faster RCNN 目标检测模型 python train.py \ --max_size=1333 \ - --scales=800 \ + --scales=[800] \ --batch_size=8 \ --model_save_dir=output/ \ --pretrained_model=${path_to_pretrain_model} @@ -58,6 +58,21 @@ Faster RCNN 目标检测模型 通过初始化`pretrained_model` 加载预训练模型。同时在参数微调时也采用该设置加载已训练模型。 +**安装[cocoapi](https://github.com/cocodataset/cocoapi):** + +训练前需要首先下载[cocoapi](https://github.com/cocodataset/cocoapi): + + # COCOAPI=/path/to/clone/cocoapi + git clone https://github.com/cocodataset/cocoapi.git $COCOAPI + cd $COCOAPI/PythonAPI + # if cython is not installed + pip install Cython + # Install into global site-packages + make install + # Alternatively, if you do not have permissions or prefer + # not to install the COCO API into global site-packages + python2 setup.py install --user + **数据读取器说明:** 数据读取器定义在reader.py中。所有图像将短边等比例缩放至`scales`,若长边大于`max_size`, 则再次将长边等比例缩放至`max_iter`。在训练阶段,对图像采用水平翻转。支持将同一个batch内的图像padding为相同尺寸。 **模型设置:** @@ -87,18 +102,7 @@ Faster RCNN 训练loss ## 模型评估 -模型评估是指对训练完毕的模型评估各类性能指标。本示例采用[COCO官方评估](http://cocodataset.org/#detections-eval),使用前需要首先下载[cocoapi](https://github.com/cocodataset/cocoapi): - - # COCOAPI=/path/to/clone/cocoapi - git clone https://github.com/cocodataset/cocoapi.git $COCOAPI - cd $COCOAPI/PythonAPI - # if cython is not installed - pip install Cython - # Install into global site-packages - make install - # Alternatively, if you do not have permissions or prefer - # not to install the COCO API into global site-packages - python2 setup.py install --user +模型评估是指对训练完毕的模型评估各类性能指标。本示例采用[COCO官方评估](http://cocodataset.org/#detections-eval) `eval_coco_map.py`是评估模块的主要执行程序,调用示例如下: @@ -120,7 +124,7 @@ Faster RCNN mAP | Detectron | 8 | 180000 | 0.315 | | Fluid minibatch padding | 8 | 180000 | 0.314 | | Fluid all padding | 8 | 180000 | 0.308 | -| Fluid no padding |6 | 240000 | 0.317 | +| Fluid no padding |8 | 180000 | 0.316 | * Fluid all padding: 每张图像填充为1333\*1333大小。 * Fluid minibatch padding: 同一个batch内的图像填充为相同尺寸。该方法与detectron处理相同。 diff --git a/fluid/faster_rcnn/image/mAP.jpg b/fluid/faster_rcnn/image/mAP.jpg index 9202f8f1a06200c2e9c111eac562c2d59b460cb9..9c781a7caef808b716ace077b2f202267e790f76 100644 Binary files a/fluid/faster_rcnn/image/mAP.jpg and b/fluid/faster_rcnn/image/mAP.jpg differ diff --git a/fluid/faster_rcnn/image/train_loss.jpg b/fluid/faster_rcnn/image/train_loss.jpg index 75d4b0a5f02aacd8fb3a0dfa7a62e60fac9ccb6b..3cc0ff84b30599597bf6a66bf0cbfd7789c485f0 100644 Binary files a/fluid/faster_rcnn/image/train_loss.jpg and b/fluid/faster_rcnn/image/train_loss.jpg differ