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
crnn_migraphx
Commits
c585aa89
Commit
c585aa89
authored
May 29, 2023
by
Your Name
Browse files
删除不必要文件
parent
3ca34c48
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
130 deletions
+0
-130
Python/README.md
Python/README.md
+0
-130
No files found.
Python/README.md
deleted
100644 → 0
View file @
3ca34c48
# CRNN
## 模型介绍
CRNN是文本识别领域的一种经典算法,该算法的主要思想是认为文本识别需要对序列进行预测,所以采用了预测序列常用的RNN网络。算法通过CNN提取图片特征,然后采用RNN对序列进行预测,最终使用CTC方法得到最终结果。
## 模型结构
CRNN模型的主要结构包括基于CNN的图像特征提取模块以及基于双向LSTM的文字序列特征提取模块。
## 构建安装
在光源可拉取推理的docker镜像,CRNN 模型推理推荐的镜像如下:
```
python
docker
pull
image
.
sourcefind
.
cn
:
5000
/
dcu
/
admin
/
base
/
custom
:
ort1
.
14.0
_migraphx3
.
0.0
-
dtk22
.
10.1
```
### 安装Opencv依赖
```
python
cd
<
path_to_migraphx_samples
>
sh
.
/
3
rdParty
/
InstallOpenCVDependences
.
sh
```
### 修改CMakeLists.txt
-
如果使用ubuntu系统,需要修改CMakeLists.txt中依赖库路径:
将"${CMAKE_CURRENT_SOURCE_DIR}/depend/lib64/"修改为"${CMAKE_CURRENT_SOURCE_DIR}/depend/lib/"
-
**MIGraphX2.3.0及以上版本需要c++17**
### 安装OpenCV并构建工程
```
rbuild build -d depend
```
### 设置环境变量
将依赖库依赖加入环境变量LD_LIBRARY_PATH,在~/.bashrc中添加如下语句:
**Centos**
:
```
export LD_LIBRARY_PATH=<path_to_migraphx_samples>/depend/lib64/:$LD_LIBRARY_PATH
```
**Ubuntu**
:
```
export LD_LIBRARY_PATH=<path_to_migraphx_samples>/depend/lib/:$LD_LIBRARY_PATH
```
然后执行:
```
source ~/.bashrc
```
## 推理
### C++版本推理
成功编译CRNN工程后,在build目录下输入如下命令运行该示例:
1.
静态推理
```
./MIGraphX_Samples a
```
静态推理示例输入样本图像为:

文本识别结果为:
```
a-----v--a-i-l-a-bb-l-e--- => available
```
2.
动态shape推理
```
# 开启环境变量
export MIGRAPHX_DYNAMIC_SHAPE=1
# 执行动态推理
./MIGraphX_Samples b
```
文本识别结果:
```
available
migraphx
waiting
recognition
```
### python版本推理
CRNN工程的Python推理示例仅提供静态推理,可使用如下命令运行:
```
# 进入python示例目录
cd ./Python
# 安装依赖
pip install -r requirements.txt
# 运行程序
python Crnn_infer_migraphx.py
```
该python示例输入样本图像与C++在静态推理中一致,文本识别结果为:
```
a-----v--a-i-l-a-bb-l-e--- => available
```
## 历史版本
https://developer.hpccube.com/codes/modelzoo/crnn_migraphx
## 参考
https://github.com/meijieru/crnn.pytorch
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