未验证 提交 24e1be42 编写于 作者: H HydrogenSulfate 提交者: GitHub

update PP-ShiTu en docs (#5589)

* update PP-ShiTuV2 files

* update PP-ShiTu

* add PP-ShiTuV2 APP files

* refine code

* remove PP-ShiTuV1' APP

* correct  in info.yaml

* update partial en docs

* update

* update PP-ShiTu en doc

* refine
上级 24ce4ab6
......@@ -22,7 +22,7 @@
主体检测模型的数据集请参考 [主体检测模型数据集](https://github.com/PaddlePaddle/PaddleClas/blob/release/2.4/docs/zh_CN/image_recognition_pipeline/mainbody_detection.md#1-%E6%95%B0%E6%8D%AE%E9%9B%86)
### 1.3 指标 (字段可根据模型情况,自行定义)
### 1.3 指标
| 模型名称 | 模型简介 | 模型体积 | 输入尺寸 | ips |
| ------------------------------------ | -------- | ---------- | -------- | --- |
......@@ -41,7 +41,7 @@
PP-ShiTu特征提取模型使用自建产品数据集作为测试集
### 2.3 指标(字段可根据模型情况,自行定义)
### 2.3 指标
| 模型 | 存储(主体检测+特征提取) | product |
| :------- | :---------------------- | :------- |
......
......@@ -10,7 +10,7 @@
"source": [
"## 1. Introduction of PP-ShiTu\n",
"PP-ShiTu is a practical lightweight general-purpose image recognition system, which mainly consists of three modules: subject detection, feature learning and vector retrieval. The system adopts a variety of strategies from 8 aspects of backbone network selection and adjustment, loss function selection, data enhancement, learning rate transformation strategy, regularization parameter selection, use of pre-trained models, and model pruning and quantification Optimization, and finally a system that can complete the image recognition of the 10w+ library in only 0.2s on the CPU.\n",
"For more details, please refer to [PP-ShiTu Technical Solution](https://arxiv.org/pdf/2111.00775.pdf).\n",
"For more details, please refer to [PP-ShiTu Technical Paper](https://arxiv.org/pdf/2111.00775.pdf).\n",
"\n",
"Learn more about PaddleClas at https://github.com/PaddlePaddle/PaddleClas.\n",
"\n",
......@@ -19,7 +19,7 @@
"\n",
"#### 2.1.1 dataset:\n",
"\n",
"The training data set and test set of PP-ShiTu are composed of 7 data sets such as Aliproduct and GLDv2. For details, please refer to [PP-ShiTu Experimental Part](https://github.com/PaddlePaddle/PaddleClas/blob/release/ 2.4/docs/zh_CN/image_recognition_pipeline/feature_extraction.md#4-%E5%AE%9E%E9%AA%8C%E9%83%A8%E5%88%86)\n",
"The training data set and test set of PP-ShiTu are composed of 7 data sets such as Aliproduct and GLDv2. For details, please refer to [PP-ShiTu Experimental Part](https://github.com/PaddlePaddle/PaddleClas/blob/release/2.4/docs/zh_CN/image_recognition_pipeline/feature_extraction.md#4-%E5%AE%9E%E9%AA%8C%E9%83%A8%E5%88%86)\n",
"\n",
"#### 2.1.2 output preview:\n",
"\n",
......@@ -59,10 +59,10 @@
},
"outputs": [],
"source": [
"# 不在Jupyter Notebook上运行时需要将含 \"!\" 和 \"%\" 的语句注释,不需要运行。\n",
"# When not running on the Jupyter Notebook, you need to add the \"!\" and \"%\" statement comments, do not need to run.\n",
"%cd ~/work\n",
"\n",
"# 克隆 PaddleClas(gitee上克隆速度较快)\n",
"# Clone PaddleClas(Cloning is faster on gitee)\n",
"!git clone https://gitee.com/paddlepaddle/PaddleClas"
]
},
......@@ -93,16 +93,16 @@
},
"outputs": [],
"source": [
"# 进入 PaddleClas 目录\n",
"# Access into PaddleClas\n",
"%cd ~/work/PaddleClas/\n",
"\n",
"# 切换到2.4分支\n",
"# Switch to the 2.4 branch\n",
"!git checkout release/2.4\n",
"\n",
"# 安装所需依赖项\n",
"# Install required dependencies\n",
"!pip install -r requirements.txt\n",
"\n",
"# 设置GPU\n",
"# set GPU environment\n",
"# %env CUDA_VISIBLE_DEVICES=0"
]
},
......@@ -131,25 +131,25 @@
},
"outputs": [],
"source": [
"# 进入 PaddleClas 目录\n",
"# Access into PaddleClas\n",
"%cd ~/work/PaddleClas/\n",
"\n",
"# 创建存放主体检测、特征提取推理模型的文件夹\n",
"# Create a folder for storing mainbody detection and feature extraction inference models\n",
"%mkdir -p deploy/models\n",
"\n",
"# 进入该文件夹\n",
"# Access into models\n",
"%cd deploy/models\n",
"\n",
"# 下载主体检测inference模型并解压\n",
"# Download the mainbody detection inference model and unzip it\n",
"!wget -nc https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/rec/models/inference/picodet_PPLCNet_x2_5_mainbody_lite_v1.0_infer.tar && tar -xf picodet_PPLCNet_x2_5_mainbody_lite_v1.0_infer.tar\n",
"\n",
"# 下载特征提取inference模型并解压\n",
"# Download the feature extraction inference model and unzip it\n",
"!wget -nc https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/rec/models/inference/general_PPLCNet_x2_5_lite_v1.0_infer.tar && tar -xf general_PPLCNet_x2_5_lite_v1.0_infer.tar\n",
"\n",
"# 返回至deploy文件夹\n",
"# Back to deloy\n",
"%cd ~/work/PaddleClas/deploy/\n",
"\n",
"# 下载测试数据 drink_dataset_v1.0 并解压\n",
"# Download the test data drink_dataset_v1.0 and unzip it\n",
"!wget -nc https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/rec/data/drink_dataset_v1.0.tar && tar -xf drink_dataset_v1.0.tar"
]
},
......@@ -169,18 +169,18 @@
},
"outputs": [],
"source": [
"# 进入 PaddleClas 目录\n",
"# Access into PaddleClas\n",
"%cd ~/work/PaddleClas/\n",
"\n",
"# 进入deploy文件夹\n",
"# Access into deploy\n",
"%cd ./deploy\n",
"\n",
"# 用 general_PPLCNet_x2_5_lite_v1.0 推理模型提取gallery图片的特征,制作成检索库\n",
"# general_PPLCNet_x2_5_lite_v1.0 inference model is used to extract the features of gallery images and make a retrieval database\n",
"!python3.7 python/build_gallery.py -c configs/inference_general.yaml -o Global.rec_inference_model_dir=./models/general_PPLCNet_x2_5_lite_v1.0_infer\n",
"\n",
"# 对 nongfu_spring.jpeg 图片进行识别推理(GPU推理)\n",
"# Recognition inference for nongfu_spring.jpeg image (GPU inference)\n",
"!python3.7 python/predict_system.py -c configs/inference_general.yaml\n",
"# 对 nongfu_spring.jpeg 图片进行识别推理(CPU推理)\n",
"# Recognition inference for nongfu_spring.jpeg image (CPU inference)\n",
"!python3.7 python/predict_system.py -c configs/inference_general.yaml -o Global.use_gpu=False"
]
},
......@@ -204,45 +204,40 @@
"- For the dataset preparation, training, evaluation and other steps of the mainbody detection model, please refer to [PP-ShiTu feature extraction doc](https://github.com/PaddlePaddle/PaddleClas/blob/release/2.4/docs/zh_CN/image_recognition_pipeline/feature_extraction.md#51-%E6%95%B0%E6%8D%AE%E5%87%86%E5%A4%87)\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 4. 模型原理\n",
"PP-ShiTu 系列识别系统,包括本文档介绍的 PP-ShiTu,均由3个模块串联完成整个识别过程,如下图所示\n",
"## 4. Algorithm\n",
"PP-ShiTu series recognition systems, including PP-ShiTu introduced in this document, consists of three modules to complete the entire recognition process, as shown in the figure below\n",
"\n",
"![PP-ShiTu系统](https://github.com/PaddlePaddle/PaddleClas/blob/release/2.4/docs/images/structure.jpg?raw=true)\n",
"![PP-ShiTu System](https://github.com/PaddlePaddle/PaddleClas/blob/release/2.4/docs/images/structure.jpg?raw=true)\n",
"\n",
"- 主体检测:上图中的蓝色模块,主要负责检测出用户输入图片中可能的识别目标,进而裁剪出这些目标,过滤不重要的背景,减少背景的干扰。事实上这种保留主体,过滤背景的做法是实践中会采用的一种简单而有效的方法。\n",
"- 特征提取:接收 **主体检测** 模块输出的含有目标主体的裁剪后的图片,将其输入到特征提取模型中,得到对应的特征向量,作为该图片的表示特征用于接下来的检索步骤。\n",
"- 向量检索:接收 **特征提取** 模块输出的一个或多个特征向量,逐个地在向量库中检索,将检索库中最邻近(一般以相似度表示邻近程度)的向量的类别,作为检索向量的类别,最后返回检索结果。该模块不需要额外训练,安装第三方开源的faiss检索库即可使用\n",
"- Mainbody detection: The blue colored module in the figure above detects potential targets in the input image, and then cropping these targets, filtering unimportant backgrounds, and reducing background interference. In fact, this practice of retaining the mainbody and filtering the background is a simple, effective and widely used method in practice.\n",
"- Feature extraction: Receive the cropped image containing the target mainbody output by the **mainbody detection** module, and input it into the feature extraction model to obtain the corresponding feature vector, which is used as the representation feature of the image for subsequent retrieval.\n",
"- Vector retrieval: Receive one or more feature vectors output by the **feature extraction** module, and retrieve them one by one in the vector library, finally return the retrieval result. This module does not require additional training and can be used by installing the third-party open source faiss retrieval library\n",
"\n",
"在检索系统中,最重要的模块之一就是特征提取模型,其特征提取能力好坏直接影响检索库内向量和待检索向量的质量,因此接下来分5个部分,重点介绍 PP-ShiTu 所使用的特征提取模型。\n",
"In the recognition system, one of the most important modules is the feature extraction model. The generalization of feature extraction model directly affects the quality of the vectors in the retrieval library and the vectors to be retrieved. Therefore, we will introduce feature extraction model below in 5 parts.\n",
"\n",
"- Backbone\n",
" Backbone 部分采用了 PP_LCNet_x2_5,其针对Intel CPU端的性能优化探索了多个有效的结构设计方案,最终实现了在不增加推理时间的情况下,进一步提升模型的性能,最终大幅度超越现有的 SOTA 模型。\n",
" The Backbone uses PP_LCNet_x2_5, which explores many effective structural design schemes for the performance optimization of Intel CPU. Finally, the backbone further improves the performance of the model without increasing the reasoning time, and finally greatly exceeds the existing SOTA model.\n",
"\n",
"- Neck\n",
"\n",
" Neck 部分采用了 FC Layer,对 Backbone 抽取得到的特征进行降维,减少了特征存储的成本与计算量。\n",
" The Neck part uses FC Layer to reduce the dimension of features extracted by the Backbone, thus reducing the cost and computation of feature storage.\n",
"\n",
"- Head\n",
"\n",
" Head 部分选用 ArcMargin,在训练时通过指定margin,增大同类特征之间的角度差异再进行分类,进一步提升抽取特征的表征能力。\n",
" The Head part uses ArcMargin. During training, margin was specified to increase the Angle difference between similar features before classification, so as to further improve the characterization ability of feature extraction.\n",
"\n",
"- Loss\n",
"\n",
" Loss 部分选用 Cross entropy loss,在训练时以分类任务的损失函数来指导网络进行优化。详细的配置文件见通用识别配置文件。\n",
" The Loss adopts Cross entropy loss, using classification loss to optimize the network during training.See the General Identification Profile for detailed configuration files.\n",
"\n",
"## 5. 注意事项\n",
"PP-ShiTu 是在寻找在产业实践中最高性价比的图像识别方案,但考虑到不同识别场景的数据集均有各自的分布特点,以及训练时的软硬件限制,无法一次性将所有的数据集全部纳入到训练集中,经过权衡才使用了目前这套训练数据集的组合。因此推荐用户在了解自己实际业务数据集的特点之后,基于 PP-ShiTu 的预训练模型以及训练配置,在自己的业务数据集上进行微调甚至二次开发,以获得性能更好,更适配自己数据集的识别模型。\n",
"## 5. Note\n",
"PP-ShiTu is looking for the most cost-effective image recognition solution in industrial practice. However, considering that the datasets of different recognition scenarios have their own distribution characteristics, as well as the limitations of software and hardware during training, it is difficult to integrate all datasets at one time. Therefore, it is recommended that users, after understanding the characteristics of your actual datasets, fine-tune or even make an further development on your own datasets based on the PP-ShiTu pre-training model and training configuration, in order to obtain better performance and generalization.\n",
"\n",
"## 6. 相关论文以及引用信息\n",
"## 6. Reference\n",
"```log\n",
"@article{cui2021pp,\n",
" title={PP-LCNet: A Lightweight CPU Convolutional Neural Network},\n",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册