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
dc01eb99
Commit
dc01eb99
authored
May 08, 2023
by
Sikhin VC
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added datetime change API
parent
86f18c39
Pipeline
#69354
canceled with stage
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
1 deletion
+36
-1
edge_engine/common/config.py
edge_engine/common/config.py
+3
-0
scripts/cement_counter.py
scripts/cement_counter.py
+33
-1
No files found.
edge_engine/common/config.py
View file @
dc01eb99
...
...
@@ -36,6 +36,9 @@ MONGO_URI_ADD_EVENTLOGS = CONFIG_ENV.get('MONGO_URI',None)
url
=
GET_JANUS_DETAILS
+
DEPLOYMENT_ID
EDGE_CONFIG
=
requests
.
get
(
url
)
.
json
()[
"data"
]
LAST_COUNT
=
requests
.
get
(
url
)
.
json
()[
"latest_count"
]
date_url
=
"http://192.168.3.181/camera_api/get_curr_datetime"
DATE_TIME
=
requests
.
get
(
date_url
)
.
json
()[
"current_time"
]
if
not
LAST_COUNT
:
LAST_COUNT
=
0
DEVICE_ID
=
EDGE_CONFIG
[
"deviceId"
]
...
...
scripts/cement_counter.py
View file @
dc01eb99
...
...
@@ -13,9 +13,12 @@ from scripts.utils.image_utils import draw_circles_on_frame
from
scripts.utils.tracker
import
Tracker
from
scripts.utils.yolov5_trt
import
YoloV5TRT
from
scipy.optimize
import
linear_sum_assignment
as
linear_assignment
from
edge_engine.common.config
import
EDGE_CONFIG
,
LAST_COUNT
,
MONGO_URI_ADD_EVENTLOGS
from
edge_engine.common.config
import
EDGE_CONFIG
,
LAST_COUNT
,
MONGO_URI_ADD_EVENTLOGS
,
DATE_TIME
import
requests
from
uuid
import
uuid1
import
ctypes
import
ctypes.util
import
time
class
CementBagCounter
(
ModelWrapper
):
...
...
@@ -55,7 +58,36 @@ class CementBagCounter(ModelWrapper):
self
.
frame_count
=
0
self
.
frame
=
None
self
.
centroid_distance
=
10
self
.
set_time
(
DATE_TIME
)
def
set_time
(
self
,
time_tuple
):
# /usr/include/linux/time.h:
#
# define CLOCK_REALTIME 0
CLOCK_REALTIME
=
0
# /usr/include/time.h
#
# struct timespec
# {
# __time_t tv_sec; /* Seconds. */
# long int tv_nsec; /* Nanoseconds. */
# };
class
timespec
(
ctypes
.
Structure
):
_fields_
=
[(
"tv_sec"
,
ctypes
.
c_long
),
(
"tv_nsec"
,
ctypes
.
c_long
)]
librt
=
ctypes
.
CDLL
(
ctypes
.
util
.
find_library
(
"rt"
))
ts
=
timespec
()
ts
.
tv_sec
=
int
(
time
.
mktime
(
datetime
.
datetime
(
*
time_tuple
[:
6
])
.
timetuple
()
)
)
ts
.
tv_nsec
=
time_tuple
[
6
]
*
1000000
# Millisecond to nanosecond
# http://linux.die.net/man/3/clock_settime
librt
.
clock_settime
(
CLOCK_REALTIME
,
ctypes
.
byref
(
ts
))
logger
.
info
(
f
"Time set to {DATE_TIME}"
)
def
_pre_process
(
self
,
x
):
"""
Do preprocessing here, if any
...
...
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