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
rahul
aart_ppe_detection
Commits
2f1e4e02
Commit
2f1e4e02
authored
Jan 09, 2023
by
Sikhin VC
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
frame skip added
parent
dd217aee
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
5750 additions
and
28 deletions
+5750
-28
app.py
app.py
+1
-1
edge_engine/streamio/__pycache__/frameProcessor.cpython-39.pyc
...engine/streamio/__pycache__/frameProcessor.cpython-39.pyc
+0
-0
edge_engine/streamio/frameProcessor.py
edge_engine/streamio/frameProcessor.py
+7
-3
logs/ilens-edge_engine.log
logs/ilens-edge_engine.log
+5712
-0
scripts/__pycache__/ppe.cpython-39.pyc
scripts/__pycache__/ppe.cpython-39.pyc
+0
-0
scripts/ppe.py
scripts/ppe.py
+30
-24
No files found.
app.py
View file @
2f1e4e02
import
os
# os.environ["config"]="{\"TZ\": \"Asia/Kolkata\", \"MONGO_URI\": \"mongodb://svc-ilens:svc2345@192.168.3.220:21017\", \"MONGO_DATABASE\": \"ilens_wps\", \"MONGO_COLLECTION\": \"janusDeployment\", \"MONGO_KEY\": \"deploymentId\", \"MONGO_VALUE\": \"rahul_12345\", \"MONGO_COLL\": \"serviceConfiguration\", \"MONGO_DB\": \"ilens_wps\"}"
# os.environ["config"]="{\"TZ\": \"Asia/Kolkata\", \"MONGO_URI\": \"mongodb://admin:iLens$HPCLv605@10.5.2.91:2717\", \"MONGO_DATABASE\": \"ilens_ai\", \"MONGO_COLLECTION\": \"janusDeployment\", \"MONGO_KEY\": \"deploymentId\", \"MONGO_VALUE\": \"hpcl_cctv_ppe\", \"MONGO_COLL\": \"serviceConfiguration\", \"MONGO_DB\": \"ilens_ai\"}"
os
.
environ
[
"config"
]
=
"{
\"
TZ
\"
:
\"
Asia/Kolkata
\"
,
\"
MONGO_URI
\"
:
\"
mongodb://admin:iLens$1234@192.168.3.181:2717/admin
\"
,
\"
MONGO_DATABASE
\"
:
\"
ilens_ai
\"
,
\"
MONGO_COLLECTION
\"
:
\"
janusDeployment
\"
,
\"
MONGO_KEY
\"
:
\"
deploymentId
\"
,
\"
MONGO_VALUE
\"
:
\"
aarti_ppe
\"
,
\"
MONGO_COLL
\"
:
\"
serviceConfiguration
\"
,
\"
MONGO_DB
\"
:
\"
ilens_ai
\"
}"
#
os.environ["config"]="{\"TZ\": \"Asia/Kolkata\", \"MONGO_URI\": \"mongodb://admin:iLens$1234@192.168.3.181:2717/admin\", \"MONGO_DATABASE\": \"ilens_ai\", \"MONGO_COLLECTION\": \"janusDeployment\", \"MONGO_KEY\": \"deploymentId\", \"MONGO_VALUE\": \"aarti_ppe\", \"MONGO_COLL\": \"serviceConfiguration\", \"MONGO_DB\": \"ilens_ai\"}"
from
edge_engine.edge_processor
import
ExecutePipeline
from
edge_engine.edge_processor
import
Pubs
from
scripts
import
Ppe
...
...
edge_engine/streamio/__pycache__/frameProcessor.cpython-39.pyc
View file @
2f1e4e02
No preview for this file type
edge_engine/streamio/frameProcessor.py
View file @
2f1e4e02
...
...
@@ -8,6 +8,7 @@ class FrameProcessor:
self
.
stream
=
stream
logger
.
info
(
"Setting up frame processor !!"
)
self
.
count
=
0
self
.
skip_frame_every
=
30
# 1 does not skip any frame (n-1 frames get skipped)
def
run_model
(
self
):
while
self
.
stream
.
stream
.
isOpened
():
...
...
@@ -15,10 +16,13 @@ class FrameProcessor:
logger
.
debug
(
"Getting frame mask_model"
)
frame
=
self
.
stream
.
read
()
logger
.
debug
(
"Running mask_model"
)
data
=
{
"frame"
:
frame
,
"frameId"
:
"{}"
.
format
(
self
.
count
),
"deviceId"
:
"{}"
.
format
(
DEVICE_ID
)}
self
.
model
.
predict
(
data
)
logger
.
debug
(
"publishing mask_model output"
)
self
.
count
+=
1
if
frame
is
not
None
and
self
.
count
%
self
.
skip_frame_every
==
0
:
data
=
{
"frame"
:
frame
,
"frameId"
:
"{}"
.
format
(
self
.
count
),
"deviceId"
:
"{}"
.
format
(
DEVICE_ID
)}
self
.
model
.
predict
(
data
)
logger
.
debug
(
"publishing mask_model output"
)
except
Exception
as
e
:
logger
.
error
(
e
)
logger
.
error
(
traceback
.
format_exc
())
\ No newline at end of file
logs/ilens-edge_engine.log
View file @
2f1e4e02
This diff is collapsed.
Click to expand it.
scripts/__pycache__/ppe.cpython-39.pyc
View file @
2f1e4e02
No preview for this file type
scripts/ppe.py
View file @
2f1e4e02
...
...
@@ -436,14 +436,16 @@ class Ppe(ModelWrapper):
print
(
"sending to mongo"
)
self
.
send_payload
(
frame
=
resize_to_64_64
(
frame
),
message
=
temp_violation_list
,
event
=
violated_items
,
frame_id
=
self
.
frame_id
)
self
.
reported_violation_ids
[
object_id
]
=
time
.
time
()
sql
=
'INSERT INTO "aarti_violation_event_table" ("camera_id", "frame_id", "timestamp", "violation_type") VALUES (
%
s,
%
s,
%
s,
%
s);'
# for violated_items in violations:
# present_event_id = 'SELECT "event_id" FROM aarti_violation_event_table'
cur
=
self
.
conn
.
cursor
()
frame_count
=
self
.
frame_id
cur
.
execute
(
sql
,
[
4
,
frame_count
,
datetime
.
datetime
.
now
(),
violated_items
])
self
.
conn
.
commit
()
cur
.
close
()
for
v
in
violations
:
sql
=
'INSERT INTO "aarti_violation_event_table" ("camera_id", "frame_id", "timestamp", "violation_type") VALUES (
%
s,
%
s,
%
s,
%
s);'
# for violated_items in violations:
# present_event_id = 'SELECT "event_id" FROM aarti_violation_event_table'
cur
=
self
.
conn
.
cursor
()
frame_count
=
self
.
frame_id
cur
.
execute
(
sql
,
[
4
,
frame_count
,
datetime
.
datetime
.
now
(),
v
])
self
.
conn
.
commit
()
cur
.
close
()
else
:
time_diff
=
time
.
time
()
-
self
.
reported_violation_ids
[
object_id
]
if
(
time_diff
>
30
):
...
...
@@ -486,14 +488,16 @@ class Ppe(ModelWrapper):
print
(
"sending to mongo"
)
self
.
send_payload
(
frame
=
resize_to_64_64
(
frame
),
message
=
temp_violation_list
,
event
=
violated_items
,
frame_id
=
self
.
frame_id
)
self
.
reported_violation_ids
[
object_id
]
=
time
.
time
()
sql
=
'INSERT INTO "aarti_violation_event_table" ("camera_id", "frame_id", "timestamp", "violation_type") VALUES (
%
s,
%
s,
%
s,
%
s);'
# for violated_items in violations:
# present_event_id = 'SELECT "event_id" FROM aarti_violation_event_table'
cur
=
self
.
conn
.
cursor
()
frame_count
=
self
.
frame_id
cur
.
execute
(
sql
,
[
4
,
frame_count
,
datetime
.
datetime
.
now
(),
violated_items
])
self
.
conn
.
commit
()
cur
.
close
()
for
v
in
violations
:
sql
=
'INSERT INTO "aarti_violation_event_table" ("camera_id", "frame_id", "timestamp", "violation_type") VALUES (
%
s,
%
s,
%
s,
%
s);'
# for violated_items in violations:
# present_event_id = 'SELECT "event_id" FROM aarti_violation_event_table'
cur
=
self
.
conn
.
cursor
()
frame_count
=
self
.
frame_id
cur
.
execute
(
sql
,
[
4
,
frame_count
,
datetime
.
datetime
.
now
(),
v
])
self
.
conn
.
commit
()
cur
.
close
()
else
:
time_diff
=
time
.
time
()
-
self
.
reported_violation_ids
[
object_id
]
...
...
@@ -537,14 +541,16 @@ class Ppe(ModelWrapper):
print
(
"sending to mongo"
)
self
.
send_payload
(
frame
=
resize_to_64_64
(
frame
),
message
=
temp_violation_list
,
event
=
violated_items
,
frame_id
=
self
.
frame_id
)
self
.
reported_violation_ids
[
object_id
]
=
time
.
time
()
sql
=
'INSERT INTO "aarti_violation_event_table" ("camera_id", "frame_id", "timestamp", "violation_type") VALUES (
%
s,
%
s,
%
s,
%
s);'
# for violated_items in violations:
# present_event_id = 'SELECT "event_id" FROM aarti_violation_event_table'
cur
=
self
.
conn
.
cursor
()
frame_count
=
self
.
frame_id
cur
.
execute
(
sql
,
[
4
,
frame_count
,
datetime
.
datetime
.
now
(),
violated_items
])
self
.
conn
.
commit
()
cur
.
close
()
for
v
in
violations
:
sql
=
'INSERT INTO "aarti_violation_event_table" ("camera_id", "frame_id", "timestamp", "violation_type") VALUES (
%
s,
%
s,
%
s,
%
s);'
# for violated_items in violations:
# present_event_id = 'SELECT "event_id" FROM aarti_violation_event_table'
cur
=
self
.
conn
.
cursor
()
frame_count
=
self
.
frame_id
cur
.
execute
(
sql
,
[
4
,
frame_count
,
datetime
.
datetime
.
now
(),
v
])
self
.
conn
.
commit
()
cur
.
close
()
else
:
...
...
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