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
4419c003
authored
2021-08-06 17:48:26 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix bug
1 parent
b3e0d9bc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
src/apps/doc/management/commands/folder_ltgt_process.py
src/apps/doc/management/commands/folder_ltgt_process.py
View file @
4419c00
...
...
@@ -102,7 +102,7 @@ class Command(BaseCommand, LoggerMixin):
id_card_dict
.
pop
(
'base64_img'
)
except
Exception
as
e
:
continue
all_res
.
app
end
(
license_data
)
all_res
.
ext
end
(
license_data
)
def
license2_process
(
self
,
ocr_data
,
all_res
,
classify
,
img_path
):
pid
,
_
,
_
,
_
,
_
,
_
=
consts
.
LICENSE_CLASSIFY_MAPPING
.
get
(
classify
)
...
...
@@ -238,6 +238,7 @@ class Command(BaseCommand, LoggerMixin):
self
.
license1_process
(
ocr_data
,
all_res
,
classify
)
elif
classify
in
consts
.
LICENSE_CLASSIFY_SET_2
:
self
.
license2_process
(
ocr_data
,
all_res
,
classify
,
img_path
)
break
else
:
self
.
folder_log
.
warn
(
'{0} [ocr failed] [img_path={1}]'
.
format
(
self
.
log_base
,
img_path
))
...
...
@@ -300,9 +301,9 @@ class Command(BaseCommand, LoggerMixin):
all_res
=
[]
for
img_path
in
img_path_list
:
self
.
ocr_process
(
img_path
,
classify
,
all_res
,
seperate_dir
)
if
len
(
all_res
)
>
0
:
self
.
res_process
(
all_res
,
excel_path
,
classify
)
return
all_res
#
if len(all_res) > 0:
self
.
res_process
(
all_res
,
excel_path
,
classify
)
return
all_res
def
pdf_process
(
self
,
name
,
path
,
classify
,
img_output_dir
,
wb_output_dir
,
pdf_output_dir
,
seperate_dir
):
if
os
.
path
.
exists
(
path
):
...
...
@@ -365,7 +366,7 @@ class Command(BaseCommand, LoggerMixin):
if
classify
in
self
.
ltgt_classify_mapping
:
rebuild_res
=
self
.
ltgt_process
([
path
],
self
.
ltgt_classify_mapping
[
classify
],
excel_path
,
path
)
else
:
rebuild_res
=
self
.
images_process
([
img_save_
path
],
classify
,
excel_path
,
seperate_path
)
rebuild_res
=
self
.
images_process
([
path
],
classify
,
excel_path
,
seperate_path
)
shutil
.
move
(
path
,
img_save_path
)
return
rebuild_res
...
...
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