Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
周伟奇
/
bmw-ocr
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
149b0899
authored
2021-10-05 18:12:51 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
slice part 2
1 parent
59da79a4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
14 deletions
src/celery_compare/tasks.py
src/celery_compare/tasks.py
View file @
149b089
...
...
@@ -341,11 +341,11 @@ def ca_compare_license(license_en, ocr_res_dict, field_list):
else
:
img_path
=
ocr_res_list
[
res_idx
]
.
get
(
consts
.
IMG_PATH_KEY
,
''
)
if
result
==
consts
.
RESULT_N
else
empty_str
error_type
=
empty_error_type
if
result
==
consts
.
RESULT_Y
else
ErrorType
.
OCR
.
value
result_field_list
.
append
((
name
,
value
,
result
,
ocr_str
,
img_path
,
error_type
))
result_field_list
.
append
((
name
,
value
,
result
,
ocr_str
,
position_img_path
,
img_path
,
error_type
))
if
not
is_find
:
for
name
,
value
in
field_list
:
result_field_list
.
append
((
name
,
value
,
consts
.
RESULT_N
,
empty_str
,
empty_str
,
ErrorType
.
NF
.
value
))
result_field_list
.
append
((
name
,
value
,
consts
.
RESULT_N
,
empty_str
,
empty_str
,
empty_str
,
ErrorType
.
NF
.
value
))
return
result_field_list
...
...
@@ -364,7 +364,7 @@ def ca_compare_process(compare_info, ocr_res_dict):
for
license_dict
in
license_list
:
for
license_en
,
field_list
in
license_dict
.
items
():
result_field_list
=
ca_compare_license
(
license_en
,
ocr_res_dict
,
field_list
)
for
name
,
value
,
result
,
ocr_str
,
img_path
,
error_type
in
result_field_list
:
for
name
,
value
,
result
,
ocr_str
,
position_img_path
,
img_path
,
error_type
in
result_field_list
:
total_fields
+=
1
if
result
==
consts
.
RESULT_N
:
failed_count
+=
1
...
...
@@ -377,7 +377,7 @@ def ca_compare_process(compare_info, ocr_res_dict):
consts
.
HEAD_LIST
[
4
]:
value
,
consts
.
HEAD_LIST
[
5
]:
ocr_str
,
consts
.
HEAD_LIST
[
6
]:
result
,
consts
.
HEAD_LIST
[
7
]:
empty_str
,
consts
.
HEAD_LIST
[
7
]:
position_img_path
,
consts
.
HEAD_LIST
[
8
]:
img_path
,
consts
.
HEAD_LIST
[
9
]:
error_type
,
}
...
...
@@ -385,7 +385,7 @@ def ca_compare_process(compare_info, ocr_res_dict):
else
:
for
license_en
,
field_list
in
info_value
.
items
():
result_field_list
=
ca_compare_license
(
license_en
,
ocr_res_dict
,
field_list
)
for
name
,
value
,
result
,
ocr_str
,
img_path
,
error_type
in
result_field_list
:
for
name
,
value
,
result
,
ocr_str
,
position_img_path
,
img_path
,
error_type
in
result_field_list
:
total_fields
+=
1
if
result
==
consts
.
RESULT_N
:
failed_count
+=
1
...
...
@@ -398,7 +398,7 @@ def ca_compare_process(compare_info, ocr_res_dict):
consts
.
HEAD_LIST
[
4
]:
value
,
consts
.
HEAD_LIST
[
5
]:
ocr_str
,
consts
.
HEAD_LIST
[
6
]:
result
,
consts
.
HEAD_LIST
[
7
]:
empty_str
,
consts
.
HEAD_LIST
[
7
]:
position_img_path
,
consts
.
HEAD_LIST
[
8
]:
img_path
,
consts
.
HEAD_LIST
[
9
]:
error_type
,
}
...
...
@@ -1116,13 +1116,13 @@ def se_compare_license(license_en, ocr_res_dict, field_list):
img_path
=
ocr_res_list
[
res_idx
]
.
get
(
consts
.
IMG_PATH_KEY
,
''
)
if
result
==
consts
.
RESULT_N
else
empty_str
error_type
=
empty_error_type
if
result
==
consts
.
RESULT_Y
else
ErrorType
.
OCR
.
value
result_field_list
.
append
((
name
,
value
,
result
,
ocr_str
,
img_path
,
error_type
))
result_field_list
.
append
((
name
,
value
,
result
,
ocr_str
,
position_img_path
,
img_path
,
error_type
))
else
:
no_ocr_result
=
True
if
not
is_find
:
for
name
,
value
in
field_list
:
result_field_list
.
append
((
name
,
value
,
consts
.
RESULT_N
,
empty_str
,
empty_str
,
ErrorType
.
NF
.
value
))
result_field_list
.
append
((
name
,
value
,
consts
.
RESULT_N
,
empty_str
,
empty_str
,
empty_str
,
ErrorType
.
NF
.
value
))
return
result_field_list
,
no_ocr_result
...
...
@@ -1184,11 +1184,12 @@ def se_mvc34_compare(license_en, ocr_res_dict, field_list):
result
=
getattr
(
cp
,
compare_logic
[
name
][
1
])(
value
,
ocr_str
,
**
compare_logic
[
name
][
2
])
img_path
=
ocr_res
.
get
(
consts
.
IMG_PATH_KEY
,
''
)
if
result
==
consts
.
RESULT_N
else
empty_str
error_type
=
empty_error_type
if
result
==
consts
.
RESULT_Y
else
ErrorType
.
OCR
.
value
result_field_list
.
append
((
name
,
value
,
result
,
ocr_str
,
img_path
,
error_type
))
position_img_path
=
empty_str
result_field_list
.
append
((
name
,
value
,
result
,
ocr_str
,
position_img_path
,
img_path
,
error_type
))
if
not
is_find
:
for
name
,
value
in
field_list
:
result_field_list
.
append
((
name
,
value
,
consts
.
RESULT_N
,
empty_str
,
empty_str
,
ErrorType
.
NF
.
value
))
result_field_list
.
append
((
name
,
value
,
consts
.
RESULT_N
,
empty_str
,
empty_str
,
empty_str
,
ErrorType
.
NF
.
value
))
return
result_field_list
...
...
@@ -1211,7 +1212,7 @@ def se_compare_process(compare_info, ocr_res_dict):
for
license_en
,
field_list
in
license_dict
.
items
():
failure_field
=
[]
result_field_list
,
no_ocr_result
=
se_compare_license
(
license_en
,
ocr_res_dict
,
field_list
)
for
name
,
value
,
result
,
ocr_str
,
img_path
,
error_type
in
result_field_list
:
for
name
,
value
,
result
,
ocr_str
,
position_img_path
,
img_path
,
error_type
in
result_field_list
:
if
license_en
not
in
consts
.
SKIP_CARD
or
not
no_ocr_result
:
total_fields
+=
1
if
result
==
consts
.
RESULT_N
:
...
...
@@ -1227,7 +1228,7 @@ def se_compare_process(compare_info, ocr_res_dict):
consts
.
HEAD_LIST
[
4
]:
value
,
consts
.
HEAD_LIST
[
5
]:
ocr_str
,
consts
.
HEAD_LIST
[
6
]:
result
,
consts
.
HEAD_LIST
[
7
]:
empty_str
,
consts
.
HEAD_LIST
[
7
]:
position_img_path
,
consts
.
HEAD_LIST
[
8
]:
img_path
,
consts
.
HEAD_LIST
[
9
]:
error_type
,
}
...
...
@@ -1241,7 +1242,7 @@ def se_compare_process(compare_info, ocr_res_dict):
result_field_list
=
se_mvc34_compare
(
license_en
,
ocr_res_dict
,
field_list
)
else
:
result_field_list
,
_
=
se_compare_license
(
license_en
,
ocr_res_dict
,
field_list
)
for
name
,
value
,
result
,
ocr_str
,
img_path
,
error_type
in
result_field_list
:
for
name
,
value
,
result
,
ocr_str
,
position_img_path
,
img_path
,
error_type
in
result_field_list
:
total_fields
+=
1
if
result
==
consts
.
RESULT_N
:
failed_count
+=
1
...
...
@@ -1256,7 +1257,7 @@ def se_compare_process(compare_info, ocr_res_dict):
consts
.
HEAD_LIST
[
4
]:
value
,
consts
.
HEAD_LIST
[
5
]:
ocr_str
,
consts
.
HEAD_LIST
[
6
]:
result
,
consts
.
HEAD_LIST
[
7
]:
empty_str
,
consts
.
HEAD_LIST
[
7
]:
position_img_path
,
consts
.
HEAD_LIST
[
8
]:
img_path
,
consts
.
HEAD_LIST
[
9
]:
error_type
,
}
...
...
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