Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
周伟奇
/
part_of_F3_OCR
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
41cd5169
authored
2022-09-07 18:24:10 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix dealername3
1 parent
be642f44
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
13 deletions
authorization_from/retriever.py
authorization_from/retriever.py
View file @
41cd516
...
...
@@ -105,20 +105,15 @@ class Retriever:
y_min_find
=
None
value
=
None
coordinates
=
None
for
(
x0
,
y0
,
x1
,
y1
,
x2
,
y2
,
x3
,
y3
),
text
in
go_res
.
values
():
new_x0
=
min
(
x0
,
x1
,
x2
,
x3
)
new_y0
=
min
(
y0
,
y1
,
y2
,
y3
)
new_x1
=
max
(
x0
,
x1
,
x2
,
x3
)
new_y1
=
max
(
y0
,
y1
,
y2
,
y3
)
cent_x
=
new_x0
+
((
new_x1
-
new_x0
)
/
2
)
cent_y
=
new_y0
+
((
new_y1
-
new_y0
)
/
2
)
for
(
x0
,
y0
,
_
,
_
,
x1
,
y1
,
_
,
_
),
text
in
go_res
.
values
():
cent_x
=
x0
+
((
x1
-
x0
)
/
2
)
cent_y
=
y0
+
((
y1
-
y0
)
/
2
)
if
x_min
<
cent_x
<
x_max
and
y_min
<
cent_y
<
y_max
:
if
y_min_find
is
None
or
new_
y0
<
y_min_find
:
if
y_min_find
is
None
or
y0
<
y_min_find
:
if
len
(
text
.
strip
())
>
0
:
y_min_find
=
new_
y0
y_min_find
=
y0
value
=
text
coordinates
=
(
new_x0
,
new_y0
,
new_x1
,
new_
y1
)
coordinates
=
(
x0
,
y0
,
x1
,
y1
)
return
value
,
coordinates
@staticmethod
...
...
@@ -150,9 +145,13 @@ class Retriever:
key_text_info
=
dict
()
for
key_text_list
in
self
.
target_fields
[
self
.
keys_str
]
.
values
():
for
key_text
,
key_re
,
_
,
_
in
key_text_list
:
for
(
x0
,
y0
,
_
,
_
,
x1
,
y1
,
_
,
_
),
text
in
go_res
.
values
():
for
(
x0
,
y0
,
x1
,
y1
,
x2
,
y2
,
x3
,
y3
),
text
in
go_res
.
values
():
if
re
.
match
(
key_re
,
text
):
key_text_info
.
setdefault
(
key_text
,
list
())
.
append
((
x0
,
y0
,
x1
,
y1
))
x_min
=
min
(
x0
,
x1
,
x2
,
x3
)
y_min
=
min
(
y0
,
y1
,
y2
,
y3
)
x_max
=
max
(
x0
,
x1
,
x2
,
x3
)
y_max
=
max
(
y0
,
y1
,
y2
,
y3
)
key_text_info
.
setdefault
(
key_text
,
list
())
.
append
((
x_min
,
y_min
,
x_max
,
y_max
))
# if text in self.key_text_set:
# key_text_info.setdefault(text, list()).append((x0, y0, x1, y1))
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment