diff --git a/deploy/configs/build_inshop.yaml b/deploy/configs/build_product.yaml similarity index 90% rename from deploy/configs/build_inshop.yaml rename to deploy/configs/build_product.yaml index c2638e979ec5cac2e2b40fddcdcf6782f8922a36..987c5c0df4f80ebc048cb55f0620b846b994ef8f 100644 --- a/deploy/configs/build_inshop.yaml +++ b/deploy/configs/build_product.yaml @@ -1,5 +1,5 @@ Global: - rec_inference_model_dir: "./models/product_ResNet50_vd_Inshop_v1.0_infer" + rec_inference_model_dir: "./models/product_ResNet50_vd_aliproduct_v1.0_infer" batch_size: 1 use_gpu: True enable_mkldnn: True diff --git a/deploy/configs/inference_inshop.yaml b/deploy/configs/inference_product.yaml similarity index 90% rename from deploy/configs/inference_inshop.yaml rename to deploy/configs/inference_product.yaml index 1e7db144d1223f0c5b969d0d27f9597665f505ad..a59f5d670c0d871cbc1a60ea3f6cb506cde3a321 100644 --- a/deploy/configs/inference_inshop.yaml +++ b/deploy/configs/inference_product.yaml @@ -1,11 +1,11 @@ Global: infer_imgs: "./dataset/product_demo_data_v1.0/query" det_inference_model_dir: "./models/ppyolov2_r50vd_dcn_mainbody_v1.0_infer" - rec_inference_model_dir: "./models/product_ResNet50_vd_Inshop_v1.0_infer" + rec_inference_model_dir: "./models/product_ResNet50_vd_aliproduct_v1.0_infer" batch_size: 1 image_shape: [3, 640, 640] - threshold: 0.0 - max_det_results: 1 + threshold: 0.2 + max_det_results: 2 labe_list: - foreground diff --git a/docs/images/product/aliproduct.png b/docs/images/product/aliproduct.png new file mode 100644 index 0000000000000000000000000000000000000000..df2ea725223abd370b7f15ea8ea8abc5e3f4c6e4 Binary files /dev/null and b/docs/images/product/aliproduct.png differ diff --git a/docs/images/product/inshop.png b/docs/images/product/inshop.png new file mode 100644 index 0000000000000000000000000000000000000000..e874fdb8ec91e37948ff17e944a4e1a887f32c73 Binary files /dev/null and b/docs/images/product/inshop.png differ diff --git a/docs/zh_CN/application/product_recognition.md b/docs/zh_CN/application/product_recognition.md new file mode 100644 index 0000000000000000000000000000000000000000..33188304cfdf246608a10c362469918769f8d3a7 --- /dev/null +++ b/docs/zh_CN/application/product_recognition.md @@ -0,0 +1,70 @@ +# 商品识别 + +商品识别技术,是现如今应用非常广的一个领域。拍照购物的方式已经被很多人所采纳,无人结算台已经走入各大超市,无人超市更是如火如荼,这背后都是以商品识别技术作为支撑。商品识别技术大概是"商品检测+商品识别"这样的流程,商品检测模块负责检测出潜在的商品区域,商品识别模型负责将商品检测模块检测出的主体进行识别。识别模块多采用检索的方式,根据查询图片和底库图片进行相似度排序获得预测类别。此文档主要对商品图片的特征提取部分进行相关介绍,内容包括: + +- 数据集及预处理方式 +- Backbone的具体设置 +- Loss函数的相关设置 + + +## 1 Aliproduct + +### 1 数据集 + + + +Aliproduct数据是天池竞赛开源的一个数据集,也是目前开源的最大的商品数据集,其有5万多个标识类别,约250万训练图片。相关数据介绍参考[原论文](https://arxiv.org/abs/2008.05359)。 + +### 2 图像预处理 + +- 图像`Resize`到224x224 +- 图像`RandomFlip` +- Normlize:图像归一化 + +### 3 Backbone的具体设置 + +具体是用`ResNet50_vd`作为backbone,主要做了如下修改: + + - 使用ImageNet预训练模型 + + - 在GAP后、分类层前加入一个512维的embedding FC层,没有做BatchNorm和激活。 + + +### 4 Loss的设置 + +在Aliproduct商品识别中,使用了[CELoss](../../../ppcls/loss/celoss.py)训练, 为了获得更加鲁棒的特征,后续会使用其他Loss参与训练,敬请期待。 + +全部的超参数及具体配置:[ResNet50_vd_Aliproduct.yaml](../../../ppcls/configs/Products/ResNet50_vd_Aliproduct.yaml) + + +## 2 Inshop + +### 1 数据集 + + + +Inshop数据集是DeepFashion的子集,其是香港中文大学开放的一个large-scale服装数据集,Inshop数据集是其中服装检索数据集,涵盖了大量买家秀的服装。相关数据介绍参考[原论文](https://openaccess.thecvf.com/content_cvpr_2016/papers/Liu_DeepFashion_Powering_Robust_CVPR_2016_paper.pdf)。 + +### 2 图像预处理 + +数据增强是训练大规模 +- 图像`Resize`到224x224 +- 图像`RandomFlip` +- Normlize:图像归一化 +- [RandomErasing](https://arxiv.org/pdf/1708.04896v2.pdf) + +### 3 Backbone的具体设置 + +具体是用`ResNet50_vd`作为backbone,主要做了如下修改: + + - 使用ImageNet预训练模型 + + - 在GAP后、分类层前加入一个512维的embedding FC层,没有做BatchNorm和激活。 + + - 分类层采用[Arcmargin Head](../../../ppcls/arch/gears/arcmargin.py),具体原理可参考[原论文](https://arxiv.org/pdf/1801.07698.pdf)。 + +### 4 Loss的设置 + +在Inshop商品识别中,使用了[CELoss](../../../ppcls/loss/celoss.py)和[TripletLossV2](../../../ppcls/loss/triplet.py)联合训练。 + +全部的超参数及具体配置:[ResNet50_vd_Inshop.yaml](../../../ppcls/configs/Products/ResNet50_vd_Inshop.yaml) diff --git a/docs/zh_CN/tutorials/quick_start_recognition.md b/docs/zh_CN/tutorials/quick_start_recognition.md index c021549607e7c9e4ca8c9271200878d143563e85..df89fe5d33063425c6fc51f436ec28b3e14ba86d 100644 --- a/docs/zh_CN/tutorials/quick_start_recognition.md +++ b/docs/zh_CN/tutorials/quick_start_recognition.md @@ -39,7 +39,7 @@ | Logo识别模型 | Logo场景 | [数据下载链接](https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/rec/data/logo_demo_data_v1.0.tar) | [模型下载链接](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/data/cartoon_demo_data_v1.0.tar) | [模型下载链接](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/data/vehicle_demo_data_v1.0.tar) | [模型下载链接](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/data/product_demo_data_v1.0.tar) | [模型下载链接](https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/rec/models/inference/product_ResNet50_vd_Inshop_v1.0_infer.tar) | [inference_inshop.yaml](../../../deploy/configs/) | [build_inshop.yaml](../../../deploy/configs/build_inshop.yaml) | +| 商品识别模型 | 商品场景 | [数据下载链接](https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/rec/data/product_demo_data_v1.0.tar) | [模型下载链接](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) | **注意**:windows 环境下如果没有安装wget,下载模型时可将链接复制到浏览器中下载,并解压放置在相应目录下;linux或者macOS用户可以右键点击,然后复制下载链接,即可通过`wget`命令下载。