README.md 2.71 KB
Newer Older
zhanggezhong's avatar
zhanggezhong committed
1
2
3
4
5
6
7
# ResNet50_v2
## 论文
`Deep Residual Learning for Image Recognition`
- https://arxiv.org/abs/1512.03385
## 模型结构
ResNet50网络中包含了49个卷积层、1个全连接层等

8
![image.png](./image.png)
zhanggezhong's avatar
zhanggezhong committed
9
10
11
## 算法原理
ResNet50使用了多个具有残差连接的残差块来解决梯度消失或梯度爆炸问题,并使得网络可以向更深层发展。

12
![image-1.png](./image-1.png)
dcuai's avatar
dcuai committed
13

zhanggezhong's avatar
zhanggezhong committed
14
15
16
17
18
19
20
21
22
## 环境配置
### Docker(方法一)

拉取镜像:
```
    docker pull image.sourcefind.cn:5000/dcu/admin/base/custom:tvm-0.11_fp32_cpp_dtk22.10_py38_centos-7.6-latest
```
创建并启动容器
```
zhanggezhong's avatar
zhanggezhong committed
23
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
zhanggezhong's avatar
zhanggezhong committed
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

# 激活dtk
source /opt/dtk/env.sh
```
## 数据集
  python 推理及调优代码使用的图片数据为:
```
    "https://s3.amazonaws.com/model-server/inputs/kitten.jpg"
``` 
  标签数据为:
```
    "https://s3.amazonaws.com/onnx-model-zoo/synset.txt"
```
   C++部署代码使用数据为:
```
    "https://github.com/ultralytics/yolov5/releases/download/v1.0/coco128.zip"
dcuai's avatar
dcuai committed
40
41
    
     coco128数据集的目录结构如下:
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
     ├── images 
     │   ├── train2017
     │   ├── val2017
     │   ├── test2017
     ├── labels
     │   ├── train2017
     │   ├── val2017
     ├── annotations
     │   ├── instances_val2017.json
     ├── LICENSE
     ├── README.txt 
     ├── test-dev2017.txt
     ├── train2017.txt
     ├── val2017.txt

dcuai's avatar
dcuai committed
57
58
59
60
61
62

```
## 推理
  模型文件下载地址: 
```
    "https://github.com/onnx/models/raw/main/vision/classification/resnet/model/resnet50-v2-7.onnx"
zhanggezhong's avatar
zhanggezhong committed
63
64
65
```
  下载模型文件后执行以下命令进行推理测试及调优测试:
```
zhanggezhong's avatar
zhanggezhong committed
66
67
    git clone http://developer.hpccube.com/codes/modelzoo/tvm_tune_resnet50-v2.git
    cd tvm_tune_resnet50-v2
zhanggezhong's avatar
zhanggezhong committed
68
69
70
71
72
73
74
75
76
77
78
79
    python tune_resnet50-v2.py
```
    
    
### 单卡部署推理测试
  下载配置好镜像之后,cd /tvm-0.11-dev0/apps/ 进入该路径下,将代码下载放到该路径下,cd tvm_tune_resnet50-v2/ 进入该路径后,
执行以下命令:
```
    mkdir -p lib
    python prepare_test_libs.py
    sh run_example.sh
```
dcuai's avatar
dcuai committed
80
81
## result

82
![kitten-1.jpg](./kitten-1.jpg)
dcuai's avatar
dcuai committed
83
84

### 精度
zhanggezhong's avatar
zhanggezhong committed
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
```
    max_num:15.6692
    max_iter:0x28cda14
    max_num_index:345
``` 
## 应用场景

### 算法类别

图像分类

### 热点应用行业

制造,政府,医疗,科研
    
## 源码仓库及问题反馈

zhanggezhong's avatar
zhanggezhong committed
102
  https://developer.hpccube.com/codes/modelzoo/tvm_tune_resnet50-v2
zhanggezhong's avatar
zhanggezhong committed
103

zhanggezhong's avatar
zhanggezhong committed
104
### 参考资料
zhanggezhong's avatar
zhanggezhong committed
105

zhanggezhong's avatar
zhanggezhong committed
106
  https://tvm.apache.org/docs
zhanggezhong's avatar
zhanggezhong committed
107