amend yolov5 and centerface Readme

This commit is contained in:
chenweitao_295 2021-07-05 22:12:06 +08:00
parent 1790db17dd
commit f84cf543d7
3 changed files with 71 additions and 14 deletions

View File

@ -648,11 +648,11 @@ The ckpt_file parameter is required,
### Infer on Ascend310
Before performing inference, the mindir file must be exported by `export.py` script. We only provide an example of inference using MINDIR model.
Need to install OpenCV, You can download it from [OpenCV](https://opencv.org/).
Need to install OpenCV(Version >= 4.0), You can download it from [OpenCV](https://opencv.org/).
```shell
# Ascend310 inference
bash run_infer_310.sh [MINDIR_PATH] [DATA_PATH] [DVPP] [DEVICE_ID]
bash run_infer_310.sh [MINDIR_PATH] [DATA_PATH] [SAVE_PATH] [LABEL_PATH] [DVPP] [DEVICE_ID]
```
- `DVPP` is mandatory, and must choose from ["DVPP", "CPU"], it's case-insensitive. Only support CPU mode .
@ -715,7 +715,7 @@ CenterFace on 3.2K images(The annotation and data format must be the same as wid
| Parameters | CenterFace |
| ------------------- | --------------------------- |
| Model Version | CNNCTC |
| Model Version | CenterFace |
| Resource | Ascend 310; CentOS 3.10 |
| Uploaded Date | 23/06/2021 (month/day/year) |
| MindSpore Version | 1.2.0 |

View File

@ -15,7 +15,7 @@
# ============================================================================
if [[ $# -lt 5 || $# -gt 6 ]]; then
echo "Usage: bash run_infer_310.sh [MINDIR_PATH] [DATA_PATH] [SAVE_PATH] [LABEL_FILE] [DVPP] [DEVICE_ID]
echo "Usage: bash run_infer_310.sh [MINDIR_PATH] [DATA_PATH] [SAVE_PATH] [LABEL_PATH] [DVPP] [DEVICE_ID]
DVPP is mandatory, and must choose from [DVPP|CPU], it's case-insensitive. Current only support CPU mode.
DEVICE_ID is optional, it can be set by environment variable device_id, otherwise the value is zero"
exit 1
@ -31,7 +31,7 @@ get_real_path(){
model=$(get_real_path $1)
data_path=$(get_real_path $2)
save_path=$(get_real_path $3)
label_file=$(get_real_path $4)
label_path=$(get_real_path $4)
DVPP=${5^^}
device_id=0
if [ $# == 6 ]; then
@ -41,7 +41,7 @@ fi
echo "mindir name: "$model
echo "dataset path: "$data_path
echo "save path: "$save_path
echo "label file: "$label_file
echo "label path: "$label_path
echo "image process mode: "$DVPP
echo "device id: "$device_id
@ -101,7 +101,7 @@ function cal_ap()
if [ -d ${save_path} ]; then
rm -rf ${save_path}
fi
python3.7 ../postprocess.py --result_path=./result_Files --label_file=$label_file --meta_file=./dataset/meta --save_path=$save_path &> ap.log &
python3.7 ../postprocess.py --result_path=./result_Files --label_path=$label_path --meta_path=./dataset/meta --save_path=$save_path &> ap.log &
}
preprocess_data

View File

@ -14,12 +14,15 @@
- [测试](#测试)
- [评估过程](#评估过程)
- [评估](#评估)
- [转换过程](#转换过程)
- [转换](#转换)
- [推理过程](#推理过程)
- [导出MindIR](#导出mindir)
- [在Ascend310执行推理](#在ascend310执行推理)
- [结果](#结果)
- [模型说明](#模型说明)
- [性能](#性能)
- [评估性能](#评估性能)
- [推理性能](#推理性能)
- [310推理性能](#310推理性能)
- [ModelZoo主页](#modelzoo主页)
# [YOLOv5描述](#目录)
@ -125,9 +128,11 @@ sh run_eval.sh dataset/xxx checkpoint/xxx.ckpt
©¸©¤yolov5
©À©¤README.md
©À©¤mindspore_hub_conf.md # Mindspore Hub配置
©À©¤ascend310_infer # 用于310推理
©À©¤scripts
©À©¤run_standalone_train.sh # 在Ascend中启动单机训练1卡
©À©¤run_distribute_train.sh # 在Ascend中启动分布式训练8卡
©À©¤run_infer_310.sh # 在Ascend中启动310推理
©¸©¤run_eval.sh # 在Ascend中启动评估
©À©¤src
©À©¤__init__.py # Python初始化文件
@ -145,6 +150,8 @@ sh run_eval.sh dataset/xxx checkpoint/xxx.ckpt
©À©¤eval.py # 评估验证结果
©À©¤export.py # 将MindSpore模型转换为AIR模型
©À©¤preprocess.py # 310推理前处理脚本
©À©¤postprocess.py # 310推理后处理脚本
©¸©¤train.py # 训练网络
```
@ -306,14 +313,49 @@ sh run_eval.sh dataset/coco2017 checkpoint/yolov5.ckpt
Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.674
```
## [转换过程](#目录)
## [推理过程](#目录)
### 转换
### 导出MindIR
如果您想推断Ascend 310上的网络则应将模型转换为AIR
```shell
python export.py --ckpt_file [CKPT_PATH] --file_format [EXPORT_FORMAT] --batch_size [BATCH_SIZE]
```
```python
python export.py [BATCH_SIZE] [PRETRAINED_BACKBONE]
参数ckpt_file为必填项
`EXPORT_FORMAT` 必须在 ["AIR", "MINDIR"]中选择。
`BATCH_SIZE` 目前仅支持batch_size为1的推理。
### 在Ascend310执行推理
在执行推理前mindir文件必须通过`export.py`脚本导出。以下展示了使用mindir模型执行推理的示例。
```shell
# Ascend310 inference
bash run_infer_310.sh [MINDIR_PATH] [DATA_PATH] [ANN_FILE] [DVPP] [DEVICE_ID]
```
- `ANN_FILE` Annotations 文件路径。
- `DVPP` 为必填项,需要在["DVPP", "CPU"]选择大小写均可。目前仅支持CPU算子推理。
- `DEVICE_ID` 可选默认值为0。
### 结果
推理结果保存在脚本执行的当前路径你可以在acc.log中看到以下精度计算结果。
```bash
=============coco 310 infer reulst=========
Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.369
Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.571
Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.398
Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.216
Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.421
Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.487
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] = 0.301
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] = 0.502
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.558
Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.388
Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.617
Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.677
```
# [模型说明](#目录)
@ -355,6 +397,21 @@ YOLOv5应用于5000张图像上标注和数据格式必须与COCO val 2017相
|精度|map=36.8~37.2%shape=640|
|推理模型| 58M.ckpt文件|
### 310推理性能
YOLOv5应用于5000张图像上标注和数据格式必须与COCO val 2017相同
|参数| YOLOv5s |
| -------------------------- | ----------------------------------------------------------- |
| 资源 | Ascend 310CPU 2.60GHz192核内存755G |
|上传日期| 2021年06月28日 |
| MindSpore版本 | 1.2.0 |
|数据集|5000张图像|
|批处理大小|1|
|输出|边框位置和分数,以及概率|
|精度|map=36.9%shape=640|
|推理模型| 58M.ckpt文件|
# [随机情况说明](#目录)
在dataset.py中我们设置了“create_dataset”函数内的种子。