Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
license-plate-local
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dasharatha.vamshi
license-plate-local
Commits
8d23d0b1
Commit
8d23d0b1
authored
Aug 05, 2020
by
sidharth.singh
⚓
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
in-out logic
parent
6c38ec11
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
52557 additions
and
14 deletions
+52557
-14
log_demo_result.txt
log_demo_result.txt
+52484
-0
recognize/0.jpg
recognize/0.jpg
+0
-0
recognize/1.jpg
recognize/1.jpg
+0
-0
videos/truck.mp4
videos/truck.mp4
+0
-0
yolo_video.py
yolo_video.py
+73
-14
No files found.
log_demo_result.txt
View file @
8d23d0b1
This diff is collapsed.
Click to expand it.
recognize/0.jpg
View replaced file @
6c38ec11
View file @
8d23d0b1
2.12 KB
|
W:
|
H:
1000 Bytes
|
W:
|
H:
2-up
Swipe
Onion skin
recognize/1.jpg
View replaced file @
6c38ec11
View file @
8d23d0b1
3.24 KB
|
W:
|
H:
3.37 KB
|
W:
|
H:
2-up
Swipe
Onion skin
videos/truck.mp4
0 → 100644
View file @
8d23d0b1
File added
yolo_video.py
View file @
8d23d0b1
...
@@ -12,7 +12,9 @@ import os
...
@@ -12,7 +12,9 @@ import os
import
test
import
test
import
demo
import
demo
import
re
import
re
frame_count
=
1
frame_list
=
[]
in_out
=
{}
# construct the argument parse and parse the arguments
# construct the argument parse and parse the arguments
# ap = argparse.ArgumentParser()
# ap = argparse.ArgumentParser()
# ap.add_argument("-i", "--image", default="Trucks/3.jpg",
# ap.add_argument("-i", "--image", default="Trucks/3.jpg",
...
@@ -138,6 +140,58 @@ def yolo(image, detect_net, refine_net):
...
@@ -138,6 +140,58 @@ def yolo(image, detect_net, refine_net):
# show the output image
# show the output image
# demo.main(recognize_folder)
# demo.main(recognize_folder)
def
calculate_time
(
var
):
fields
=
{
"license_plate"
:
""
,
"timestamp"
:
""
}
if
(
len
(
var
)
==
10
):
frame_list
.
append
(
var
)
if
(
len
(
in_out
)
==
0
):
print
(
'-------------Adding for first Time----------------'
)
fields
[
"license_plate"
]
=
var
fields
[
"timestamp"
]
=
datetime
.
now
()
in_out
[
var
]
=
fields
else
:
if
var
in
in_out
.
keys
():
print
(
'-----------If it is present-----------------'
)
print
(
var
,
in_out
[
var
])
print
(
"in_time "
,
in_out
[
var
][
'timestamp'
])
print
(
"out_time "
,
datetime
.
now
())
print
(
'time_interval is '
,
datetime
.
now
()
-
in_out
[
var
][
'timestamp'
])
else
:
print
(
'--------------Not present adding----------------'
)
fields
[
'license_plate'
]
=
var
fields
[
'timestamp'
]
=
datetime
.
now
()
in_out
[
var
]
=
fields
print
(
in_out
)
# # print(frame_list,in_out)
# # occurances = frame_list.count(var)
# # if(occurances == frame_count):
# if(len(in_out["number_plates"]) == 0):
# fields["license_plate"] = var
# fields["timestamp"] = datetime.now()
# in_out["number_plates"].append(fields)
# else:
# for k in in_out["number_plates"]:
# print('k values are ---------------',k)
# print(var,len(in_out['number_plates']),k['license_plate'])
# if(k['license_plate'] == var):
# print('----------------------------------------------------',val,k['license_plate'])
# flag = False
# else:
# flag = True
# if(flag):
# fields["license_plate"] = var
# fields["timestamp"] = datetime.now()
# in_out["number_plates"].append(fields)
# if(flag == False):
# print('mtach -found------------------- ', k['license_plate'],var)
# print("in-time------------------- ", k["timestamp"])
# print("out-time-------------------", datetime.now())
# print("time interval is ------------------- ", datetime.now()-k["timestamp"])
# in_out['number_plates'] = list(dict.fromkeys(in_out['number_plates']))
# print(in_out)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
# upload_folder, image_name, image = yolo('Trucks/28.jpg')
# upload_folder, image_name, image = yolo('Trucks/28.jpg')
...
@@ -150,7 +204,7 @@ if __name__ == '__main__':
...
@@ -150,7 +204,7 @@ if __name__ == '__main__':
# print('Text Detected')
# print('Text Detected')
# final_list = demo.main(path, length)
# final_list = demo.main(path, length)
detect_net
,
refine_net
=
test
.
load_detection
()
detect_net
,
refine_net
=
test
.
load_detection
()
vs
=
cv2
.
VideoCapture
(
'videos/demo
1
.mp4'
)
vs
=
cv2
.
VideoCapture
(
'videos/demo.mp4'
)
writer
=
None
writer
=
None
time
.
sleep
(
1.0
)
time
.
sleep
(
1.0
)
count
=
0
count
=
0
...
@@ -169,7 +223,8 @@ if __name__ == '__main__':
...
@@ -169,7 +223,8 @@ if __name__ == '__main__':
print
(
x1
,
final_list
[
0
])
print
(
x1
,
final_list
[
0
])
if
x1
:
if
x1
:
print
(
'license-plate is ---> '
,
final_list
[
0
])
print
(
'license-plate is ---> '
,
final_list
[
0
])
var
=
final_list
[
0
]
var
=
final_list
[
0
]
.
replace
(
'.'
,
''
)
.
replace
(
' '
,
''
)
calculate_time
(
var
)
found
=
True
found
=
True
elif
len
(
final_list
)
>
1
:
elif
len
(
final_list
)
>
1
:
for
i
in
range
(
0
,
len
(
final_list
)
-
1
):
for
i
in
range
(
0
,
len
(
final_list
)
-
1
):
...
@@ -178,7 +233,8 @@ if __name__ == '__main__':
...
@@ -178,7 +233,8 @@ if __name__ == '__main__':
print
(
x1
,
final_list
[
i
])
print
(
x1
,
final_list
[
i
])
if
x1
:
if
x1
:
print
(
'license-plate is ---> '
,
final_list
[
i
])
print
(
'license-plate is ---> '
,
final_list
[
i
])
var
=
final_list
[
i
]
var
=
final_list
[
i
]
.
replace
(
'.'
,
''
)
.
replace
(
' '
,
''
)
calculate_time
(
var
)
found
=
True
found
=
True
else
:
else
:
found
=
False
found
=
False
...
@@ -192,7 +248,8 @@ if __name__ == '__main__':
...
@@ -192,7 +248,8 @@ if __name__ == '__main__':
if
x
:
if
x
:
print
(
'license-plate is ---> '
,
final_list
[
i
]
+
' '
+
final_list
[
i
+
1
])
print
(
'license-plate is ---> '
,
final_list
[
i
]
+
' '
+
final_list
[
i
+
1
])
var
=
final_list
[
i
]
+
' '
+
final_list
[
i
+
1
]
var
=
(
final_list
[
i
]
+
' '
+
final_list
[
i
+
1
])
.
replace
(
'.'
,
''
)
.
replace
(
' '
,
''
)
calculate_time
(
var
)
found
=
True
found
=
True
if
found
:
if
found
:
...
@@ -207,8 +264,8 @@ if __name__ == '__main__':
...
@@ -207,8 +264,8 @@ if __name__ == '__main__':
if
x
:
if
x
:
print
(
'license-plate is ---> '
,
print
(
'license-plate is ---> '
,
final_list
[
i
]
+
final_list
[
i
+
1
]
+
final_list
[
i
+
2
]
+
final_list
[
i
+
3
])
final_list
[
i
]
+
final_list
[
i
+
1
]
+
final_list
[
i
+
2
]
+
final_list
[
i
+
3
])
var
=
final_list
[
i
]
+
final_list
[
i
+
1
]
+
final_list
[
i
+
2
]
+
final_list
[
i
+
3
]
var
=
(
final_list
[
i
]
+
final_list
[
i
+
1
]
+
final_list
[
i
+
2
]
+
final_list
[
i
+
3
])
.
replace
(
'.'
,
''
)
.
replace
(
' '
,
''
)
calculate_time
(
var
)
found
=
True
found
=
True
else
:
else
:
found
=
False
found
=
False
...
@@ -223,21 +280,23 @@ if __name__ == '__main__':
...
@@ -223,21 +280,23 @@ if __name__ == '__main__':
if
x
:
if
x
:
print
(
'license-plate is ---> '
,
print
(
'license-plate is ---> '
,
final_list
[
i
]
+
final_list
[
i
+
1
]
+
final_list
[
i
+
2
])
final_list
[
i
]
+
final_list
[
i
+
1
]
+
final_list
[
i
+
2
])
var
=
(
final_list
[
i
]
+
final_list
[
i
+
1
]
+
final_list
[
i
+
2
])
var
=
(
final_list
[
i
]
+
final_list
[
i
+
1
]
+
final_list
[
i
+
2
])
.
replace
(
'.'
,
''
)
.
replace
(
' '
,
''
)
calculate_time
(
var
)
found
=
True
found
=
True
else
:
else
:
print
(
'not able to detect'
)
print
(
'not able to detect'
)
cv2
.
putText
(
image
,
var
,
(
50
,
50
),
cv2
.
putText
(
image
,
var
,
(
50
,
50
),
cv2
.
FONT_HERSHEY_SIMPLEX
,
1
,
(
0
,
0
,
255
),
2
)
cv2
.
FONT_HERSHEY_SIMPLEX
,
1
,
(
0
,
0
,
255
),
2
)
cv2
.
imshow
(
'image'
,
image
)
cv2
.
imshow
(
'image'
,
image
)
cv2
.
waitKey
(
1
)
cv2
.
waitKey
(
1
)
if
writer
is
None
:
#
if writer is None:
# initialize our video writer
#
# initialize our video writer
fourcc
=
cv2
.
VideoWriter_fourcc
(
*
"MJPG"
)
#
fourcc = cv2.VideoWriter_fourcc(*"MJPG")
writer
=
cv2
.
VideoWriter
(
'output.avi'
,
fourcc
,
30
,
#
writer = cv2.VideoWriter('output.avi', fourcc, 30,
(
image
.
shape
[
1
],
image
.
shape
[
0
]),
True
)
#
(image.shape[1], image.shape[0]), True)
writer
.
write
(
image
)
#
writer.write(image)
fps
.
update
()
fps
.
update
()
# if count == 10:
# if count == 10:
# break
# break
...
...
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