diff --git a/fluid/PaddleCV/rcnn/README.md b/fluid/PaddleCV/rcnn/README.md index 80d389ec3e1b797b96e62dc040f34744b6fc54cb..97d1736f2b25bd6baa5ab5142be18544c9d63b85 100644 --- a/fluid/PaddleCV/rcnn/README.md +++ b/fluid/PaddleCV/rcnn/README.md @@ -12,7 +12,7 @@ ## Installation -Running sample code in this directory requires PaddelPaddle Fluid v.1.0.0 and later. If the PaddlePaddle on your device is lower than this version, please follow the instructions in [installation document](http://www.paddlepaddle.org/documentation/docs/zh/0.15.0/beginners_guide/install/install_doc.html#paddlepaddle) and make an update. +Running sample code in this directory requires PaddelPaddle Fluid v.1.3.0 and later. If the PaddlePaddle on your device is lower than this version, please follow the instructions in [installation document](http://paddlepaddle.org/documentation/docs/en/1.3/beginners_guide/install/index_en.html) and make an update. ## Introduction @@ -37,6 +37,25 @@ Train the model on [MS-COCO dataset](http://cocodataset.org/#download), download cd dataset/coco ./download.sh +The data catalog structure is as follows: + + ``` + data/coco/ + ├── annotations + │ ├── instances_train2014.json + │ ├── instances_train2017.json + │ ├── instances_val2014.json + │ ├── instances_val2017.json + | ... + ├── train2017 + │ ├── 000000000009.jpg + │ ├── 000000580008.jpg + | ... + ├── val2017 + │ ├── 000000000139.jpg + │ ├── 000000000285.jpg + | ... + ``` ## Training @@ -174,7 +193,7 @@ python infer.py \ --draw_threshold=0.6 ``` -Please set the model path and image path correctly. +Please set the model path and image path correctly. GPU device is used by default, you can set `--use_gpu=False` to switch to CPU device. And you can set `draw_threshold` to tune score threshold to control the number of output detection boxes. Visualization of infer result is shown as below:
diff --git a/fluid/PaddleCV/rcnn/README_cn.md b/fluid/PaddleCV/rcnn/README_cn.md index b7577a858edc135a23ad6d9c3252318e9847aca5..3d45de1c5845727d0b942f9ba5a4bf5216985af9 100644 --- a/fluid/PaddleCV/rcnn/README_cn.md +++ b/fluid/PaddleCV/rcnn/README_cn.md @@ -12,7 +12,7 @@ ## 安装 -在当前目录下运行样例代码需要PadddlePaddle Fluid的v.1.0.0或以上的版本。如果你的运行环境中的PaddlePaddle低于此版本,请根据[安装文档](http://www.paddlepaddle.org/documentation/docs/zh/0.15.0/beginners_guide/install/install_doc.html#paddlepaddle)中的说明来更新PaddlePaddle。 +在当前目录下运行样例代码需要PadddlePaddle Fluid的v.1.3.0或以上的版本。如果你的运行环境中的PaddlePaddle低于此版本,请根据[安装文档](http://www.paddlepaddle.org/)中的说明来更新PaddlePaddle。 ## 简介 区域卷积神经网络(RCNN)系列模型为两阶段目标检测器。通过对图像生成候选区域,提取特征,判别特征类别并修正候选框位置。 @@ -37,6 +37,27 @@ Mask RCNN同样为两阶段框架,第一阶段扫描图像生成候选框; cd dataset/coco ./download.sh +数据目录结构如下: + +``` +data/coco/ +├── annotations +│ ├── instances_train2014.json +│ ├── instances_train2017.json +│ ├── instances_val2014.json +│ ├── instances_val2017.json +| ... +├── train2017 +│ ├── 000000000009.jpg +│ ├── 000000580008.jpg +| ... +├── val2017 +│ ├── 000000000139.jpg +│ ├── 000000000285.jpg +| ... + +``` + ## 模型训练 **下载预训练模型:** 本示例提供Resnet-50预训练模型,该模性转换自Caffe,并对批标准化层(Batch Normalization Layer)进行参数融合。采用如下命令下载预训练模型: @@ -170,7 +191,7 @@ python infer.py \ --draw_threshold=0.6 ``` -注意,请正确设置`${path_to_trained_model}`模型和预测图片的路径。 +注意,请正确设置模型路径`${path_to_trained_model}`和预测图片路径。默认使用GPU设备,也可通过设置`--use_gpu=False`使用CPU设备。可通过设置`draw_threshold`调节得分阈值控制检测框的个数。 下图为模型可视化预测结果:
diff --git a/fluid/PaddleCV/rcnn/infer.py b/fluid/PaddleCV/rcnn/infer.py index 416d51caf71c7cb0f3860ad3397528d327128842..0c66ec08cf63cbf25df0959a5c082838965d7597 100644 --- a/fluid/PaddleCV/rcnn/infer.py +++ b/fluid/PaddleCV/rcnn/infer.py @@ -33,8 +33,8 @@ def infer(): } labels_map[0] = 'background' except: - print("The COCO dataset is not exist, use the defalut mapping of class " - "index and real category name on COCO17.") + print("The COCO dataset or COCO API is not exist, use the default " + "mapping of class index and real category name on COCO17.") assert cfg.dataset == 'coco2017' labels_map = coco17_labels()