Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
aart_ppe_detection
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
sikhin.vc
aart_ppe_detection
Commits
494a31c4
Commit
494a31c4
authored
Jan 17, 2023
by
Sikhin VC
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added api recording feature
parent
ae9b6670
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
16 deletions
+16
-16
scripts/ppe.py
scripts/ppe.py
+16
-16
No files found.
scripts/ppe.py
View file @
494a31c4
...
@@ -454,7 +454,7 @@ class Ppe(ModelWrapper):
...
@@ -454,7 +454,7 @@ class Ppe(ModelWrapper):
# present_event_id = 'SELECT "event_id" FROM aarti_violation_event_table'
# present_event_id = 'SELECT "event_id" FROM aarti_violation_event_table'
cur
=
self
.
conn
.
cursor
()
cur
=
self
.
conn
.
cursor
()
frame_count
=
self
.
frame_id
frame_count
=
self
.
frame_id
file_path
=
"/home/administrator/
historical_videos/"
+
str
(
unique_id
)
+
".avi
"
file_path
=
"/home/administrator/
aarti_violation_videos/"
+
str
(
unique_id
)
+
".webm
"
cur
.
execute
(
sql
,
[
frame_count
,
4
,
str
(
unique_id
),
datetime
.
datetime
.
now
(),
file_path
,
v
])
cur
.
execute
(
sql
,
[
frame_count
,
4
,
str
(
unique_id
),
datetime
.
datetime
.
now
(),
file_path
,
v
])
self
.
conn
.
commit
()
self
.
conn
.
commit
()
cur
.
close
()
cur
.
close
()
...
@@ -463,7 +463,7 @@ class Ppe(ModelWrapper):
...
@@ -463,7 +463,7 @@ class Ppe(ModelWrapper):
self
.
send_payload
(
frame
=
resize_to_64_64
(
frame
),
message
=
temp_v_list
,
self
.
send_payload
(
frame
=
resize_to_64_64
(
frame
),
message
=
temp_v_list
,
event
=
v
,
frame_id
=
rec_inf
[
2
])
event
=
v
,
frame_id
=
rec_inf
[
2
])
with
open
(
"output/recorded_video_list.txt"
,
"a"
)
as
f
:
with
open
(
"output/recorded_video_list.txt"
,
"a"
)
as
f
:
f
.
write
(
rec_inf
[
2
]
+
".
avi
"
)
f
.
write
(
rec_inf
[
2
]
+
".
webm
"
)
f
.
write
(
"
\n
"
)
f
.
write
(
"
\n
"
)
del
self
.
active_rec
[
object_id
]
del
self
.
active_rec
[
object_id
]
...
@@ -556,7 +556,7 @@ class Ppe(ModelWrapper):
...
@@ -556,7 +556,7 @@ class Ppe(ModelWrapper):
# present_event_id = 'SELECT "event_id" FROM aarti_violation_event_table'
# present_event_id = 'SELECT "event_id" FROM aarti_violation_event_table'
cur
=
self
.
conn
.
cursor
()
cur
=
self
.
conn
.
cursor
()
frame_count
=
self
.
frame_id
frame_count
=
self
.
frame_id
file_path
=
"/home/administrator/
historical_videos/"
+
str
(
unique_id
)
+
".avi
"
file_path
=
"/home/administrator/
aarti_violation_videos/"
+
str
(
unique_id
)
+
".webm
"
cur
.
execute
(
sql
,
cur
.
execute
(
sql
,
[
frame_count
,
4
,
str
(
unique_id
),
datetime
.
datetime
.
now
(),
file_path
,
[
frame_count
,
4
,
str
(
unique_id
),
datetime
.
datetime
.
now
(),
file_path
,
v
])
v
])
...
@@ -567,7 +567,7 @@ class Ppe(ModelWrapper):
...
@@ -567,7 +567,7 @@ class Ppe(ModelWrapper):
self
.
send_payload
(
frame
=
resize_to_64_64
(
frame
),
message
=
temp_v_list
,
self
.
send_payload
(
frame
=
resize_to_64_64
(
frame
),
message
=
temp_v_list
,
event
=
v
,
frame_id
=
rec_inf
[
2
])
event
=
v
,
frame_id
=
rec_inf
[
2
])
with
open
(
"output/recorded_video_list.txt"
,
"a"
)
as
f
:
with
open
(
"output/recorded_video_list.txt"
,
"a"
)
as
f
:
f
.
write
(
rec_inf
[
2
]
+
".
avi
"
)
f
.
write
(
rec_inf
[
2
]
+
".
webm
"
)
f
.
write
(
"
\n
"
)
f
.
write
(
"
\n
"
)
del
self
.
active_rec
[
object_id
]
del
self
.
active_rec
[
object_id
]
...
@@ -597,7 +597,7 @@ class Ppe(ModelWrapper):
...
@@ -597,7 +597,7 @@ class Ppe(ModelWrapper):
cur
=
self
.
conn
.
cursor
()
cur
=
self
.
conn
.
cursor
()
# cur.execute("ROLLBACK")
# cur.execute("ROLLBACK")
frame_count
=
self
.
frame_id
frame_count
=
self
.
frame_id
file_path
=
"/home/administrator/
historical_videos/"
+
str
(
unique_id
)
+
".avi
"
file_path
=
"/home/administrator/
aarti_violation_videos/"
+
str
(
unique_id
)
+
".webm
"
cur
.
execute
(
sql
,
[
frame_count
,
4
,
str
(
unique_id
),
datetime
.
datetime
.
now
(),
file_path
,
v
])
cur
.
execute
(
sql
,
[
frame_count
,
4
,
str
(
unique_id
),
datetime
.
datetime
.
now
(),
file_path
,
v
])
self
.
conn
.
commit
()
self
.
conn
.
commit
()
cur
.
close
()
cur
.
close
()
...
@@ -607,7 +607,7 @@ class Ppe(ModelWrapper):
...
@@ -607,7 +607,7 @@ class Ppe(ModelWrapper):
self
.
send_payload
(
frame
=
resize_to_64_64
(
frame
),
message
=
temp_v_list
,
self
.
send_payload
(
frame
=
resize_to_64_64
(
frame
),
message
=
temp_v_list
,
event
=
v
,
frame_id
=
rec_inf
[
2
])
event
=
v
,
frame_id
=
rec_inf
[
2
])
with
open
(
"output/recorded_video_list.txt"
,
"a"
)
as
f
:
with
open
(
"output/recorded_video_list.txt"
,
"a"
)
as
f
:
f
.
write
(
rec_inf
[
2
]
+
".
avi
"
)
f
.
write
(
rec_inf
[
2
]
+
".
webm
"
)
f
.
write
(
"
\n
"
)
f
.
write
(
"
\n
"
)
del
self
.
active_rec
[
object_id
]
del
self
.
active_rec
[
object_id
]
...
@@ -644,7 +644,7 @@ class Ppe(ModelWrapper):
...
@@ -644,7 +644,7 @@ class Ppe(ModelWrapper):
# unique_id = uuid.uuid4()
# unique_id = uuid.uuid4()
unique_id
=
str
(
uuid
.
uuid4
())
+
str
(
time
.
time
())
unique_id
=
str
(
uuid
.
uuid4
())
+
str
(
time
.
time
())
# with open("recorded_video_list.txt", "a") as f:
# with open("recorded_video_list.txt", "a") as f:
# f.write(unique_id + ".
avi
")
# f.write(unique_id + ".
webm
")
# f.write("\n")
# f.write("\n")
# result = self.video_write(frame, unique_id)
# result = self.video_write(frame, unique_id)
requests
.
post
(
'http://localhost:2328/items/'
,
json
=
{
requests
.
post
(
'http://localhost:2328/items/'
,
json
=
{
...
@@ -675,7 +675,7 @@ class Ppe(ModelWrapper):
...
@@ -675,7 +675,7 @@ class Ppe(ModelWrapper):
# cur = self.conn.cursor()
# cur = self.conn.cursor()
# # cur.execute("ROLLBACK")
# # cur.execute("ROLLBACK")
# frame_count = self.frame_id
# frame_count = self.frame_id
# file_path = "/home/administrator/historical_videos/" + str(unique_id) + ".
avi
"
# file_path = "/home/administrator/historical_videos/" + str(unique_id) + ".
webm
"
# cur.execute(sql, [frame_count, 4, str(unique_id), datetime.datetime.now(), file_path, v])
# cur.execute(sql, [frame_count, 4, str(unique_id), datetime.datetime.now(), file_path, v])
# self.conn.commit()
# self.conn.commit()
# cur.close()
# cur.close()
...
@@ -700,7 +700,7 @@ class Ppe(ModelWrapper):
...
@@ -700,7 +700,7 @@ class Ppe(ModelWrapper):
cur
=
self
.
conn
.
cursor
()
cur
=
self
.
conn
.
cursor
()
# cur.execute("ROLLBACK")
# cur.execute("ROLLBACK")
frame_count
=
self
.
frame_id
frame_count
=
self
.
frame_id
file_path
=
"/home/administrator/
historical_videos/"
+
str
(
unique_id
)
+
".avi
"
file_path
=
"/home/administrator/
aarti_violation_videos/"
+
str
(
unique_id
)
+
".webm
"
cur
.
execute
(
sql
,
cur
.
execute
(
sql
,
[
frame_count
,
4
,
str
(
unique_id
),
datetime
.
datetime
.
now
(),
file_path
,
[
frame_count
,
4
,
str
(
unique_id
),
datetime
.
datetime
.
now
(),
file_path
,
v
])
v
])
...
@@ -711,7 +711,7 @@ class Ppe(ModelWrapper):
...
@@ -711,7 +711,7 @@ class Ppe(ModelWrapper):
self
.
send_payload
(
frame
=
resize_to_64_64
(
frame
),
message
=
temp_v_list
,
self
.
send_payload
(
frame
=
resize_to_64_64
(
frame
),
message
=
temp_v_list
,
event
=
v
,
frame_id
=
rec_inf
[
2
])
event
=
v
,
frame_id
=
rec_inf
[
2
])
with
open
(
"output/recorded_video_list.txt"
,
"a"
)
as
f
:
with
open
(
"output/recorded_video_list.txt"
,
"a"
)
as
f
:
f
.
write
(
rec_inf
[
2
]
+
".
avi
"
)
f
.
write
(
rec_inf
[
2
]
+
".
webm
"
)
f
.
write
(
"
\n
"
)
f
.
write
(
"
\n
"
)
del
self
.
active_rec
[
object_id
]
del
self
.
active_rec
[
object_id
]
...
@@ -739,7 +739,7 @@ class Ppe(ModelWrapper):
...
@@ -739,7 +739,7 @@ class Ppe(ModelWrapper):
cur
=
self
.
conn
.
cursor
()
cur
=
self
.
conn
.
cursor
()
# cur.execute("ROLLBACK")
# cur.execute("ROLLBACK")
frame_count
=
self
.
frame_id
frame_count
=
self
.
frame_id
file_path
=
"/home/administrator/
historical_videos/"
+
str
(
unique_id
)
+
".avi
"
file_path
=
"/home/administrator/
aarti_violation_videos/"
+
str
(
unique_id
)
+
".webm
"
cur
.
execute
(
sql
,
[
frame_count
,
4
,
str
(
unique_id
),
datetime
.
datetime
.
now
(),
file_path
,
v
])
cur
.
execute
(
sql
,
[
frame_count
,
4
,
str
(
unique_id
),
datetime
.
datetime
.
now
(),
file_path
,
v
])
self
.
conn
.
commit
()
self
.
conn
.
commit
()
cur
.
close
()
cur
.
close
()
...
@@ -749,7 +749,7 @@ class Ppe(ModelWrapper):
...
@@ -749,7 +749,7 @@ class Ppe(ModelWrapper):
self
.
send_payload
(
frame
=
resize_to_64_64
(
frame
),
message
=
temp_v_list
,
self
.
send_payload
(
frame
=
resize_to_64_64
(
frame
),
message
=
temp_v_list
,
event
=
v
,
frame_id
=
rec_inf
[
2
])
event
=
v
,
frame_id
=
rec_inf
[
2
])
with
open
(
"output/recorded_video_list.txt"
,
"a"
)
as
f
:
with
open
(
"output/recorded_video_list.txt"
,
"a"
)
as
f
:
f
.
write
(
rec_inf
[
2
]
+
".
avi
"
)
f
.
write
(
rec_inf
[
2
]
+
".
webm
"
)
f
.
write
(
"
\n
"
)
f
.
write
(
"
\n
"
)
del
self
.
active_rec
[
object_id
]
del
self
.
active_rec
[
object_id
]
...
@@ -784,7 +784,7 @@ class Ppe(ModelWrapper):
...
@@ -784,7 +784,7 @@ class Ppe(ModelWrapper):
# unique_id = uuid.uuid4()
# unique_id = uuid.uuid4()
unique_id
=
str
(
uuid
.
uuid4
())
+
str
(
time
.
time
())
unique_id
=
str
(
uuid
.
uuid4
())
+
str
(
time
.
time
())
# with open("recorded_video_list.txt", "a") as f:
# with open("recorded_video_list.txt", "a") as f:
# f.write(unique_id + ".
avi
")
# f.write(unique_id + ".
webm
")
# f.write("\n")
# f.write("\n")
# result = self.video_write(frame, unique_id)
# result = self.video_write(frame, unique_id)
requests
.
post
(
'http://localhost:2328/items/'
,
json
=
{
requests
.
post
(
'http://localhost:2328/items/'
,
json
=
{
...
@@ -815,7 +815,7 @@ class Ppe(ModelWrapper):
...
@@ -815,7 +815,7 @@ class Ppe(ModelWrapper):
# cur = self.conn.cursor()
# cur = self.conn.cursor()
# # cur.execute("ROLLBACK")
# # cur.execute("ROLLBACK")
# frame_count = self.frame_id
# frame_count = self.frame_id
# file_path = "/home/administrator/historical_videos/" + str(unique_id) + ".
avi
"
# file_path = "/home/administrator/historical_videos/" + str(unique_id) + ".
webm
"
# cur.execute(sql, [frame_count, 4, str(unique_id), datetime.datetime.now(), file_path, v])
# cur.execute(sql, [frame_count, 4, str(unique_id), datetime.datetime.now(), file_path, v])
# self.conn.commit()
# self.conn.commit()
# cur.close()
# cur.close()
...
@@ -844,7 +844,7 @@ class Ppe(ModelWrapper):
...
@@ -844,7 +844,7 @@ class Ppe(ModelWrapper):
cur
=
self
.
conn
.
cursor
()
cur
=
self
.
conn
.
cursor
()
# cur.execute("ROLLBACK")
# cur.execute("ROLLBACK")
frame_count
=
self
.
frame_id
frame_count
=
self
.
frame_id
file_path
=
"/home/administrator/
historical_videos/"
+
str
(
unique_id
)
+
".avi
"
file_path
=
"/home/administrator/
aarti_violation_videos/"
+
str
(
unique_id
)
+
".webm
"
cur
.
execute
(
sql
,
cur
.
execute
(
sql
,
[
frame_count
,
4
,
str
(
unique_id
),
datetime
.
datetime
.
now
(),
file_path
,
[
frame_count
,
4
,
str
(
unique_id
),
datetime
.
datetime
.
now
(),
file_path
,
v
])
v
])
...
@@ -856,7 +856,7 @@ class Ppe(ModelWrapper):
...
@@ -856,7 +856,7 @@ class Ppe(ModelWrapper):
self
.
send_payload
(
frame
=
resize_to_64_64
(
frame
),
message
=
temp_v_list
,
self
.
send_payload
(
frame
=
resize_to_64_64
(
frame
),
message
=
temp_v_list
,
event
=
v
,
frame_id
=
rec_inf
[
2
])
event
=
v
,
frame_id
=
rec_inf
[
2
])
with
open
(
"output/recorded_video_list.txt"
,
"a"
)
as
f
:
with
open
(
"output/recorded_video_list.txt"
,
"a"
)
as
f
:
f
.
write
(
rec_inf
[
2
]
+
".
avi
"
)
f
.
write
(
rec_inf
[
2
]
+
".
webm
"
)
f
.
write
(
"
\n
"
)
f
.
write
(
"
\n
"
)
del
self
.
active_rec
[
object_id
]
del
self
.
active_rec
[
object_id
]
...
...
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