"tests/experimental/__init__.py" did not exist on "44b9bcd811cb7f38980a265f53342bee2b602507"
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-v2 ResNet50使用了多个具有残差连接的残差块来解决梯度消失或梯度爆炸问题,并使得网络可以向更深层发展。
```
## 模型文件 ![image-1.png](./image-1.png)
模型文件下载地址:
``` ## 环境配置
"https://github.com/onnx/models/raw/main/vision/classification/resnet/model/resnet50-v2-7.onnx" ### Docker(方法一)
```
## 数据集 拉取镜像:
python 推理及调优代码使用的图片数据为: ```
``` docker pull image.sourcefind.cn:5000/dcu/admin/base/custom:tvm-0.11_fp32_cpp_dtk22.10_py38_centos-7.6-latest
"https://s3.amazonaws.com/model-server/inputs/kitten.jpg" ```
``` 创建并启动容器
标签数据为: ```
``` 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
"https://s3.amazonaws.com/onnx-model-zoo/synset.txt"
``` # 激活dtk
C++部署代码使用数据为: source /opt/dtk/env.sh
``` ```
"https://github.com/ultralytics/yolov5/releases/download/v1.0/coco128.zip" ## 数据集
``` python 推理及调优代码使用的图片数据为:
## 推理、自动调优及部署 ```
### 环境配置 "https://s3.amazonaws.com/model-server/inputs/kitten.jpg"
拉取镜像: ```
``` 标签数据为:
docker pull image.sourcefind.cn:5000/dcu/admin/base/custom:tvm-0.11_fp32_cpp_dtk22.10_py38_centos-7.6-latest ```
``` "https://s3.amazonaws.com/onnx-model-zoo/synset.txt"
```
### 执行推理及调优 C++部署代码使用数据为:
下载模型文件后执行以下命令进行推理测试及调优测试: ```
``` "https://github.com/ultralytics/yolov5/releases/download/v1.0/coco128.zip"
python tune_resnet50-v2.py
``` coco128数据集的目录结构如下:
├── images
│ ├── train2017
### 单卡部署推理测试 │ ├── val2017
下载配置好镜像之后,cd /tvm-0.11-dev0/apps/ 进入该路径下,将代码下载放到该路径下,cd tvm_tune_resnet50-v2/ 进入该路径后, │ ├── test2017
执行以下命令: ├── labels
``` │ ├── train2017
mkdir -p lib │ ├── val2017
python prepare_test_libs.py ├── annotations
sh run_example.sh │ ├── instances_val2017.json
``` ├── LICENSE
## 准确率数据 ├── README.txt
``` ├── test-dev2017.txt
max_num:15.6692 ├── train2017.txt
max_iter:0x28cda14 ├── val2017.txt
max_num_index:345
```
## TVM版本 ```
``` ## 推理
TVM-0.11 模型文件下载地址:
``` ```
"https://github.com/onnx/models/raw/main/vision/classification/resnet/model/resnet50-v2-7.onnx"
```
## 源码仓库及问题反馈 下载模型文件后执行以下命令进行推理测试及调优测试:
```
* https://developer.hpccube.com/codes/modelzoo/tvm_tune_resnet50-v2 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
* [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]() ```
### 单卡部署推理测试
下载配置好镜像之后,cd /tvm-0.11-dev0/apps/ 进入该路径下,将代码下载放到该路径下,cd tvm_tune_resnet50-v2/ 进入该路径后,
执行以下命令:
```
mkdir -p lib
export HIP_VISIBLE_DEVICES=1 #此处为指定哪张加速卡进行推理的ID号
python prepare_test_libs.py
sh run_example.sh
```
## result
![kitten-1.jpg](./kitten-1.jpg)
### 精度
```
max_num:15.6692
max_iter:0x28cda14
max_num_index:345
```
## 应用场景
### 算法类别
图像分类
### 热点应用行业
制造,政府,医疗,科研
## 源码仓库及问题反馈
https://developer.hpccube.com/codes/modelzoo/tvm_tune_resnet50-v2
### 参考资料
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