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
ppocrv5_migraphx
Commits
d20ac126
Commit
d20ac126
authored
Jul 08, 2025
by
liuhy
Browse files
1、修改README.md
parent
dcb66e73
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
10 deletions
+5
-10
README.md
README.md
+1
-2
Src/ocr_engine.cpp
Src/ocr_engine.cpp
+4
-8
No files found.
README.md
View file @
d20ac126
...
@@ -69,12 +69,11 @@ export PYTHONPATH=/opt/dtk/lib:$PYTHONPATH
...
@@ -69,12 +69,11 @@ export PYTHONPATH=/opt/dtk/lib:$PYTHONPATH
```
python
```
python
# 进入ppocrv5 migraphx工程根目录
# 进入ppocrv5 migraphx工程根目录
cd
<
ppocrv5_migraphx
>
cd
<
ppocrv5_migraphx
>
# 进入示例程序目录
# 进入示例程序目录
cd
Python
/
cd
Python
/
# 安装依赖
# 安装依赖
pip
install
-
r
requirements
.
txt
-
i
https
:
//
pypi
.
tuna
.
tsinghua
.
edu
.
cn
/
simple
pip
install
-
r
requirements
.
txt
-
i
https
:
//
pypi
.
tuna
.
tsinghua
.
edu
.
cn
/
simple
```
```
如果测试环境是离线环境,可手动安装需要的依赖(shapely,pyclipper),依赖文件存放在3rdParty/rbuild_depend目录下
如果测试环境是离线环境,可手动安装需要的依赖(shapely,pyclipper),依赖文件存放在3rdParty/rbuild_depend目录下
运行示例程序:
运行示例程序:
...
...
Src/ocr_engine.cpp
View file @
d20ac126
...
@@ -11,13 +11,11 @@ T clip(const T &n, const T &lower, const T &upper){
...
@@ -11,13 +11,11 @@ T clip(const T &n, const T &lower, const T &upper){
}
}
template
<
class
ForwardIterator
>
template
<
class
ForwardIterator
>
inline
size_t
argmax
(
ForwardIterator
first
,
ForwardIterator
last
)
inline
size_t
argmax
(
ForwardIterator
first
,
ForwardIterator
last
){
{
return
std
::
distance
(
first
,
std
::
max_element
(
first
,
last
));
return
std
::
distance
(
first
,
std
::
max_element
(
first
,
last
));
}
}
static
float
sigmoid
(
float
x
)
static
float
sigmoid
(
float
x
){
{
return
(
1
/
(
1
+
exp
(
-
x
)));
return
(
1
/
(
1
+
exp
(
-
x
)));
}
}
...
@@ -771,8 +769,7 @@ namespace ppocr{
...
@@ -771,8 +769,7 @@ namespace ppocr{
return
text
;
return
text
;
}
}
std
::
string
CTCDecode
::
postprocess
(
float
*
feature
)
std
::
string
CTCDecode
::
postprocess
(
float
*
feature
){
{
std
::
vector
<
float
>
probs
;
std
::
vector
<
float
>
probs
;
std
::
vector
<
int
>
indexs
;
std
::
vector
<
int
>
indexs
;
float
prob
=
0.
;
float
prob
=
0.
;
...
@@ -856,8 +853,7 @@ namespace ppocr{
...
@@ -856,8 +853,7 @@ namespace ppocr{
);
);
}
}
cv
::
Mat
ppOcrEngine
::
visualize_text
(
std
::
vector
<
std
::
string
>
texts
,
std
::
vector
<
cv
::
Point
>
points
,
cv
::
Mat
&
img
)
cv
::
Mat
ppOcrEngine
::
visualize_text
(
std
::
vector
<
std
::
string
>
texts
,
std
::
vector
<
cv
::
Point
>
points
,
cv
::
Mat
&
img
){
{
assert
(
texts
.
size
()
==
points
.
size
()),
"error texts size != points size"
;
assert
(
texts
.
size
()
==
points
.
size
()),
"error texts size != points size"
;
cv
::
Mat
draw_img
=
cv
::
Mat
(
img
.
size
(),
CV_8UC3
,
cv
::
Scalar
(
255
,
255
,
255
));
cv
::
Mat
draw_img
=
cv
::
Mat
(
img
.
size
(),
CV_8UC3
,
cv
::
Scalar
(
255
,
255
,
255
));
int
width
=
img
.
cols
*
2
;
int
width
=
img
.
cols
*
2
;
...
...
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