Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jk_edge_code_api_integration
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
jk_edge_code_api_integration
Commits
5f3b1f85
Commit
5f3b1f85
authored
May 09, 2023
by
Sikhin VC
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added app key in events API
parent
fcf7fca5
Pipeline
#69493
canceled with stage
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
22 deletions
+1
-22
scripts/cement_counter.py
scripts/cement_counter.py
+1
-22
No files found.
scripts/cement_counter.py
View file @
5f3b1f85
...
@@ -75,27 +75,6 @@ class CementBagCounter(ModelWrapper):
...
@@ -75,27 +75,6 @@ class CementBagCounter(ModelWrapper):
logger
.
info
(
"Pushed frame"
)
logger
.
info
(
"Pushed frame"
)
return
x
return
x
def
send_payload
(
self
,
frame
,
count
,
bag_type
=
''
,
label
=
'CementBagDetected'
,
bg_color
=
"#474520"
,
font_color
=
"#FFFF00"
,
alert_sound
=
None
,
message
=
"Cement Bag Detected!"
):
"""
Insert event to Mongo
:param message:
:param frame:
:param label:
:param bg_color:
:param font_color:
:param alert_sound:
:return: None
"""
payload
=
{
"deviceId"
:
self
.
device_id
,
"message"
:
message
,
"frame"
:
'data:image/jpeg;base64,'
+
base64
.
b64encode
(
cv2
.
imencode
(
'.jpg'
,
frame
)[
1
]
.
tostring
())
.
decode
(
"utf-8"
),
"activity"
:
label
,
"bg_color"
:
bg_color
,
"font_color"
:
font_color
,
"alert_sound"
:
alert_sound
,
"bag_type"
:
bag_type
,
"cement_bag_count"
:
count
}
self
.
mongo_logger
.
insert_attendance_event_to_mongo
(
payload
)
def
kalman_tracker
(
def
kalman_tracker
(
self
,
self
,
bboxs
,
bboxs
,
...
@@ -323,7 +302,7 @@ class CementBagCounter(ModelWrapper):
...
@@ -323,7 +302,7 @@ class CementBagCounter(ModelWrapper):
img2
=
frame
.
copy
()
img2
=
frame
.
copy
()
img2
=
cv2
.
resize
(
img2
,
(
64
,
64
))
img2
=
cv2
.
resize
(
img2
,
(
64
,
64
))
bs64
=
str
(
base64
.
b64encode
(
img2
)
.
decode
(
'utf-8'
))
# Changed this line. converted byte to string
bs64
=
str
(
base64
.
b64encode
(
img2
)
.
decode
(
'utf-8'
))
# Changed this line. converted byte to string
json
=
{
"eventId"
:
str
(
uuid1
())
.
split
(
'-'
)[
0
],
"cameraId"
:
EDGE_CONFIG
[
'deviceId'
],
"cameraName"
:
EDGE_CONFIG
[
'deviceId'
],
"timestamp"
:
datetime
.
isoformat
(
datetime
.
now
()),
"frame"
:
bs64
,
"cement_bag_count"
:
str
(
self
.
count
)}
json
=
{
"eventId"
:
str
(
uuid1
())
.
split
(
'-'
)[
0
],
"cameraId"
:
EDGE_CONFIG
[
'deviceId'
],
"cameraName"
:
EDGE_CONFIG
[
'deviceId'
],
"timestamp"
:
datetime
.
isoformat
(
datetime
.
now
()),
"frame"
:
bs64
,
"cement_bag_count"
:
str
(
self
.
count
)
,
"app"
:
"cement"
}
requests
.
post
(
url
=
MONGO_URI_ADD_EVENTLOGS
,
json
=
json
)
requests
.
post
(
url
=
MONGO_URI_ADD_EVENTLOGS
,
json
=
json
)
logger
.
info
(
f
"Count: {self.count}"
)
logger
.
info
(
f
"Count: {self.count}"
)
frame
=
draw_circles_on_frame
(
frame
=
draw_circles_on_frame
(
...
...
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