Merge pull request #2014 from cuicheng01/update_person_attribute
Update person_attribute code and docspull/2022/head
commit
a00291fec2
|
@ -0,0 +1,32 @@
|
|||
Global:
|
||||
infer_imgs: "./images/PULC/person_attribute/090004.jpg"
|
||||
inference_model_dir: "./models/person_attribute_infer"
|
||||
batch_size: 1
|
||||
use_gpu: True
|
||||
enable_mkldnn: True
|
||||
cpu_num_threads: 10
|
||||
benchmark: False
|
||||
use_fp16: False
|
||||
ir_optim: True
|
||||
use_tensorrt: False
|
||||
gpu_mem: 8000
|
||||
enable_profile: False
|
||||
|
||||
PreProcess:
|
||||
transform_ops:
|
||||
- ResizeImage:
|
||||
size: [192, 256]
|
||||
- NormalizeImage:
|
||||
scale: 1.0/255.0
|
||||
mean: [0.485, 0.456, 0.406]
|
||||
std: [0.229, 0.224, 0.225]
|
||||
order: ''
|
||||
channel_num: 3
|
||||
- ToCHWImage:
|
||||
|
||||
PostProcess:
|
||||
main_indicator: PersonAttribute
|
||||
PersonAttribute:
|
||||
threshold: 0.5 #default threshold
|
||||
glasses_threshold: 0.3 #threshold only for glasses
|
||||
hold_threshold: 0.6 #threshold only for hold
|
|
@ -25,8 +25,8 @@ PreProcess:
|
|||
- ToCHWImage:
|
||||
|
||||
PostProcess:
|
||||
main_indicator: Attribute
|
||||
Attribute:
|
||||
main_indicator: PersonAttribute
|
||||
PersonAttribute:
|
||||
threshold: 0.5 #default threshold
|
||||
glasses_threshold: 0.3 #threshold only for glasses
|
||||
hold_threshold: 0.6 #threshold only for hold
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 2.4 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.8 KiB |
|
@ -189,7 +189,7 @@ class Binarize(object):
|
|||
return byte
|
||||
|
||||
|
||||
class Attribute(object):
|
||||
class PersonAttribute(object):
|
||||
def __init__(self,
|
||||
threshold=0.5,
|
||||
glasses_threshold=0.3,
|
||||
|
@ -277,8 +277,7 @@ class Attribute(object):
|
|||
threshold_list[18] = self.hold_threshold
|
||||
pred_res = (np.array(res) > np.array(threshold_list)
|
||||
).astype(np.int8).tolist()
|
||||
|
||||
batch_res.append([label_res, pred_res])
|
||||
batch_res.append({"attributes": label_res, "output": pred_res})
|
||||
return batch_res
|
||||
|
||||
|
||||
|
|
|
@ -138,7 +138,7 @@ def main(config):
|
|||
continue
|
||||
batch_results = cls_predictor.predict(batch_imgs)
|
||||
for number, result_dict in enumerate(batch_results):
|
||||
if "Attribute" in config[
|
||||
if "PersonAttribute" in config[
|
||||
"PostProcess"] or "VehicleAttribute" in config[
|
||||
"PostProcess"]:
|
||||
filename = batch_names[number]
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 574 KiB |
|
@ -0,0 +1,431 @@
|
|||
# PULC 人体属性识别模型
|
||||
|
||||
------
|
||||
|
||||
|
||||
## 目录
|
||||
|
||||
- [1. 模型和应用场景介绍](#1)
|
||||
- [2. 模型快速体验](#2)
|
||||
- [3. 模型训练、评估和预测](#3)
|
||||
- [3.1 环境配置](#3.1)
|
||||
- [3.2 数据准备](#3.2)
|
||||
- [3.2.1 数据集来源](#3.2.1)
|
||||
- [3.2.2 数据集获取](#3.2.2)
|
||||
- [3.3 模型训练](#3.3)
|
||||
- [3.4 模型评估](#3.4)
|
||||
- [3.5 模型预测](#3.5)
|
||||
- [4. 模型压缩](#4)
|
||||
- [4.1 SKL-UGI 知识蒸馏](#4.1)
|
||||
- [4.1.1 教师模型训练](#4.1.1)
|
||||
- [4.1.2 蒸馏训练](#4.1.2)
|
||||
- [5. 超参搜索](#5)
|
||||
- [6. 模型推理部署](#6)
|
||||
- [6.1 推理模型准备](#6.1)
|
||||
- [6.1.1 基于训练得到的权重导出 inference 模型](#6.1.1)
|
||||
- [6.1.2 直接下载 inference 模型](#6.1.2)
|
||||
- [6.2 基于 Python 预测引擎推理](#6.2)
|
||||
- [6.2.1 预测单张图像](#6.2.1)
|
||||
- [6.2.2 基于文件夹的批量预测](#6.2.2)
|
||||
- [6.3 基于 C++ 预测引擎推理](#6.3)
|
||||
- [6.4 服务化部署](#6.4)
|
||||
- [6.5 端侧部署](#6.5)
|
||||
- [6.6 Paddle2ONNX 模型转换与预测](#6.6)
|
||||
|
||||
|
||||
<a name="1"></a>
|
||||
|
||||
## 1. 模型和应用场景介绍
|
||||
|
||||
该案例提供了用户使用 PaddleClas 的超轻量图像分类方案(PULC,Practical Ultra Lightweight Classification)快速构建轻量级、高精度、可落地的人体属性识别模型。该模型可以广泛应用于行人分析、行人跟踪等场景。
|
||||
|
||||
下表列出了不同人体属性识别模型的相关指标,前两行展现了使用 SwinTransformer_tiny、Res2Net200_vd_26w_4s 和 MobileNetV3_small_x0_35 作为 backbone 训练得到的模型的相关指标,第三行至第六行依次展现了替换 backbone 为 PPLCNet_x1_0、使用 SSLD 预训练模型、使用 SSLD 预训练模型 + EDA 策略、使用 SSLD 预训练模型 + EDA 策略 + SKL-UGI 知识蒸馏策略训练得到的模型的相关指标。
|
||||
|
||||
|
||||
| 模型 | ma(%) | 延时(ms) | 存储(M) | 策略 |
|
||||
|-------|-----------|----------|---------------|---------------|
|
||||
| Res2Net200_vd_26w_4s | 81.25 | 77.51 | 293 | 使用ImageNet预训练模型 |
|
||||
| SwinTransformer_tiny | 80.17 | 89.51 | 107 | 使用ImageNet预训练模型 |
|
||||
| MobileNetV3_small_x0_35 | 70.79 | 2.90 | 1.7 | 使用ImageNet预训练模型 |
|
||||
| PPLCNet_x1_0 | 76.31 | 2.01 | 6.6 | 使用ImageNet预训练模型 |
|
||||
| PPLCNet_x1_0 | 77.31 | 2.01 | 6.6 | 使用SSLD预训练模型 |
|
||||
| PPLCNet_x1_0 | 77.71 | 2.01 | 6.6 | 使用SSLD预训练模型+EDA策略|
|
||||
| <b>PPLCNet_x1_0<b> | <b>78.59<b> | <b>2.01<b> | <b>6.6<b> | 使用SSLD预训练模型+EDA策略+SKL-UGI知识蒸馏策略|
|
||||
|
||||
从表中可以看出,backbone 为 Res2Net200_vd_26w_4s 和 SwinTransformer_tiny 时精度较高,但是推理速度较慢。将 backbone 替换为轻量级模型 MobileNetV3_small_x0_35 后,速度可以大幅提升,但是精度也大幅下降。将 backbone 替换为 PPLCNet_x1_0 时,精度较 MobileNetV3_small_x0_35 高 5.5%,于此同时,速度更快。在此基础上,使用 SSLD 预训练模型后,在不改变推理速度的前提下,精度可以提升 1%,进一步地,当融合EDA策略后,精度可以再提升 0.4%,最后,在使用 SKL-UGI 知识蒸馏后,精度可以继续提升 0.88%。此时,PPLCNet_x1_0 的精度与 SwinTransformer_tiny 仅相差1.58%,但是速度快 44 倍。关于 PULC 的训练方法和推理部署方法将在下面详细介绍。
|
||||
|
||||
**备注:**
|
||||
|
||||
* 关于PPLCNet的介绍可以参考[PPLCNet介绍](../models/PP-LCNet.md),相关论文可以查阅[PPLCNet paper](https://arxiv.org/abs/2109.15099)。
|
||||
|
||||
|
||||
<a name="2"></a>
|
||||
|
||||
## 2. 模型快速体验
|
||||
|
||||
<a name="2"></a>
|
||||
|
||||
## 2. 模型快速体验
|
||||
|
||||
<a name="2.1"></a>
|
||||
|
||||
### 2.1 安装 paddleclas
|
||||
|
||||
使用如下命令快速安装 paddlepaddle, paddleclas
|
||||
|
||||
```
|
||||
pip3 install paddlepaddle paddleclas
|
||||
```
|
||||
<a name="2.2"></a>
|
||||
|
||||
### 2.2 预测
|
||||
|
||||
* 使用命令行快速预测
|
||||
|
||||
```bash
|
||||
paddleclas --model_name=person_attribute --infer_imgs=deploy/images/PULC/person_attribute/090004.jpg
|
||||
```
|
||||
|
||||
结果如下:
|
||||
```
|
||||
>>> result
|
||||
待补充
|
||||
```
|
||||
|
||||
**备注**: 更换其他预测的数据时,只需要改变 `--infer_imgs=xx` 中的字段即可,支持传入整个文件夹。
|
||||
|
||||
|
||||
* 在 Python 代码中预测
|
||||
```python
|
||||
import paddleclas
|
||||
model = paddleclas.PaddleClas(model_name="person_attribute")
|
||||
result = model.predict(input_data="deploy/images/PULC/person_attribute/090004.jpg")
|
||||
print(next(result))
|
||||
```
|
||||
|
||||
**备注**:`model.predict()` 为可迭代对象(`generator`),因此需要使用 `next()` 函数或 `for` 循环对其迭代调用。每次调用将以 `batch_size` 为单位进行一次预测,并返回预测结果, 默认 `batch_size` 为 1,如果需要更改 `batch_size`,实例化模型时,需要指定 `batch_size`,如 `model = paddleclas.PaddleClas(model_name="person_attribute", batch_size=2)`, 使用默认的代码返回结果示例如下:
|
||||
|
||||
```
|
||||
>>> result
|
||||
待补充
|
||||
```
|
||||
|
||||
<a name="3"></a>
|
||||
|
||||
## 3. 模型训练、评估和预测
|
||||
|
||||
<a name="3.1"></a>
|
||||
|
||||
### 3.1 环境配置
|
||||
|
||||
* 安装:请先参考文档 [环境准备](../installation/install_paddleclas.md) 配置 PaddleClas 运行环境。
|
||||
|
||||
<a name="3.2"></a>
|
||||
|
||||
### 3.2 数据准备
|
||||
|
||||
<a name="3.2.1"></a>
|
||||
|
||||
#### 3.2.1 数据集来源
|
||||
|
||||
本案例中所使用的数据为[pa100k 数据集](https://www.v7labs.com/open-datasets/pa-100k)。
|
||||
|
||||
<a name="3.2.2"></a>
|
||||
|
||||
#### 3.2.2 数据集获取
|
||||
|
||||
部分数据可视化如下所示。
|
||||
|
||||
<div align="center">
|
||||
<img src="../../images/PULC/docs/person_attribute_data_demo.png" width = "500" />
|
||||
</div>
|
||||
|
||||
|
||||
我们将原始数据转换成了 PaddleClas 多标签可读的数据格式,可以直接下载。
|
||||
|
||||
进入 PaddleClas 目录。
|
||||
|
||||
```
|
||||
cd path_to_PaddleClas
|
||||
```
|
||||
|
||||
进入 `dataset/` 目录,下载并解压有人/无人场景的数据。
|
||||
|
||||
```shell
|
||||
cd dataset
|
||||
wget https://paddleclas.bj.bcebos.com/data/PULC/pa100k.tar
|
||||
tar -xf pa100k.tar
|
||||
cd ../
|
||||
```
|
||||
|
||||
执行上述命令后,`dataset/` 下存在 `pa100k` 目录,该目录中具有以下数据:
|
||||
|
||||
|
||||
执行上述命令后,`pa100k`目录中具有以下数据:
|
||||
|
||||
```
|
||||
pa100k
|
||||
├── train
|
||||
│ ├── 000001.jpg
|
||||
│ ├── 000002.jpg
|
||||
...
|
||||
├── val
|
||||
│ ├── 080001.jpg
|
||||
│ ├── 080002.jpg
|
||||
...
|
||||
├── test
|
||||
│ ├── 090001.jpg
|
||||
│ ├── 090002.jpg
|
||||
...
|
||||
...
|
||||
├── train_list.txt
|
||||
├── train_val_list.txt
|
||||
├── val_list.txt
|
||||
├── test_list.txt
|
||||
```
|
||||
|
||||
其中`train/`、`val/`、`test/`分别为训练集、验证集和测试集。`train_list.txt`、`val_list.txt`、`test_list.txt`分别为训练集、验证集、测试集的标签文件。在本例子中,`test_list.txt`暂时没有使用。
|
||||
|
||||
|
||||
<a name="3.3"></a>
|
||||
|
||||
### 3.3 模型训练
|
||||
|
||||
|
||||
在 `ppcls/configs/PULC/person_attribute/PPLCNet_x1_0.yaml` 中提供了基于该场景的训练配置,可以通过如下脚本启动训练:
|
||||
|
||||
```shell
|
||||
export CUDA_VISIBLE_DEVICES=0,1,2,3
|
||||
python3 -m paddle.distributed.launch \
|
||||
--gpus="0,1,2,3" \
|
||||
tools/train.py \
|
||||
-c ./ppcls/configs/PULC/person_attribute/PPLCNet_x1_0.yaml
|
||||
```
|
||||
|
||||
验证集的最佳指标在 `90.07%` 左右(数据集较小,一般有0.3%左右的波动)。
|
||||
|
||||
|
||||
<a name="3.4"></a>
|
||||
|
||||
### 3.4 模型评估
|
||||
|
||||
训练好模型之后,可以通过以下命令实现对模型指标的评估。
|
||||
|
||||
```bash
|
||||
python3 tools/eval.py \
|
||||
-c ./ppcls/configs/PULC/person_attribute/PPLCNet_x1_0.yaml \
|
||||
-o Global.pretrained_model="output/PPLCNet_x1_0/best_model"
|
||||
```
|
||||
|
||||
其中 `-o Global.pretrained_model="output/PPLCNet_x1_0/best_model"` 指定了当前最佳权重所在的路径,如果指定其他权重,只需替换对应的路径即可。
|
||||
|
||||
<a name="3.5"></a>
|
||||
|
||||
### 3.5 模型预测
|
||||
|
||||
模型训练完成之后,可以加载训练得到的预训练模型,进行模型预测。在模型库的 `tools/infer.py` 中提供了完整的示例,只需执行下述命令即可完成模型预测:
|
||||
|
||||
```bash
|
||||
python3 tools/infer.py \
|
||||
-c ./ppcls/configs/PULC/person_attribute/PPLCNet_x1_0.yaml \
|
||||
-o Global.pretrained_model=output/PPLCNet_x1_0/best_model
|
||||
```
|
||||
|
||||
输出结果如下:
|
||||
|
||||
```
|
||||
[{'attributes': ['Male', 'Age18-60', 'Back', 'Glasses: False', 'Hat: False', 'HoldObjectsInFront: False', 'Backpack', 'Upper: LongSleeve UpperPlaid', 'Lower: Trousers', 'No boots'], 'output': [0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1]}]
|
||||
```
|
||||
|
||||
**备注:**
|
||||
|
||||
* 这里`-o Global.pretrained_model="output/PPLCNet_x1_0/best_model"` 指定了当前最佳权重所在的路径,如果指定其他权重,只需替换对应的路径即可。
|
||||
|
||||
* 默认是对 `deploy/images/PULC/person_attribute/090004.jpg` 进行预测,此处也可以通过增加字段 `-o Infer.infer_imgs=xxx` 对其他图片预测。
|
||||
|
||||
<a name="4"></a>
|
||||
|
||||
## 4. 模型压缩
|
||||
|
||||
<a name="4.1"></a>
|
||||
|
||||
### 4.1 SKL-UGI 知识蒸馏
|
||||
|
||||
SKL-UGI 知识蒸馏是 PaddleClas 提出的一种简单有效的知识蒸馏方法,关于该方法的介绍,可以参考[SKL-UGI 知识蒸馏](@ruoyu)。
|
||||
|
||||
<a name="4.1.1"></a>
|
||||
|
||||
#### 4.1.1 教师模型训练
|
||||
|
||||
复用 `ppcls/configs/PULC/person_attribute/PPLCNet_x1_0.yaml` 中的超参数,训练教师模型,训练脚本如下:
|
||||
|
||||
```shell
|
||||
export CUDA_VISIBLE_DEVICES=0,1,2,3
|
||||
python3 -m paddle.distributed.launch \
|
||||
--gpus="0,1,2,3" \
|
||||
tools/train.py \
|
||||
-c ./ppcls/configs/PULC/person_attribute/PPLCNet_x1_0.yaml \
|
||||
-o Arch.name=ResNet101_vd
|
||||
```
|
||||
|
||||
验证集的最佳指标为 `80.10%` 左右,当前教师模型最好的权重保存在 `output/ResNet101_vd/best_model.pdparams`。
|
||||
|
||||
<a name="4.1.2"></a>
|
||||
|
||||
#### 4.1.2 蒸馏训练
|
||||
|
||||
配置文件`ppcls/configs/PULC/person_attribute/PPLCNet_x1_0_Distillation.yaml`提供了`SKL-UGI知识蒸馏策略`的配置。该配置将`ResNet101_vd`当作教师模型,`PPLCNet_x1_0`当作学生模型。训练脚本如下:
|
||||
|
||||
```shell
|
||||
export CUDA_VISIBLE_DEVICES=0,1,2,3
|
||||
python3 -m paddle.distributed.launch \
|
||||
--gpus="0,1,2,3" \
|
||||
tools/train.py \
|
||||
-c ./ppcls/configs/PULC/person_attribute/PPLCNet_x1_0_Distillation.yaml \
|
||||
-o Arch.models.0.Teacher.pretrained=output/ResNet101_vd/best_model
|
||||
```
|
||||
|
||||
验证集的最佳指标为 `78.5%` 左右,当前模型最好的权重保存在 `output/DistillationModel/best_model_student.pdparams`。
|
||||
|
||||
|
||||
<a name="5"></a>
|
||||
|
||||
## 5. 超参搜索
|
||||
|
||||
在 [3.2 节](#3.2)和 [4.1 节](#4.1)所使用的超参数是根据 PaddleClas 提供的 `SHAS 超参数搜索策略` 搜索得到的,如果希望在自己的数据集上得到更好的结果,可以参考[SHAS 超参数搜索策略](#TODO)来获得更好的训练超参数。
|
||||
|
||||
**备注:** 此部分内容是可选内容,搜索过程需要较长的时间,您可以根据自己的硬件情况来选择执行。如果没有更换数据集,可以忽略此节内容。
|
||||
|
||||
<a name="6"></a>
|
||||
|
||||
## 6. 模型推理部署
|
||||
|
||||
<a name="6.1"></a>
|
||||
|
||||
### 6.1 推理模型准备
|
||||
|
||||
Paddle Inference 是飞桨的原生推理库, 作用于服务器端和云端,提供高性能的推理能力。相比于直接基于预训练模型进行预测,Paddle Inference可使用MKLDNN、CUDNN、TensorRT 进行预测加速,从而实现更优的推理性能。更多关于Paddle Inference推理引擎的介绍,可以参考[Paddle Inference官网教程](https://www.paddlepaddle.org.cn/documentation/docs/zh/guides/infer/inference/inference_cn.html)。
|
||||
|
||||
当使用 Paddle Inference 推理时,加载的模型类型为 inference 模型。本案例提供了两种获得 inference 模型的方法,如果希望得到和文档相同的结果,请选择[直接下载 inference 模型](#6.1.2)的方式。
|
||||
|
||||
<a name="6.1.1"></a>
|
||||
|
||||
### 6.1.1 基于训练得到的权重导出 inference 模型
|
||||
|
||||
此处,我们提供了将权重和模型转换的脚本,执行该脚本可以得到对应的 inference 模型:
|
||||
|
||||
```bash
|
||||
python3 tools/export_model.py \
|
||||
-c ./ppcls/configs/PULC/person_attribute/PPLCNet_x1_0.yaml \
|
||||
-o Global.pretrained_model=output/DistillationModel/best_model_student \
|
||||
-o Global.save_inference_dir=deploy/models/PPLCNet_x1_0_person_attribute_infer
|
||||
```
|
||||
执行完该脚本后会在 `deploy/models/` 下生成 `PPLCNet_x1_0_person_attribute_infer` 文件夹,`models` 文件夹下应有如下文件结构:
|
||||
|
||||
```
|
||||
├── PPLCNet_x1_0_person_attribute_infer
|
||||
│ ├── inference.pdiparams
|
||||
│ ├── inference.pdiparams.info
|
||||
│ └── inference.pdmodel
|
||||
```
|
||||
|
||||
**备注:** 此处的最佳权重是经过知识蒸馏后的权重路径,如果没有执行知识蒸馏的步骤,最佳模型保存在`output/PPLCNet_x1_0/best_model.pdparams`中。
|
||||
|
||||
<a name="6.1.2"></a>
|
||||
|
||||
### 6.1.2 直接下载 inference 模型
|
||||
|
||||
[6.1.1 小节](#6.1.1)提供了导出 inference 模型的方法,此处也提供了该场景可以下载的 inference 模型,可以直接下载体验。
|
||||
|
||||
```
|
||||
cd deploy/models
|
||||
# 下载 inference 模型并解压
|
||||
wget https://paddleclas.bj.bcebos.com/models/PULC/person_attribute_infer.tar && tar -xf person_attribute_infer.tar
|
||||
```
|
||||
|
||||
解压完毕后,`models` 文件夹下应有如下文件结构:
|
||||
|
||||
```
|
||||
├── person_attribute_infer
|
||||
│ ├── inference.pdiparams
|
||||
│ ├── inference.pdiparams.info
|
||||
│ └── inference.pdmodel
|
||||
```
|
||||
|
||||
<a name="6.2"></a>
|
||||
|
||||
### 6.2 基于 Python 预测引擎推理
|
||||
|
||||
|
||||
<a name="6.2.1"></a>
|
||||
|
||||
#### 6.2.1 预测单张图像
|
||||
|
||||
返回 `deploy` 目录:
|
||||
|
||||
```
|
||||
cd ../
|
||||
```
|
||||
|
||||
运行下面的命令,对图像 `./images/PULC/person_attribute/090004.jpg` 进行车辆属性识别。
|
||||
|
||||
```shell
|
||||
# 使用下面的命令使用 GPU 进行预测
|
||||
python3.7 python/predict_cls.py -c configs/PULC/person_attribute/inference_person_attribute.yaml -o Global.use_gpu=True
|
||||
# 使用下面的命令使用 CPU 进行预测
|
||||
python3.7 python/predict_cls.py -c configs/PULC/person_attribute/inference_person_attribute.yaml -o Global.use_gpu=False
|
||||
```
|
||||
|
||||
输出结果如下。
|
||||
|
||||
```
|
||||
090004.jpg: {'attributes': ['Male', 'Age18-60', 'Back', 'Glasses: False', 'Hat: False', 'HoldObjectsInFront: False', 'Backpack', 'Upper: LongSleeve UpperPlaid', 'Lower: Trousers', 'No boots'], 'output': [0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1]}
|
||||
```
|
||||
|
||||
<a name="6.2.2"></a>
|
||||
|
||||
#### 6.2.2 基于文件夹的批量预测
|
||||
|
||||
如果希望预测文件夹内的图像,可以直接修改配置文件中的 `Global.infer_imgs` 字段,也可以通过下面的 `-o` 参数修改对应的配置。
|
||||
|
||||
```shell
|
||||
# 使用下面的命令使用 GPU 进行预测,如果希望使用 CPU 预测,可以在命令后面添加 -o Global.use_gpu=False
|
||||
python3.7 python/predict_cls.py -c configs/PULC/person_attribute/inference_person_attribute.yaml -o Global.infer_imgs="./images/PULC/person_attribute/"
|
||||
```
|
||||
|
||||
终端中会输出该文件夹内所有图像的属性识别结果,如下所示。
|
||||
|
||||
```
|
||||
090004.jpg: {'attributes': ['Male', 'Age18-60', 'Back', 'Glasses: False', 'Hat: False', 'HoldObjectsInFront: False', 'Backpack', 'Upper: LongSleeve UpperPlaid', 'Lower: Trousers', 'No boots'], 'output': [0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1]}
|
||||
090007.jpg: {'attributes': ['Female', 'Age18-60', 'Side', 'Glasses: False', 'Hat: False', 'HoldObjectsInFront: False', 'No bag', 'Upper: ShortSleeve', 'Lower: Skirt&Dress', 'No boots'], 'output': [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0]}
|
||||
```
|
||||
|
||||
<a name="6.3"></a>
|
||||
|
||||
### 6.3 基于 C++ 预测引擎推理
|
||||
|
||||
PaddleClas 提供了基于 C++ 预测引擎推理的示例,您可以参考[服务器端 C++ 预测](../inference_deployment/cpp_deploy.md)来完成相应的推理部署。如果您使用的是 Windows 平台,可以参考[基于 Visual Studio 2019 Community CMake 编译指南](../inference_deployment/cpp_deploy_on_windows.md)完成相应的预测库编译和模型预测工作。
|
||||
|
||||
<a name="6.4"></a>
|
||||
|
||||
### 6.4 服务化部署
|
||||
|
||||
Paddle Serving 提供高性能、灵活易用的工业级在线推理服务。Paddle Serving 支持 RESTful、gRPC、bRPC 等多种协议,提供多种异构硬件和多种操作系统环境下推理解决方案。更多关于Paddle Serving 的介绍,可以参考[Paddle Serving 代码仓库](https://github.com/PaddlePaddle/Serving)。
|
||||
|
||||
PaddleClas 提供了基于 Paddle Serving 来完成模型服务化部署的示例,您可以参考[模型服务化部署](../inference_deployment/paddle_serving_deploy.md)来完成相应的部署工作。
|
||||
|
||||
<a name="6.5"></a>
|
||||
|
||||
### 6.5 端侧部署
|
||||
|
||||
Paddle Lite 是一个高性能、轻量级、灵活性强且易于扩展的深度学习推理框架,定位于支持包括移动端、嵌入式以及服务器端在内的多硬件平台。更多关于 Paddle Lite 的介绍,可以参考[Paddle Lite 代码仓库](https://github.com/PaddlePaddle/Paddle-Lite)。
|
||||
|
||||
PaddleClas 提供了基于 Paddle Lite 来完成模型端侧部署的示例,您可以参考[端侧部署](../inference_deployment/paddle_lite_deploy.md)来完成相应的部署工作。
|
||||
|
||||
<a name="6.6"></a>
|
||||
|
||||
### 6.6 Paddle2ONNX 模型转换与预测
|
||||
|
||||
Paddle2ONNX 支持将 PaddlePaddle 模型格式转化到 ONNX 模型格式。通过 ONNX 可以完成将 Paddle 模型到多种推理引擎的部署,包括TensorRT/OpenVINO/MNN/TNN/NCNN,以及其它对 ONNX 开源格式进行支持的推理引擎或硬件。更多关于 Paddle2ONNX 的介绍,可以参考[Paddle2ONNX 代码仓库](https://github.com/PaddlePaddle/Paddle2ONNX)。
|
||||
|
||||
PaddleClas 提供了基于 Paddle2ONNX 来完成 inference 模型转换 ONNX 模型并作推理预测的示例,您可以参考[Paddle2ONNX 模型转换与预测](@shuilong)来完成相应的部署工作。
|
|
@ -4,11 +4,11 @@ Global:
|
|||
pretrained_model: null
|
||||
output_dir: "./output/"
|
||||
device: "gpu"
|
||||
save_interval: 5
|
||||
save_interval: 1
|
||||
eval_during_train: True
|
||||
eval_interval: 1
|
||||
epochs: 20
|
||||
print_batch_step: 20
|
||||
print_batch_step: 10
|
||||
use_visualdl: False
|
||||
# used for static mode and model export
|
||||
image_shape: [3, 256, 192]
|
||||
|
@ -17,7 +17,7 @@ Global:
|
|||
|
||||
# model architecture
|
||||
Arch:
|
||||
name: "MobileNetV3_large_x1_0"
|
||||
name: "MobileNetV3_small_x0_35"
|
||||
pretrained: True
|
||||
class_num: 26
|
||||
|
||||
|
@ -52,7 +52,7 @@ DataLoader:
|
|||
dataset:
|
||||
name: MultiLabelDataset
|
||||
image_root: "dataset/pa100k/"
|
||||
cls_label_path: "dataset/pa100k/train_val_list.txt"
|
||||
cls_label_path: "dataset/pa100k/train_list.txt"
|
||||
label_ratio: True
|
||||
transform_ops:
|
||||
- DecodeImage:
|
||||
|
@ -85,7 +85,7 @@ DataLoader:
|
|||
dataset:
|
||||
name: MultiLabelDataset
|
||||
image_root: "dataset/pa100k/"
|
||||
cls_label_path: "dataset/pa100k/test_list.txt"
|
||||
cls_label_path: "dataset/pa100k/val_list.txt"
|
||||
label_ratio: True
|
||||
transform_ops:
|
||||
- DecodeImage:
|
||||
|
@ -107,6 +107,26 @@ DataLoader:
|
|||
num_workers: 4
|
||||
use_shared_memory: True
|
||||
|
||||
Infer:
|
||||
infer_imgs: deploy/images/PULC/person_attribute/090004.jpg
|
||||
batch_size: 10
|
||||
transforms:
|
||||
- DecodeImage:
|
||||
to_rgb: True
|
||||
channel_first: False
|
||||
- ResizeImage:
|
||||
size: [192, 256]
|
||||
- NormalizeImage:
|
||||
scale: 1.0/255.0
|
||||
mean: [0.485, 0.456, 0.406]
|
||||
std: [0.229, 0.224, 0.225]
|
||||
order: ''
|
||||
- ToCHWImage:
|
||||
PostProcess:
|
||||
name: PersonAttribute
|
||||
threshold: 0.5 #default threshold
|
||||
glasses_threshold: 0.3 #threshold only for glasses
|
||||
hold_threshold: 0.6 #threshold only for hold
|
||||
|
||||
Metric:
|
||||
Eval:
|
|
@ -53,7 +53,7 @@ DataLoader:
|
|||
dataset:
|
||||
name: MultiLabelDataset
|
||||
image_root: "dataset/pa100k/"
|
||||
cls_label_path: "dataset/pa100k/train_val_list.txt"
|
||||
cls_label_path: "dataset/pa100k/train_list.txt"
|
||||
label_ratio: True
|
||||
transform_ops:
|
||||
- DecodeImage:
|
||||
|
@ -99,7 +99,7 @@ DataLoader:
|
|||
dataset:
|
||||
name: MultiLabelDataset
|
||||
image_root: "dataset/pa100k/"
|
||||
cls_label_path: "dataset/pa100k/test_list.txt"
|
||||
cls_label_path: "dataset/pa100k/val_list.txt"
|
||||
label_ratio: True
|
||||
transform_ops:
|
||||
- DecodeImage:
|
||||
|
@ -121,6 +121,26 @@ DataLoader:
|
|||
num_workers: 4
|
||||
use_shared_memory: True
|
||||
|
||||
Infer:
|
||||
infer_imgs: deploy/images/PULC/person_attribute/090004.jpg
|
||||
batch_size: 10
|
||||
transforms:
|
||||
- DecodeImage:
|
||||
to_rgb: True
|
||||
channel_first: False
|
||||
- ResizeImage:
|
||||
size: [192, 256]
|
||||
- NormalizeImage:
|
||||
scale: 1.0/255.0
|
||||
mean: [0.485, 0.456, 0.406]
|
||||
std: [0.229, 0.224, 0.225]
|
||||
order: ''
|
||||
- ToCHWImage:
|
||||
PostProcess:
|
||||
name: PersonAttribute
|
||||
threshold: 0.5 #default threshold
|
||||
glasses_threshold: 0.3 #threshold only for glasses
|
||||
hold_threshold: 0.6 #threshold only for hold
|
||||
|
||||
Metric:
|
||||
Eval:
|
||||
|
|
|
@ -72,14 +72,13 @@ Optimizer:
|
|||
coeff: 0.0005
|
||||
|
||||
|
||||
# data loader for train and eval
|
||||
# data loader for train and eval
|
||||
DataLoader:
|
||||
Train:
|
||||
dataset:
|
||||
name: MultiLabelDataset
|
||||
image_root: "dataset/pa100k/"
|
||||
cls_label_path: "dataset/pa100k/train_val_list.txt"
|
||||
cls_label_path: "dataset/pa100k/train_list.txt"
|
||||
label_ratio: True
|
||||
transform_ops:
|
||||
- DecodeImage:
|
||||
|
@ -125,7 +124,7 @@ DataLoader:
|
|||
dataset:
|
||||
name: MultiLabelDataset
|
||||
image_root: "dataset/pa100k/"
|
||||
cls_label_path: "dataset/pa100k/test_list.txt"
|
||||
cls_label_path: "dataset/pa100k/val_list.txt"
|
||||
label_ratio: True
|
||||
transform_ops:
|
||||
- DecodeImage:
|
||||
|
@ -147,7 +146,26 @@ DataLoader:
|
|||
num_workers: 4
|
||||
use_shared_memory: True
|
||||
|
||||
|
||||
Infer:
|
||||
infer_imgs: deploy/images/PULC/person_attribute/090004.jpg
|
||||
batch_size: 10
|
||||
transforms:
|
||||
- DecodeImage:
|
||||
to_rgb: True
|
||||
channel_first: False
|
||||
- ResizeImage:
|
||||
size: [192, 256]
|
||||
- NormalizeImage:
|
||||
scale: 1.0/255.0
|
||||
mean: [0.485, 0.456, 0.406]
|
||||
std: [0.229, 0.224, 0.225]
|
||||
order: ''
|
||||
- ToCHWImage:
|
||||
PostProcess:
|
||||
name: PersonAttribute
|
||||
threshold: 0.5 #default threshold
|
||||
glasses_threshold: 0.3 #threshold only for glasses
|
||||
hold_threshold: 0.6 #threshold only for hold
|
||||
|
||||
Metric:
|
||||
Eval:
|
||||
|
|
|
@ -53,7 +53,7 @@ DataLoader:
|
|||
dataset:
|
||||
name: MultiLabelDataset
|
||||
image_root: "dataset/pa100k/"
|
||||
cls_label_path: "dataset/pa100k/train_val_list.txt"
|
||||
cls_label_path: "dataset/pa100k/train_list.txt"
|
||||
label_ratio: True
|
||||
transform_ops:
|
||||
- DecodeImage:
|
||||
|
@ -99,7 +99,7 @@ DataLoader:
|
|||
dataset:
|
||||
name: MultiLabelDataset
|
||||
image_root: "dataset/pa100k"
|
||||
cls_label_path: "dataset/pa100k/test_list.txt"
|
||||
cls_label_path: "dataset/pa100k/val_list.txt"
|
||||
label_ratio: True
|
||||
transform_ops:
|
||||
- DecodeImage:
|
||||
|
@ -121,6 +121,26 @@ DataLoader:
|
|||
num_workers: 4
|
||||
use_shared_memory: True
|
||||
|
||||
Infer:
|
||||
infer_imgs: deploy/images/PULC/person_attribute/090004.jpg
|
||||
batch_size: 10
|
||||
transforms:
|
||||
- DecodeImage:
|
||||
to_rgb: True
|
||||
channel_first: False
|
||||
- ResizeImage:
|
||||
size: [192, 256]
|
||||
- NormalizeImage:
|
||||
scale: 1.0/255.0
|
||||
mean: [0.485, 0.456, 0.406]
|
||||
std: [0.229, 0.224, 0.225]
|
||||
order: ''
|
||||
- ToCHWImage:
|
||||
PostProcess:
|
||||
name: PersonAttribute
|
||||
threshold: 0.5 #default threshold
|
||||
glasses_threshold: 0.3 #threshold only for glasses
|
||||
hold_threshold: 0.6 #threshold only for hold
|
||||
|
||||
Metric:
|
||||
Eval:
|
||||
|
|
|
@ -4,11 +4,11 @@ Global:
|
|||
pretrained_model: null
|
||||
output_dir: "./output/"
|
||||
device: "gpu"
|
||||
save_interval: 5
|
||||
save_interval: 1
|
||||
eval_during_train: True
|
||||
eval_interval: 1
|
||||
epochs: 20
|
||||
print_batch_step: 20
|
||||
print_batch_step: 10
|
||||
use_visualdl: False
|
||||
# used for static mode and model export
|
||||
image_shape: [3, 256, 192]
|
||||
|
@ -44,7 +44,6 @@ Optimizer:
|
|||
regularizer:
|
||||
name: 'L2'
|
||||
coeff: 0.0005
|
||||
#clip_norm: 10
|
||||
|
||||
# data loader for train and eval
|
||||
DataLoader:
|
||||
|
@ -52,7 +51,7 @@ DataLoader:
|
|||
dataset:
|
||||
name: MultiLabelDataset
|
||||
image_root: "dataset/pa100k/"
|
||||
cls_label_path: "dataset/pa100k/train_val_list.txt"
|
||||
cls_label_path: "dataset/pa100k/train_list.txt"
|
||||
label_ratio: True
|
||||
transform_ops:
|
||||
- DecodeImage:
|
||||
|
@ -85,7 +84,7 @@ DataLoader:
|
|||
dataset:
|
||||
name: MultiLabelDataset
|
||||
image_root: "dataset/pa100k/"
|
||||
cls_label_path: "dataset/pa100k/test_list.txt"
|
||||
cls_label_path: "dataset/pa100k/val_list.txt"
|
||||
label_ratio: True
|
||||
transform_ops:
|
||||
- DecodeImage:
|
||||
|
@ -107,6 +106,26 @@ DataLoader:
|
|||
num_workers: 4
|
||||
use_shared_memory: True
|
||||
|
||||
Infer:
|
||||
infer_imgs: deploy/images/PULC/person_attribute/090004.jpg
|
||||
batch_size: 10
|
||||
transforms:
|
||||
- DecodeImage:
|
||||
to_rgb: True
|
||||
channel_first: False
|
||||
- ResizeImage:
|
||||
size: [192, 256]
|
||||
- NormalizeImage:
|
||||
scale: 1.0/255.0
|
||||
mean: [0.485, 0.456, 0.406]
|
||||
std: [0.229, 0.224, 0.225]
|
||||
order: ''
|
||||
- ToCHWImage:
|
||||
PostProcess:
|
||||
name: PersonAttribute
|
||||
threshold: 0.5 #default threshold
|
||||
glasses_threshold: 0.3 #threshold only for glasses
|
||||
hold_threshold: 0.6 #threshold only for hold
|
||||
|
||||
Metric:
|
||||
Eval:
|
||||
|
|
|
@ -0,0 +1,135 @@
|
|||
# global configs
|
||||
Global:
|
||||
checkpoints: null
|
||||
pretrained_model: null
|
||||
output_dir: "./output/"
|
||||
device: "gpu"
|
||||
save_interval: 1
|
||||
eval_during_train: True
|
||||
eval_interval: 1
|
||||
epochs: 20
|
||||
print_batch_step: 10
|
||||
use_visualdl: False
|
||||
# used for static mode and model export
|
||||
image_shape: [3, 224, 224]
|
||||
save_inference_dir: "./inference"
|
||||
use_multilabel: True
|
||||
|
||||
# model architecture
|
||||
Arch:
|
||||
name: "SwinTransformer_tiny_patch4_window7_224"
|
||||
pretrained: True
|
||||
class_num: 26
|
||||
|
||||
# loss function config for traing/eval process
|
||||
Loss:
|
||||
Train:
|
||||
- MultiLabelLoss:
|
||||
weight: 1.0
|
||||
weight_ratio: True
|
||||
size_sum: True
|
||||
Eval:
|
||||
- MultiLabelLoss:
|
||||
weight: 1.0
|
||||
weight_ratio: True
|
||||
size_sum: True
|
||||
|
||||
Optimizer:
|
||||
name: Momentum
|
||||
momentum: 0.9
|
||||
lr:
|
||||
name: Cosine
|
||||
learning_rate: 0.01
|
||||
warmup_epoch: 5
|
||||
regularizer:
|
||||
name: 'L2'
|
||||
coeff: 0.0005
|
||||
#clip_norm: 10
|
||||
|
||||
# data loader for train and eval
|
||||
DataLoader:
|
||||
Train:
|
||||
dataset:
|
||||
name: MultiLabelDataset
|
||||
image_root: "dataset/pa100k/"
|
||||
cls_label_path: "dataset/pa100k/train_list.txt"
|
||||
label_ratio: True
|
||||
transform_ops:
|
||||
- DecodeImage:
|
||||
to_rgb: True
|
||||
channel_first: False
|
||||
- ResizeImage:
|
||||
size: [224, 224]
|
||||
- Padv2:
|
||||
size: [244, 244]
|
||||
pad_mode: 1
|
||||
fill_value: 0
|
||||
- RandomCropImage:
|
||||
size: [224, 224]
|
||||
- RandFlipImage:
|
||||
flip_code: 1
|
||||
- NormalizeImage:
|
||||
scale: 1.0/255.0
|
||||
mean: [0.485, 0.456, 0.406]
|
||||
std: [0.229, 0.224, 0.225]
|
||||
order: ''
|
||||
sampler:
|
||||
name: DistributedBatchSampler
|
||||
batch_size: 64
|
||||
drop_last: True
|
||||
shuffle: True
|
||||
loader:
|
||||
num_workers: 4
|
||||
use_shared_memory: True
|
||||
Eval:
|
||||
dataset:
|
||||
name: MultiLabelDataset
|
||||
image_root: "dataset/pa100k/"
|
||||
cls_label_path: "dataset/pa100k/val_list.txt"
|
||||
label_ratio: True
|
||||
transform_ops:
|
||||
- DecodeImage:
|
||||
to_rgb: True
|
||||
channel_first: False
|
||||
- ResizeImage:
|
||||
size: [224, 224]
|
||||
- NormalizeImage:
|
||||
scale: 1.0/255.0
|
||||
mean: [0.485, 0.456, 0.406]
|
||||
std: [0.229, 0.224, 0.225]
|
||||
order: ''
|
||||
sampler:
|
||||
name: DistributedBatchSampler
|
||||
batch_size: 64
|
||||
drop_last: False
|
||||
shuffle: False
|
||||
loader:
|
||||
num_workers: 4
|
||||
use_shared_memory: True
|
||||
|
||||
Infer:
|
||||
infer_imgs: deploy/images/PULC/person_attribute/090004.jpg
|
||||
batch_size: 10
|
||||
transforms:
|
||||
- DecodeImage:
|
||||
to_rgb: True
|
||||
channel_first: False
|
||||
- ResizeImage:
|
||||
size: [224, 224]
|
||||
- NormalizeImage:
|
||||
scale: 1.0/255.0
|
||||
mean: [0.485, 0.456, 0.406]
|
||||
std: [0.229, 0.224, 0.225]
|
||||
order: ''
|
||||
- ToCHWImage:
|
||||
PostProcess:
|
||||
name: PersonAttribute
|
||||
threshold: 0.5 #default threshold
|
||||
glasses_threshold: 0.3 #threshold only for glasses
|
||||
hold_threshold: 0.6 #threshold only for hold
|
||||
|
||||
Metric:
|
||||
Eval:
|
||||
- ATTRMetric:
|
||||
|
||||
|
|
@ -18,7 +18,7 @@ from . import topk, threshoutput
|
|||
|
||||
from .topk import Topk, MultiLabelTopk
|
||||
from .threshoutput import ThreshOutput
|
||||
from .attr_rec import VehicleAttribute
|
||||
from .attr_rec import VehicleAttribute, PersonAttribute
|
||||
|
||||
|
||||
def build_postprocess(config):
|
||||
|
|
|
@ -69,3 +69,105 @@ class VehicleAttribute(object):
|
|||
"file_name": file_names[idx]
|
||||
})
|
||||
return batch_res
|
||||
|
||||
|
||||
|
||||
class PersonAttribute(object):
|
||||
def __init__(self,
|
||||
threshold=0.5,
|
||||
glasses_threshold=0.3,
|
||||
hold_threshold=0.6):
|
||||
self.threshold = threshold
|
||||
self.glasses_threshold = glasses_threshold
|
||||
self.hold_threshold = hold_threshold
|
||||
|
||||
def __call__(self, x, file_names=None):
|
||||
if isinstance(x, dict):
|
||||
x = x['logits']
|
||||
assert isinstance(x, paddle.Tensor)
|
||||
if file_names is not None:
|
||||
assert x.shape[0] == len(file_names)
|
||||
x = F.sigmoid(x).numpy()
|
||||
|
||||
# postprocess output of predictor
|
||||
age_list = ['AgeLess18', 'Age18-60', 'AgeOver60']
|
||||
direct_list = ['Front', 'Side', 'Back']
|
||||
bag_list = ['HandBag', 'ShoulderBag', 'Backpack']
|
||||
upper_list = ['UpperStride', 'UpperLogo', 'UpperPlaid', 'UpperSplice']
|
||||
lower_list = [
|
||||
'LowerStripe', 'LowerPattern', 'LongCoat', 'Trousers', 'Shorts',
|
||||
'Skirt&Dress'
|
||||
]
|
||||
batch_res = []
|
||||
for idx, res in enumerate(x):
|
||||
res = res.tolist()
|
||||
label_res = []
|
||||
# gender
|
||||
gender = 'Female' if res[22] > self.threshold else 'Male'
|
||||
label_res.append(gender)
|
||||
# age
|
||||
age = age_list[np.argmax(res[19:22])]
|
||||
label_res.append(age)
|
||||
# direction
|
||||
direction = direct_list[np.argmax(res[23:])]
|
||||
label_res.append(direction)
|
||||
# glasses
|
||||
glasses = 'Glasses: '
|
||||
if res[1] > self.glasses_threshold:
|
||||
glasses += 'True'
|
||||
else:
|
||||
glasses += 'False'
|
||||
label_res.append(glasses)
|
||||
# hat
|
||||
hat = 'Hat: '
|
||||
if res[0] > self.threshold:
|
||||
hat += 'True'
|
||||
else:
|
||||
hat += 'False'
|
||||
label_res.append(hat)
|
||||
# hold obj
|
||||
hold_obj = 'HoldObjectsInFront: '
|
||||
if res[18] > self.hold_threshold:
|
||||
hold_obj += 'True'
|
||||
else:
|
||||
hold_obj += 'False'
|
||||
label_res.append(hold_obj)
|
||||
# bag
|
||||
bag = bag_list[np.argmax(res[15:18])]
|
||||
bag_score = res[15 + np.argmax(res[15:18])]
|
||||
bag_label = bag if bag_score > self.threshold else 'No bag'
|
||||
label_res.append(bag_label)
|
||||
# upper
|
||||
upper_res = res[4:8]
|
||||
upper_label = 'Upper:'
|
||||
sleeve = 'LongSleeve' if res[3] > res[2] else 'ShortSleeve'
|
||||
upper_label += ' {}'.format(sleeve)
|
||||
for i, r in enumerate(upper_res):
|
||||
if r > self.threshold:
|
||||
upper_label += ' {}'.format(upper_list[i])
|
||||
label_res.append(upper_label)
|
||||
# lower
|
||||
lower_res = res[8:14]
|
||||
lower_label = 'Lower: '
|
||||
has_lower = False
|
||||
for i, l in enumerate(lower_res):
|
||||
if l > self.threshold:
|
||||
lower_label += ' {}'.format(lower_list[i])
|
||||
has_lower = True
|
||||
if not has_lower:
|
||||
lower_label += ' {}'.format(lower_list[np.argmax(lower_res)])
|
||||
|
||||
label_res.append(lower_label)
|
||||
# shoe
|
||||
shoe = 'Boots' if res[14] > self.threshold else 'No boots'
|
||||
label_res.append(shoe)
|
||||
|
||||
threshold_list = [0.5] * len(res)
|
||||
threshold_list[1] = self.glasses_threshold
|
||||
threshold_list[18] = self.hold_threshold
|
||||
pred_res = (np.array(res) > np.array(threshold_list)
|
||||
).astype(np.int8).tolist()
|
||||
|
||||
batch_res.append({"attributes": label_res, "output": pred_res})
|
||||
return batch_res
|
||||
|
||||
|
|
Loading…
Reference in New Issue