Commit 25004606 authored by zhanggezhong's avatar zhanggezhong
Browse files

Merge branch 'zhanggezhong-main-patch-10329' into 'main'

Update README.md

See merge request !4
parents 4384910f 63a5856d
# TVM # ResNet50_v2
## 模型介绍 ## 论文
``` `Deep Residual Learning for Image Recognition`
ResNet-50v2是ResNet系列中的一个经典模型,由50层卷积层、批量归一化、激活函数和池化层构成。它引入了一种全新的残差块结构, - https://arxiv.org/abs/1512.03385
即bottleneck结构,使得网络参数量大幅度降低,同时精度也有所提升,ResNet-50v2适用于各种图像分类任务。本示例为使用TVM对训练
好的ResNet-50v2 onnx格式的模型文件,进行推理调优及部署的流程。
```
## 模型结构 ## 模型结构
ResNet50网络中包含了49个卷积层、1个全连接层等
![image.png](./image.png)
## 算法原理
ResNet50使用了多个具有残差连接的残差块来解决梯度消失或梯度爆炸问题,并使得网络可以向更深层发展。
![image-1.png](./image-1.png)
## 环境配置
### Docker(方法一)
拉取镜像:
``` ```
ResNet50-v2 docker pull image.sourcefind.cn:5000/dcu/admin/base/custom:tvm-0.11_fp32_cpp_dtk22.10_py38_centos-7.6-latest
``` ```
## 模型文件 创建并启动容器
模型文件下载地址:
``` ```
"https://github.com/onnx/models/raw/main/vision/classification/resnet/model/resnet50-v2-7.onnx" docker run --shm-size 16g --network=host --name=ResNet50_v2 --privileged --device=/dev/kfd --device=/dev/dri --group-add video --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -v /ResNet50_v2_tvm:/home/ResNet50_v2_tvm -it <Your Image ID> /bin/bash
# 激活dtk
source /opt/dtk/env.sh
``` ```
## 数据集 ## 数据集
python 推理及调优代码使用的图片数据为: python 推理及调优代码使用的图片数据为:
...@@ -26,17 +37,35 @@ ...@@ -26,17 +37,35 @@
C++部署代码使用数据为: C++部署代码使用数据为:
``` ```
"https://github.com/ultralytics/yolov5/releases/download/v1.0/coco128.zip" "https://github.com/ultralytics/yolov5/releases/download/v1.0/coco128.zip"
coco128数据集的目录结构如下:
├── images
│ ├── train2017
│ ├── val2017
│ ├── test2017
├── labels
│ ├── train2017
│ ├── val2017
├── annotations
│ ├── instances_val2017.json
├── LICENSE
├── README.txt
├── test-dev2017.txt
├── train2017.txt
├── val2017.txt
``` ```
## 推理、自动调优及部署 ## 推理
### 环境配置 模型文件下载地址:
拉取镜像:
``` ```
docker pull image.sourcefind.cn:5000/dcu/admin/base/custom:tvm-0.11_fp32_cpp_dtk22.10_py38_centos-7.6-latest "https://github.com/onnx/models/raw/main/vision/classification/resnet/model/resnet50-v2-7.onnx"
``` ```
### 执行推理及调优
下载模型文件后执行以下命令进行推理测试及调优测试: 下载模型文件后执行以下命令进行推理测试及调优测试:
``` ```
git clone http://developer.hpccube.com/codes/modelzoo/tvm_tune_resnet50-v2.git
cd tvm_tune_resnet50-v2
export HIP_VISIBLE_DEVICES=1 #此处为指定哪张加速卡进行推理的ID号
python tune_resnet50-v2.py python tune_resnet50-v2.py
``` ```
...@@ -46,26 +75,35 @@ ...@@ -46,26 +75,35 @@
执行以下命令: 执行以下命令:
``` ```
mkdir -p lib mkdir -p lib
export HIP_VISIBLE_DEVICES=1 #此处为指定哪张加速卡进行推理的ID号
python prepare_test_libs.py python prepare_test_libs.py
sh run_example.sh sh run_example.sh
``` ```
## 准确率数据 ## result
![kitten-1.jpg](./kitten-1.jpg)
### 精度
``` ```
max_num:15.6692 max_num:15.6692
max_iter:0x28cda14 max_iter:0x28cda14
max_num_index:345 max_num_index:345
``` ```
## TVM版本 ## 应用场景
```
TVM-0.11 ### 算法类别
```
图像分类
### 热点应用行业
制造,政府,医疗,科研
## 源码仓库及问题反馈 ## 源码仓库及问题反馈
* https://developer.hpccube.com/codes/modelzoo/tvm_tune_resnet50-v2 https://developer.hpccube.com/codes/modelzoo/tvm_tune_resnet50-v2
## 参考 ### 参考资料
* [https://tvm.apache.org/docs/how_to/tune_with_autoscheduler/tune_network_cuda.html#sphx-glr-how-to-tune-with-autoscheduler-tune-network-cuda-py]() https://tvm.apache.org/docs
image-1.png

15.2 KB

image.png

210 KB

modeCode=86
#模型名称 #模型名称
modelName=ResNet50-v2_TVM modelName=resnet50-v2_tvm
#模型描述 #模型描述
modelDescription=ResNet50_v2是一种用于图像识别的深度神经网络模型 modelDescription=resnet50-v2_tvm是一种用于图像识别的深度神经网络模型
# 应用场景(多个标签以英文逗号分割) # 应用场景(多个标签以英文逗号分割)
appScenario=CV appScenario=推理,图像分类,制造,政府,医疗,科研
# 框架类型(多个标签以英文逗号分割) # 框架类型(多个标签以英文逗号分割)
frameType=onnx frameType=tvm
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment