Skip to content

Commit 104428d

Browse files
authored
Merge pull request PaddlePaddle#2267 from HydrogenSulfate/PPShiTuV2_doc
update PP-ShiTuV2 docs
2 parents a56366a + b6a1280 commit 104428d

File tree

6 files changed

+218
-116
lines changed

6 files changed

+218
-116
lines changed
7.46 KB
Loading

docs/zh_CN/PPShiTu/PPShiTuV2_introduction.md

Lines changed: 196 additions & 100 deletions
Large diffs are not rendered by default.

docs/zh_CN/PPShiTu/PPShiTu_introduction.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/zh_CN/image_recognition_pipeline/feature_extraction.md

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
- [3.2 Neck](#32-neck)
1111
- [3.3 Head](#33-head)
1212
- [3.4 Loss](#34-loss)
13+
- [3.5 Data Augmentation](#35-data-augmentation)
1314
- [4. 实验部分](#4-实验部分)
1415
- [5. 自定义特征提取](#5-自定义特征提取)
1516
- [5.1 数据准备](#51-数据准备)
@@ -46,25 +47,32 @@
4647

4748
#### 3.1 Backbone
4849

49-
Backbone 部分采用了 [PP-LCNetV2_base](../models/PP-LCNetV2.md),其针对Intel CPU端的性能优化探索了多个有效的结构设计方案,最终实现了在不增加推理时间的情况下,进一步提升模型的性能,最终大幅度超越现有的 SOTA 模型。
50+
Backbone 部分采用了 [PP-LCNetV2_base](../models/PP-LCNetV2.md),其在 `PPLCNet_V1` 的基础上,加入了包括Rep 策略、PW 卷积、Shortcut、激活函数改进、SE 模块改进等多个优化点,使得最终分类精度与 `PPLCNet_x2_5` 相近,且推理延时减少了40%<sup>*</sup>。在实验过程中我们对 `PPLCNetV2_base` 进行了适当的改进,在保持速度基本不变的情况下,让其在识别任务中得到更高的性能,包括:去掉 `PPLCNetV2_base` 末尾的 `ReLU``FC`、将最后一个 stage(RepDepthwiseSeparable) 的 stride 改为1。
51+
52+
53+
**注:** <sup>*</sup>推理环境基于 Intel(R) Xeon(R) Gold 6271C CPU @ 2.60GHz 硬件平台,OpenVINO 推理平台。
5054

5155
#### 3.2 Neck
5256

53-
Neck 部分采用了 [BN Neck](../../../ppcls/arch/gears/bnneck.py),对 Backbone 抽取得到的特征的每个维度进行标准化操作,减少了同时优化度量学习损失和分类损失的难度
57+
Neck 部分采用了 [BN Neck](../../../ppcls/arch/gears/bnneck.py),对 Backbone 抽取得到的特征的每个维度进行标准化操作,减少了同时优化度量学习损失函数和分类损失函数的难度,加快收敛速度
5458

5559
#### 3.3 Head
5660

5761
Head 部分选用 [FC Layer](../../../ppcls/arch/gears/fc.py),使用分类头将 feature 转换成 logits 供后续计算分类损失。
5862

5963
#### 3.4 Loss
6064

61-
Loss 部分选用 [Cross entropy loss](../../../ppcls/loss/celoss.py)[TripletAngularMarginLoss](../../../ppcls/loss/tripletangularmarginloss.py),在训练时以分类损失和基于角度的三元组损失来指导网络进行优化。详细的配置文件见 [GeneralRecognitionV2_PPLCNetV2_base.yaml](../../../ppcls/configs/GeneralRecognitionV2/GeneralRecognitionV2_PPLCNetV2_base.yaml#L63-77)
65+
Loss 部分选用 [Cross entropy loss](../../../ppcls/loss/celoss.py)[TripletAngularMarginLoss](../../../ppcls/loss/tripletangularmarginloss.py),在训练时以分类损失和基于角度的三元组损失来指导网络进行优化。我们基于原始的 TripletLoss (困难三元组损失)进行了改进,将优化目标从 L2 欧几里得空间更换成余弦空间,并加入了 anchor 与 positive/negtive 之间的硬性距离约束,让训练与测试的目标更加接近,提升模型的泛化能力。详细的配置文件见 [GeneralRecognitionV2_PPLCNetV2_base.yaml](../../../ppcls/configs/GeneralRecognitionV2/GeneralRecognitionV2_PPLCNetV2_base.yaml#L63-77)
66+
67+
#### 3.5 Data Augmentation
68+
69+
我们考虑到实际相机拍摄时目标主体可能出现一定的旋转而不一定能保持正立状态,因此我们在数据增强中加入了适当的 [随机旋转增强](../../../ppcls/configs/GeneralRecognitionV2/GeneralRecognitionV2_PPLCNetV2_base.yaml#L117),以提升模型在真实场景中的检索能力。
6270

6371
<a name="4"></a>
6472

6573
## 4. 实验部分
6674

67-
我们对原有的训练数据进行了合理扩充与优化,最终使用如下 16 个公开数据集的汇总:
75+
我们对原有的训练数据进行了合理扩充与优化,最终使用如下 17 个公开数据集的汇总:
6876

6977
| 数据集 | 数据量 | 类别数 | 场景 | 数据集地址 |
7078
| :--------------------- | :-----: | :------: | :---: | :----------------------------------------------------------------------------------: |
@@ -89,16 +97,13 @@ Loss 部分选用 [Cross entropy loss](../../../ppcls/loss/celoss.py) 和 [Tripl
8997

9098
最终的模型精度指标如下表所示:
9199

92-
| 模型 | Aliproduct | VeRI-Wild | LogoDet-3k | iCartoonFace | SOP | Inshop |
93-
| :--------- | :-------------- | :-------------- | :-------------- | :-------------- | :-------------- | :-------------- |
94-
| - | recall@1%(mAP%) | recall@1%(mAP%) | recall@1%(mAP%) | recall@1%(mAP%) | recall@1%(mAP%) | recall@1%(mAP%) |
95-
| PP-ShiTuV2 | 84.2(83.3) | 87.8(68.8) | 88.0(63.2) | 53.6(27.5) | 77.6(55.3) | 90.8(74.3) |
96-
97-
| 模型 | gldv2 | imdb_face | iNat | instre | sketch | sop<sup>*</sup> |
98-
| :--------- | :-------------- | :-------------- | :-------------- | :-------------- | :-------------- | :-------------- |
99-
| - | recall@1%(mAP%) | recall@1%(mAP%) | recall@1%(mAP%) | recall@1%(mAP%) | recall@1%(mAP%) | recall@1%(mAP%) |
100-
| PP-ShiTuV2 | 98.1(90.5) | 35.9(11.2) | 38.6(23.9) | 87.7(71.4) | 39.3(15.6) | 98.3(90.9) |
100+
| 模型 | 延时(ms) | 存储(MB) | product<sup>*</sup> | | Aliproduct | | VeRI-Wild | | LogoDet-3k | | iCartoonFace | | SOP | | Inshop | | gldv2 | | imdb_face | | iNat | | instre | | sketch | | sop | |
101+
| :--------------------- | :------- | :------- | :------------------ | :--- | ---------- | ---- | --------- | ---- | ---------- | ---- | ------------ | ---- | -------- | ---- | -------- | ---- | -------- | ---- | --------- | ---- | -------- | ---- | -------- | ---- | -------- | ---- | -------- | ---- |
102+
| | | | recall@1 | mAP | recall@1 | mAP | recall@1 | mAP | recall@1 | mAP | recall@1 | mAP | recall@1 | mAP | recall@1 | mAP | recall@1 | mAP | recall@1 | mAP | recall@1 | mAP | recall@1 | mAP | recall@1 | mAP | recall@1 | mAP |
103+
| PP-ShiTuV1_general_rec | 5.0 | 34 | 65.9 | 54.3 | 83.9 | 83.2 | 88.7 | 60.1 | 86.1 | 73.6 | 84.1 | 72.3 | 79.7 | 58.6 | 89.1 | 69.4 | 98.2 | 91.6 | 28.8 | 8.42 | 12.6 | 6.1 | 72.0 | 50.4 | 27.9 | 9.5 | 97.6 | 90.3 |
104+
| PP-ShiTuV2_general_rec | 6.1 | 19 | 73.7 | 61.0 | 84.2 | 83.3 | 87.8 | 68.8 | 88.0 | 63.2 | 53.6 | 27.5 | 77.6 | 55.3 | 90.8 | 74.3 | 98.1 | 90.5 | 35.9 | 11.2 | 38.6 | 23.9 | 87.7 | 71.4 | 39.3 | 15.6 | 98.3 | 90.9 |
101105

106+
* product数据集是为了验证PP-ShiTu的泛化性能而制作的数据集,所有的数据都没有在训练和测试集中出现。该数据包含7个大类(化妆品、地标、红酒、手表、车、运动鞋、饮料),250个小类。测试时,使用250个小类的标签进行测试;sop数据集来自[GPR1200: A Benchmark for General-Purpose Content-Based Image Retrieval](https://arxiv.org/abs/2111.13122),可视为“SOP”数据集的子集。
102107
* 预训练模型地址:[general_PPLCNetV2_base_pretrained_v1.0.pdparams](https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/rec/models/pretrain/PPShiTuV2/general_PPLCNetV2_base_pretrained_v1.0.pdparams)
103108
* 采用的评测指标为:`Recall@1``mAP`
104109
* 速度评测机器的 CPU 具体信息为:`Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz`

docs/zh_CN/inference_deployment/export_model.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ python tools/export_model.py \
4646
<a name="3"></a>
4747
## 3. 主体检测模型导出
4848

49-
主体检测模型的导出,可以参考[主题检测介绍](../image_recognition_pipeline/mainbody_detection.md)
49+
主体检测模型的导出,可以参考[主体检测介绍](../image_recognition_pipeline/mainbody_detection.md)
5050

5151
<a name="4"></a>
5252
## 4. 识别模型导出

docs/zh_CN/quick_start/quick_start_recognition.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,9 @@
122122

123123
注意:由于部分解压缩软件在解压上述 `tar` 格式文件时存在问题,建议非命令行用户下载 `zip` 格式文件并解压。`tar` 格式文件建议使用命令 `tar -xf xxx.tar` 解压。
124124

125-
本章节 demo 数据下载地址如下: [drink_dataset_v2.0.tar(瓶装饮料数据)](https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/rec/data/drink_dataset_v2.0.tar)
125+
本章节 demo 数据下载地址如下: [drink_dataset_v2.0.tar(瓶装饮料数据)](https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/rec/data/drink_dataset_v2.0.tar)
126+
127+
下面以 **drink_dataset_v2.0.tar** 为例介绍PC端的 PP-ShiTu 快速体验流程。用户也可以自行下载并解压其它场景的数据进行体验:[22种场景数据下载](../introduction/ppshitu_application_scenarios.md#1-应用场景介绍)
126128

127129
如果希望体验服务端主体检测和各垂类方向的识别模型,可以参考 [2.4 服务端识别模型列表](#24-服务端识别模型列表)
128130

0 commit comments

Comments
 (0)