Skip to content

Commit

Permalink
docs: rename
Browse files Browse the repository at this point in the history
  • Loading branch information
TingquanGao committed Sep 16, 2022
1 parent 5b2e10a commit d355571
Show file tree
Hide file tree
Showing 12 changed files with 49 additions and 41 deletions.
1 change: 1 addition & 0 deletions deploy/cpp_shitu/README.md
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,52 +4,20 @@

## 目录

- [1. 图像分类模型推理](#1)
- [2. PP-ShiTu模型推理](#2)
- [2.1 主体检测模型推理](#2.1)
- [2.2 特征提取模型推理](#2.2)
- [2.3 PP-ShiTu PipeLine推理](#2.3)
- [1. PP-ShiTu模型推理](#1)
- [1.1 主体检测模型推理](#1.1)
- [1.2 特征提取模型推理](#1.2)
- [1.3 PP-ShiTu PipeLine推理](#1.3)

<a name="1"></a>

## 1. 图像分类推理

首先请参考文档[模型导出](./export_model.md)准备 inference 模型,然后进入 PaddleClas 的 `deploy` 目录下:

```shell
cd PaddleClas/deploy
```

使用以下命令进行预测:

```shell
python3.7 python/predict_cls.py -c configs/inference_cls.yaml
```

在配置文件 `configs/inference_cls.yaml` 中有以下字段用于配置预测参数:
* `Global.infer_imgs`:待预测的图片文件(夹)路径;
* `Global.inference_model_dir`:inference 模型文件所在文件夹的路径,该文件夹下需要有文件 `inference.pdmodel``inference.pdiparams` 两个文件;
* `Global.use_gpu`:是否使用 GPU 预测,默认为 `True`
* `Global.enable_mkldnn`:是否启用 `MKL-DNN` 加速库,默认为 `False`。注意 `enable_mkldnn``use_gpu` 同时为 `True` 时,将忽略 `enable_mkldnn`,而使用 GPU 预测;
* `Global.use_fp16`:是否启用 `FP16`,默认为 `False`
* `Global.use_tensorrt`:是否使用 TesorRT 预测引擎,默认为 `False`
* `PreProcess`:用于数据预处理配置;
* `PostProcess`:由于后处理配置;
* `PostProcess.Topk.class_id_map_file`:数据集 label 的映射文件,默认为 `../ppcls/utils/imagenet1k_label_list.txt`,该文件为 PaddleClas 所使用的 ImageNet 数据集 label 映射文件。

**注意**:
* 如果使用 VisionTransformer 系列模型,如 `DeiT_***_384`, `ViT_***_384` 等,请注意模型的输入数据尺寸,该类模型需要修改参数: `PreProcess.resize_short=384`, `PreProcess.resize=384`
* 如果你希望提升评测模型速度,使用 GPU 评测时,建议开启 TensorRT 加速预测,使用 CPU 评测时,建议开启 MKL-DNN 加速预测。

<a name="2"></a>

## 2. PP-ShiTu模型推理
## 1. PP-ShiTu模型推理

PP-ShiTu整个Pipeline包含三部分:主体检测、特征提取模型、特征检索。其中主体检测模型、特征提取模型可以单独推理使用。单独使用主体检测详见[主体检测模型推理](#2.1),特征提取模型单独推理详见[特征提取模型推理](#2.2), PP-ShiTu整体推理详见[PP-ShiTu PipeLine推理](#2.3)

<a name="2.1"></a>

### 2.1 主体检测模型推理
### 1.1 主体检测模型推理

进入 PaddleClas 的 `deploy` 目录下:

Expand Down Expand Up @@ -78,7 +46,7 @@ python3.7 python/predict_det.py -c configs/inference_det.yaml

<a name="2.2"></a>

### 2.2 特征提取模型推理
### 1.2 特征提取模型推理

下面以商品图片的特征提取为例,介绍特征提取模型推理。首先进入 PaddleClas 的 `deploy` 目录下:

Expand Down Expand Up @@ -107,8 +75,8 @@ python3.7 python/predict_rec.py -c configs/inference_rec.yaml
* `Global.infer_imgs`:待预测的图片文件路径;
* `Global.use_gpu`: 是否使用 GPU 预测,默认为 `True`

<a name="2.3"></a>
<a name="1.3"></a>

### 2.3. PP-ShiTu PipeLine推理
### 1.3 PP-ShiTu PipeLine推理

主体检测、特征提取和向量检索的串联预测,可以参考[图像识别快速开始](../quick_start/quick_start_recognition.md)
1 change: 1 addition & 0 deletions docs/zh_CN/deployment/image_classification/paddle2onnx.md
38 changes: 38 additions & 0 deletions docs/zh_CN/deployment/image_classification/python.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Python 预测推理

首先请参考文档[环境准备](../installation/install_paddleclas.md)配置运行环境。

## 目录

- [1. 图像分类模型推理](#1)

<a name="1"></a>

## 1. 图像分类推理

首先请参考文档[模型导出](./export_model.md)准备 inference 模型,然后进入 PaddleClas 的 `deploy` 目录下:

```shell
cd PaddleClas/deploy
```

使用以下命令进行预测:

```shell
python3.7 python/predict_cls.py -c configs/inference_cls.yaml
```

在配置文件 `configs/inference_cls.yaml` 中有以下字段用于配置预测参数:
* `Global.infer_imgs`:待预测的图片文件(夹)路径;
* `Global.inference_model_dir`:inference 模型文件所在文件夹的路径,该文件夹下需要有文件 `inference.pdmodel``inference.pdiparams` 两个文件;
* `Global.use_gpu`:是否使用 GPU 预测,默认为 `True`
* `Global.enable_mkldnn`:是否启用 `MKL-DNN` 加速库,默认为 `False`。注意 `enable_mkldnn``use_gpu` 同时为 `True` 时,将忽略 `enable_mkldnn`,而使用 GPU 预测;
* `Global.use_fp16`:是否启用 `FP16`,默认为 `False`
* `Global.use_tensorrt`:是否使用 TesorRT 预测引擎,默认为 `False`
* `PreProcess`:用于数据预处理配置;
* `PostProcess`:由于后处理配置;
* `PostProcess.Topk.class_id_map_file`:数据集 label 的映射文件,默认为 `../ppcls/utils/imagenet1k_label_list.txt`,该文件为 PaddleClas 所使用的 ImageNet 数据集 label 映射文件。

**注意**:
* 如果使用 VisionTransformer 系列模型,如 `DeiT_***_384`, `ViT_***_384` 等,请注意模型的输入数据尺寸,该类模型需要修改参数: `PreProcess.resize_short=384`, `PreProcess.resize=384`
* 如果你希望提升评测模型速度,使用 GPU 评测时,建议开启 TensorRT 加速预测,使用 CPU 评测时,建议开启 MKL-DNN 加速预测。
File renamed without changes.
File renamed without changes.

0 comments on commit d355571

Please sign in to comment.