diff --git a/deploy/configs/build_product.yaml b/deploy/configs/build_product.yaml index f9b03a7f5a52e03f4c19a44b504825d216e42a7d..258b40a10ac0583c7d6cda4db7a7d694e3e2bac9 100644 --- a/deploy/configs/build_product.yaml +++ b/deploy/configs/build_product.yaml @@ -1,5 +1,5 @@ Global: - rec_inference_model_dir: "./models/product_ResNet50_vd_aliproduct_v1.0_infer" + rec_inference_model_dir: "./models/general_PPLCNet_x2_5_lite_v1.0_infer" batch_size: 32 use_gpu: True enable_mkldnn: True @@ -27,9 +27,9 @@ RecPostProcess: null # indexing engine config IndexProcess: index_method: "HNSW32" # supported: HNSW32, IVF, Flat - index_dir: "./recognition_demo_data_v1.1/gallery_product/index" - image_root: "./recognition_demo_data_v1.1/gallery_product/" - data_file: "./recognition_demo_data_v1.1/gallery_product/data_file.txt" + image_root: "./drink_dataset_v1.0/gallery/" + index_dir: "./drink_dataset_v1.0/index" + data_file: "./drink_dataset_v1.0/gallery/drink_label.txt" index_operation: "new" # suported: "append", "remove", "new" delimiter: "\t" dist_type: "IP" diff --git a/deploy/configs/inference_product.yaml b/deploy/configs/inference_product.yaml index 70f3c2fcee5cf8a25714bb0d4333b9857bda1f25..86f26f6401964182dbff2b43a6b65c6f8ca5d33d 100644 --- a/deploy/configs/inference_product.yaml +++ b/deploy/configs/inference_product.yaml @@ -1,7 +1,7 @@ Global: - infer_imgs: "./recognition_demo_data_v1.1/test_product/daoxiangcunjinzhubing_6.jpg" - det_inference_model_dir: "./models/ppyolov2_r50vd_dcn_mainbody_v1.0_infer" - rec_inference_model_dir: "./models/product_ResNet50_vd_aliproduct_v1.0_infer" + infer_imgs: "./drink_dataset_v1.0/test_images/nongfu_spring.jpeg" + det_inference_model_dir: "./models/picodet_PPLCNet_x2_5_mainbody_lite_v1.0_infer" + rec_inference_model_dir: "./models/general_PPLCNet_x2_5_lite_v1.0_infer" rec_nms_thresold: 0.05 batch_size: 1 @@ -50,6 +50,6 @@ RecPostProcess: null # indexing engine config IndexProcess: - index_dir: "./recognition_demo_data_v1.1/gallery_product/index" + index_dir: "./drink_dataset_v1.0/index/" return_k: 5 score_thres: 0.5 diff --git a/docs/images/recognition/drink_data_demo/output/mosilian.jpeg b/docs/images/recognition/drink_data_demo/output/mosilian.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..fd3b6bb5245a833c3f282bb375627bd9bdfe6ceb Binary files /dev/null and b/docs/images/recognition/drink_data_demo/output/mosilian.jpeg differ diff --git a/docs/images/recognition/drink_data_demo/output/nongfu_spring.jpeg b/docs/images/recognition/drink_data_demo/output/nongfu_spring.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..b6669ba724088ccc70cbb5650f6b297c88393fcc Binary files /dev/null and b/docs/images/recognition/drink_data_demo/output/nongfu_spring.jpeg differ diff --git a/docs/images/recognition/drink_data_demo/output/youjia.jpeg b/docs/images/recognition/drink_data_demo/output/youjia.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..a437915fb267ffd0dfdc367f82b083ee992dd6b8 Binary files /dev/null and b/docs/images/recognition/drink_data_demo/output/youjia.jpeg differ diff --git a/docs/images/recognition/drink_data_demo/test_images/mosilian.jpeg b/docs/images/recognition/drink_data_demo/test_images/mosilian.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..e5ed054382f6ad912a507d21107392fa99e1f220 Binary files /dev/null and b/docs/images/recognition/drink_data_demo/test_images/mosilian.jpeg differ diff --git a/docs/images/recognition/drink_data_demo/test_images/nongfu_spring.jpeg b/docs/images/recognition/drink_data_demo/test_images/nongfu_spring.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..0f4166d7e9b39301b01124616039e8fa0a171b3c Binary files /dev/null and b/docs/images/recognition/drink_data_demo/test_images/nongfu_spring.jpeg differ diff --git a/docs/images/recognition/drink_data_demo/test_images/youjia.jpeg b/docs/images/recognition/drink_data_demo/test_images/youjia.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..2875a76ec4ee83b2fa22b45f3963c0897381f0ea Binary files /dev/null and b/docs/images/recognition/drink_data_demo/test_images/youjia.jpeg differ diff --git a/docs/zh_CN/quick_start/quick_start_recognition.md b/docs/zh_CN/quick_start/quick_start_recognition.md index 6fd5fd7effc766c721f30c2edc9f38ccf7312ef0..ea18ddd885513dbc39851123a0d02299a5aa64db 100644 --- a/docs/zh_CN/quick_start/quick_start_recognition.md +++ b/docs/zh_CN/quick_start/quick_start_recognition.md @@ -16,12 +16,13 @@ * [3.1 准备新的数据与标签](#准备新的数据与标签) * [3.2 建立新的索引库](#建立新的索引库) * [3.3 基于新的索引库的图像识别](#基于新的索引库的图像识别) +* [4. 服务端识别模型列表](#4) ## 1. 环境配置 -* 安装:请先参考[快速安装](./install.md)配置 PaddleClas 运行环境。 +* 安装:请先参考[Paddle安装教程](../installation/install_paddle.md) 以及 [PaddleClas安装教程](../installation/install_paddleclas.md) 配置 PaddleClas 运行环境。 * 进入 `deploy` 运行目录。本部分所有内容与命令均需要在 `deploy` 目录下运行,可以通过下面的命令进入 `deploy` 目录。 @@ -32,27 +33,18 @@ ## 2. 图像识别体验 -检测模型与 4 个方向( Logo、动漫人物、车辆、商品 )的识别 inference 模型、测试数据下载地址以及对应的配置文件地址如下。 - -服务器端通用主体检测模型与各方向识别模型: - -| 模型简介 | 推荐场景 | inference模型 | 预测配置文件 | 构建索引库的配置文件 | -| ------------ | ------------- | -------- | ------- | -------- | -| 通用主体检测模型 | 通用场景 |[模型下载链接](https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/rec/models/inference/ppyolov2_r50vd_dcn_mainbody_v1.0_infer.tar) | - | - | -| Logo 识别模型 | Logo场景 | [模型下载链接](https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/rec/models/inference/logo_rec_ResNet50_Logo3K_v1.0_infer.tar) | [inference_logo.yaml](../../../deploy/configs/inference_logo.yaml) | [build_logo.yaml](../../../deploy/configs/build_logo.yaml) | -| 动漫人物识别模型 | 动漫人物场景 | [模型下载链接](https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/rec/models/inference/cartoon_rec_ResNet50_iCartoon_v1.0_infer.tar) | [inference_cartoon.yaml](../../../deploy/configs/inference_cartoon.yaml) | [build_cartoon.yaml](../../../deploy/configs/build_cartoon.yaml) | -| 车辆细分类模型 | 车辆场景 | [模型下载链接](https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/rec/models/inference/vehicle_cls_ResNet50_CompCars_v1.0_infer.tar) | [inference_vehicle.yaml](../../../deploy/configs/inference_vehicle.yaml) | [build_vehicle.yaml](../../../deploy/configs/build_vehicle.yaml) | -| 商品识别模型 | 商品场景 | [模型下载链接](https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/rec/models/inference/product_ResNet50_vd_aliproduct_v1.0_infer.tar) | [inference_product.yaml](../../../deploy/configs/inference_product.yaml) | [build_product.yaml](../../../deploy/configs/build_product.yaml) | -| 车辆ReID模型 | 车辆ReID场景 | [模型下载链接](https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/rec/models/inference/vehicle_reid_ResNet50_VERIWild_v1.0_infer.tar) | - | - | - -轻量级通用主体检测模型与轻量级通用识别模型: +轻量级通用主体检测模型与轻量级通用识别模型和配置文件下载方式如下表所示。 | 模型简介 | 推荐场景 | inference模型 | 预测配置文件 | 构建索引库的配置文件 | | ------------ | ------------- | -------- | ------- | -------- | | 轻量级通用主体检测模型 | 通用场景 |[模型下载链接](https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/rec/models/inference/picodet_PPLCNet_x2_5_mainbody_lite_v1.0_infer.tar) | - | - | | 轻量级通用识别模型 | 通用场景 | [模型下载链接](https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/rec/models/inference/general_PPLCNet_x2_5_lite_v1.0_infer.tar) | [inference_product.yaml](../../../deploy/configs/inference_product.yaml) | [build_product.yaml](../../../deploy/configs/build_product.yaml) | -本章节 demo 数据下载地址如下: [数据下载链接](https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/rec/data/recognition_demo_data_v1.1.tar)。 +本章节 demo 数据下载地址如下: [瓶装饮料数据下载链接](https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/rec/data/drink_dataset_v1.0.tar)。 + + +如果希望体验服务端主体检测和各垂类方向的识别模型,可以参考[第4章](#4)。 + **注意** @@ -87,47 +79,42 @@ wget {数据下载链接地址} && tar -xf {压缩包的名称} ### 2.1 下载、解压 inference 模型与 demo 数据 -以商品识别为例,下载 demo 数据集以及通用检测、识别模型,命令如下。 +下载 demo 数据集以及轻量级主体检测、识别模型,命令如下。 ```shell mkdir models cd models # 下载通用检测 inference 模型并解压 -wget https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/rec/models/inference/ppyolov2_r50vd_dcn_mainbody_v1.0_infer.tar && tar -xf ppyolov2_r50vd_dcn_mainbody_v1.0_infer.tar +wget 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 # 下载识别 inference 模型并解压 -wget https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/rec/models/inference/product_ResNet50_vd_aliproduct_v1.0_infer.tar && tar -xf product_ResNet50_vd_aliproduct_v1.0_infer.tar +wget 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 cd ../ # 下载 demo 数据并解压 -wget https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/rec/data/recognition_demo_data_v1.1.tar && tar -xf recognition_demo_data_v1.1.tar +wget https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/rec/data/drink_dataset_v1.0.tar && tar -xf drink_dataset_v1.0.tar ``` -解压完毕后,`recognition_demo_data_v1.1` 文件夹下应有如下文件结构: +解压完毕后,`drink_dataset_v1.0/` 文件夹下应有如下文件结构: ``` -├── recognition_demo_data_v1.1 -│ ├── gallery_cartoon -│ ├── gallery_logo -│ ├── gallery_product -│ ├── gallery_vehicle -│ ├── test_cartoon -│ ├── test_logo -│ ├── test_product -│ └── test_vehicle +├── drink_dataset_v1.0/ +│ ├── gallery/ +│ ├── index/ +│ ├── test_images/ ├── ... ``` -其中 `gallery_xxx` 文件夹中存放的是用于构建索引库的原始图像, `test_xxx` 文件夹中存放的是用于测试识别效果的图像列表。 +其中 `gallery` 文件夹中存放的是用于构建索引库的原始图像,`index` 表示基于原始图像构建得到的索引库信息, `test_images` 文件夹中存放的是用于测试识别效果的图像列表。 `models` 文件夹下应有如下文件结构: ``` -├── product_ResNet50_vd_aliproduct_v1.0_infer +├── general_PPLCNet_x2_5_lite_v1.0_infer │ ├── inference.pdiparams │ ├── inference.pdiparams.info │ └── inference.pdmodel -├── ppyolov2_r50vd_dcn_mainbody_v1.0_infer +├── picodet_PPLCNet_x2_5_mainbody_lite_v1.0_infer │ ├── inference.pdiparams │ ├── inference.pdiparams.info │ └── inference.pdmodel @@ -135,10 +122,11 @@ wget https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/rec/data/recognit **注意** -如果使用轻量级通用识别模型, Demo 数据需要重新提取特征、够建索引,方式如下: +如果使用服务端通用识别模型, Demo 数据需要重新提取特征、够建索引,方式如下: ```shell -python3.7 python/build_gallery.py -c configs/build_product.yaml -o Global.rec_inference_model_dir=./models/general_PPLCNet_x2_5_lite_v1.0_infer +# 下面是使用下载的服务端商品识别模型进行索引库构建 +python3.7 python/build_gallery.py -c configs/build_product.yaml -o Global.rec_inference_model_dir=./models/product_ResNet50_vd_aliproduct_v1.0_infer ``` @@ -158,7 +146,7 @@ pip install faiss-cpu==1.7.1post2 #### 2.2.1 识别单张图像 -运行下面的命令,对图像 `./recognition_demo_data_v1.1/test_product/daoxiangcunjinzhubing_6.jpg` 进行识别与检索 +运行下面的命令,对图像 `./drink_dataset_v1.0/test_images/nongfu_spring.jpeg` 进行识别与检索 ```shell # 使用下面的命令使用GPU进行预测 @@ -170,14 +158,14 @@ python3.7 python/predict_system.py -c configs/inference_product.yaml -o Global.u 待检索图像如下所示。