Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
ResNet50_migraphx
Commits
c0ec4f80
Commit
c0ec4f80
authored
Oct 18, 2023
by
liucong
Browse files
修改resnet50工程格式
parent
7207b43c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
88 additions
and
32 deletions
+88
-32
Doc/Images/ResNet50.png
Doc/Images/ResNet50.png
+0
-0
Doc/Images/Residual_Block.png
Doc/Images/Residual_Block.png
+0
-0
README.md
README.md
+83
-29
model.properties
model.properties
+5
-3
No files found.
Doc/Images/ResNet50.png
0 → 100644
View file @
c0ec4f80
158 KB
Doc/Images/Residual_Block.png
0 → 100644
View file @
c0ec4f80
14.9 KB
README.md
View file @
c0ec4f80
# ResNet50
# ResNet50
## 模型介绍
## 论文
使用MIGraphX推理框架对ResNet50模型进行推理。
Deep Residual Learning for Image Recognition
-
https://arxiv.org/abs/1512.03385
## 模型结构
## 模型结构
ResNet50模型包含了49个卷积层、一个全连接层。
ResNet50模型包含了49个卷积层、一个全连接层。
## Python版本推理
<img
src=
"./Doc/Images/ResNet50.png"
style=
"zoom:80%;"
align=
middle
>
下面介绍如何运行Python代码示例,Python示例的详细说明见Doc目录下的Tutorial_Python.md。
## 算法原理
### 下载镜像
ResNet50使用了多个具有残差连接的残差块来解决梯度消失或梯度爆炸问题,并使得网络可以向更深层发展。
下载MIGraphX镜像:
<img
src=
"./Doc/Images/Residual_Block.png"
style=
"zoom:100%;"
align=
middle
>
```
python
## 环境配置
docker
pull
sugonhub
/
migraphx
:
3.2
.
1
-
centos7
.
6
-
dtk
-
23.04
.
1
-
py38
### Docker
拉取镜像:
```
plaintext
docker pull image.sourcefind.cn:5000/dcu/admin/base/migraphx:4.0.0-centos7.6-dtk23.04.1-py38-latest
```
```
### 设置Python环境变量
创建并启动容器:
```
plaintext
docker run --shm-size 16g --network=host --name=resnet50_migraphx --privileged --device=/dev/kfd --device=/dev/dri --group-add video --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -v $PWD/resnet50_migraphx:/home/resnet50_migraphx -it <Your Image ID> /bin/bash
# 激活dtk
source /opt/dtk/env.sh
```
## 数据集
根据需求上传所需图像,可以对相应图像进行分类。
## 推理
### Python版本推理
下面介绍如何运行Python代码示例,Python示例的详细说明见Doc目录下的Tutorial_Python.md。
#### 设置环境变量
```
```
export PYTHONPATH=/opt/dtk/lib:$PYTHONPATH
export PYTHONPATH=/opt/dtk/lib:$PYTHONPATH
```
```
###
安装依赖
###
# 运行示例
```
python
```
python
# 进入resnet50 migraphx工程根目录
# 进入resnet50 migraphx工程根目录
...
@@ -34,28 +61,17 @@ cd <path_to_resnet50_migraphx>
...
@@ -34,28 +61,17 @@ cd <path_to_resnet50_migraphx>
cd
Python
/
cd
Python
/
# 安装依赖
# 安装依赖
pip
install
-
r
requirements
.
txt
pip
install
-
r
requirements
.
txt
-
i
https
:
//
pypi
.
tuna
.
tsinghua
.
edu
.
cn
/
simple
```
# 运行示例
### 运行示例
```
python
python
Classifier
.
py
python
Classifier
.
py
```
```
## C++版本推理
##
#
C++版本推理
下面介绍如何运行C++代码示例,C++示例的详细说明见Doc目录下的Tutorial_Cpp.md。
下面介绍如何运行C++代码示例,C++示例的详细说明见Doc目录下的Tutorial_Cpp.md。
### 下载镜像
#### 安装Opencv依赖
下载MIGraphX镜像:
```
docker pull sugonhub/migraphx:3.2.1-centos7.6-dtk-23.04.1-py38
```
### 安装Opencv依赖
```
python
```
python
cd
<
path_to_resnet50_migraphx
>
cd
<
path_to_resnet50_migraphx
>
...
@@ -63,13 +79,13 @@ sh ./3rdParty/InstallOpenCVDependences.sh
...
@@ -63,13 +79,13 @@ sh ./3rdParty/InstallOpenCVDependences.sh
```
```
### 安装OpenCV并构建工程
###
#
安装OpenCV并构建工程
```
```
rbuild build -d depend
rbuild build -d depend
```
```
### 设置环境变量
###
#
设置环境变量
将依赖库依赖加入环境变量LD_LIBRARY_PATH,在~/.bashrc中添加如下语句:
将依赖库依赖加入环境变量LD_LIBRARY_PATH,在~/.bashrc中添加如下语句:
...
@@ -83,7 +99,7 @@ export LD_LIBRARY_PATH=<path_to_resnet50_migraphx>/depend/lib64/:$LD_LIBRARY_PAT
...
@@ -83,7 +99,7 @@ export LD_LIBRARY_PATH=<path_to_resnet50_migraphx>/depend/lib64/:$LD_LIBRARY_PAT
source ~/.bashrc
source ~/.bashrc
```
```
### 运行示例
###
#
运行示例
```
python
```
python
# 进入resnet50 migraphx工程根目录
# 进入resnet50 migraphx工程根目录
...
@@ -96,6 +112,44 @@ cd build/
...
@@ -96,6 +112,44 @@ cd build/
.
/
ResNet50
.
/
ResNet50
```
```
## result
### Python版本
输出结果中,每个值分别对应每个label的实际概率。
```
[[-2.07131356e-02 2.25237340e-01 -1.98313904e+00 -2.97360039e+00
...
-1.08657278e-01 3.15954179e-01 1.94901395e+00 -5.70572257e-01]]
```
### C++版本
输出结果中,每个值分别对应每个label的实际概率。
```
label:0,confidence:-0.020714
label:1,confidence:0.225237
label:2,confidence:-1.983139
label:3,confidence:-2.973600
...
label:996,confidence:-0.108657
label:997,confidence:0.315954
label:998,confidence:1.949014
label:999,confidence:-0.570572
```
## 应用场景
### 算法类别
图像分类
### 热点应用行业
制造,政府,医疗,科研
## 源码仓库及问题反馈
## 源码仓库及问题反馈
https://developer.hpccube.com/codes/modelzoo/resnet50_migraphx
https://developer.hpccube.com/codes/modelzoo/resnet50_migraphx
...
...
model.properties
View file @
c0ec4f80
# 模型唯一标识
modelCode
=
241
# 模型名称
# 模型名称
modelName
=
R
es
N
et50_
MIG
raph
X
modelName
=
r
es
n
et50_
mig
raph
x
# 模型描述
# 模型描述
modelDescription
=
ResNet50是一种用于图像分类的深度神经网络模型
modelDescription
=
ResNet50是一种用于图像分类的深度神经网络模型
# 应用场景
# 应用场景
appScenario
=
推理,图像分类,
cv
appScenario
=
推理,图像分类,
CV
# 框架类型
# 框架类型
frameType
=
MIGraphX
frameType
=
migraphx
\ No newline at end of file
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment