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
gaoqiong
RapidOCR
Commits
5fe2bdc6
Commit
5fe2bdc6
authored
Oct 17, 2022
by
benjaminwan
Browse files
修复:scoreToTextLine方法索引越界问题
parent
d14f23c4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
20 deletions
+10
-20
src/AngleNet.cpp
src/AngleNet.cpp
+2
-6
src/CrnnNet.cpp
src/CrnnNet.cpp
+6
-8
src/DbNet.cpp
src/DbNet.cpp
+2
-6
No files found.
src/AngleNet.cpp
100755 → 100644
View file @
5fe2bdc6
...
...
@@ -6,12 +6,8 @@ AngleNet::AngleNet() {}
AngleNet
::~
AngleNet
()
{
delete
session
;
for
(
auto
name
:
inputNames
)
{
free
(
name
);
}
for
(
auto
name
:
outputNames
)
{
free
(
name
);
}
inputNames
.
clear
();
outputNames
.
clear
();
}
void
AngleNet
::
setNumThread
(
int
numOfThread
)
{
...
...
src/CrnnNet.cpp
100755 → 100644
View file @
5fe2bdc6
...
...
@@ -7,12 +7,8 @@ CrnnNet::CrnnNet() {}
CrnnNet
::~
CrnnNet
()
{
delete
session
;
for
(
auto
name
:
inputNames
)
{
free
(
name
);
}
for
(
auto
name
:
outputNames
)
{
free
(
name
);
}
inputNames
.
clear
();
outputNames
.
clear
();
}
void
CrnnNet
::
setNumThread
(
int
numOfThread
)
{
...
...
@@ -76,8 +72,10 @@ TextLine CrnnNet::scoreToTextLine(const std::vector<float> &outputData, int h, i
float
maxValue
;
for
(
int
i
=
0
;
i
<
h
;
i
++
)
{
maxIndex
=
int
(
argmax
(
&
outputData
[
i
*
w
],
&
outputData
[(
i
+
1
)
*
w
]));
maxValue
=
float
(
*
std
::
max_element
(
&
outputData
[
i
*
w
],
&
outputData
[(
i
+
1
)
*
w
]));
int
start
=
i
*
w
;
int
stop
=
(
i
+
1
)
*
w
-
1
;
maxIndex
=
int
(
argmax
(
&
outputData
[
start
],
&
outputData
[
stop
]));
maxValue
=
float
(
*
std
::
max_element
(
&
outputData
[
start
],
&
outputData
[
stop
]));
if
(
maxIndex
>
0
&&
maxIndex
<
keySize
&&
(
!
(
i
>
0
&&
maxIndex
==
lastIndex
)))
{
scores
.
emplace_back
(
maxValue
);
...
...
src/DbNet.cpp
100755 → 100644
View file @
5fe2bdc6
...
...
@@ -5,12 +5,8 @@ DbNet::DbNet() {}
DbNet
::~
DbNet
()
{
delete
session
;
for
(
auto
name
:
inputNames
)
{
free
(
name
);
}
for
(
auto
name
:
outputNames
)
{
free
(
name
);
}
inputNames
.
clear
();
outputNames
.
clear
();
}
void
DbNet
::
setNumThread
(
int
numOfThread
)
{
...
...
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