Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
my_flask_web
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 3519390c
authored
Mar 06, 2024
by
周杭
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
增加耗时时间
1 parent
018a16a4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
10 deletions
Identify_vinandsn/main04.py
Identify_vinandsn/main04.py
View file @
3519390
...
...
@@ -166,7 +166,7 @@ def flip_image(image,angle):
return
rotated_image
def
handler_vin
(
dst
,
flag
,
angle
,
path
):
def
handler_vin
(
dst
,
flag
,
angle
,
path
,
start_time
):
if
angle
>
0
:
dst
=
flip_image
(
dst
,
angle
)
...
...
@@ -201,10 +201,15 @@ def handler_vin(dst, flag, angle, path):
if
vin_str
:
print
(
str
(
row
))
print
(
vin_str
)
# 记录结束时间
end_time
=
time
.
time
()
elapsed_time
=
end_time
-
start_time
# 格式化时间戳,保留两位小数
formatted_timestamp
=
"{:.2f}"
.
format
(
elapsed_time
)
# 定义要执行的SQL语句
SQL01
=
f
"""
INSERT INTO sys_vin_check_ocr_11 (order_id,file_id,db_vin,ocr_vin,create_time)
VALUES ({row[1]},{row[0]},'{row[9]}','{vin_str}',sysdate())
INSERT INTO sys_vin_check_ocr_11 (order_id,file_id,db_vin,ocr_vin,create_time
,hssj
)
VALUES ({row[1]},{row[0]},'{row[9]}','{vin_str}',sysdate()
,'{formatted_timestamp}'
)
"""
# 执行SQL语句
print
(
SQL01
)
...
...
@@ -214,6 +219,9 @@ def handler_vin(dst, flag, angle, path):
# 下载图片数据
for
index
,
row
in
enumerate
(
result
):
# 记录开始时间
start_time
=
time
.
time
()
print
(
row
)
filename
=
generate_random_filename
()
network_img_path
=
row
[
4
]
...
...
@@ -257,16 +265,16 @@ for index, row in enumerate(result):
(
original_image
.
width
*
scale_factor
,
original_image
.
height
*
scale_factor
)
)
flag
=
True
flag
=
handler_vin
(
dst
,
flag
,
0
,
path
,
row
)
flag
=
handler_vin
(
dst
,
flag
,
0
,
path
,
row
,
start_time
)
if
flag
:
# 旋转45度宠重新识别
flag
=
handler_vin
(
dst
,
flag
,
45
,
path
,
row
)
flag
=
handler_vin
(
dst
,
flag
,
45
,
path
,
row
,
start_time
)
if
flag
:
# 旋转90度宠重新识别
flag
=
handler_vin
(
dst
,
flag
,
45
,
path
,
row
)
flag
=
handler_vin
(
dst
,
flag
,
45
,
path
,
row
,
start_time
)
if
flag
:
# 旋转180度宠重新识别
flag
=
handler_vin
(
dst
,
flag
,
90
,
path
,
row
)
flag
=
handler_vin
(
dst
,
flag
,
90
,
path
,
row
,
start_time
)
if
flag
:
# 如果识别不了 直接再放大图片
scale_factor
=
5
...
...
@@ -276,12 +284,12 @@ for index, row in enumerate(result):
original_image
.
height
*
scale_factor
,
)
)
flag
=
handler_vin
(
dst
,
flag
,
0
,
path
,
row
)
flag
=
handler_vin
(
dst
,
flag
,
0
,
path
,
row
,
start_time
)
if
flag
:
# 定义要执行的SQL语句
SQL02
=
f
"""
INSERT INTO sys_vin_check_ocr_11 (order_id,file_id,db_vin,ocr_vin,create_time)
VALUES ({row[1]},{row[0]},'{row[9]}',null,sysdate())
INSERT INTO sys_vin_check_ocr_11 (order_id,file_id,db_vin,ocr_vin,create_time
,hssj
)
VALUES ({row[1]},{row[0]},'{row[9]}',null,sysdate()
,null
)
"""
# 执行SQL语句
print
(
SQL02
)
...
...
Write
Preview
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