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
6997fd7e
Commit
6997fd7e
authored
May 05, 2023
by
Sikhin VC
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added server API endpoints
parent
663fd942
Pipeline
#69195
failed with stage
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
128 deletions
+8
-128
app.py
app.py
+1
-1
edge_engine/common/config.py
edge_engine/common/config.py
+5
-4
scripts/cement_counter.py
scripts/cement_counter.py
+2
-3
scripts/utils/edge_utils.py
scripts/utils/edge_utils.py
+0
-120
No files found.
app.py
View file @
6997fd7e
import
os
import
os
# os.environ["config"]="{\"
MONGO_VALUE
\": \"jkv1_dba3e4e8\"}"
# os.environ["config"]="{\"
deployment ID
\": \"jkv1_dba3e4e8\"}"
from
edge_engine.edge_processor
import
ExecutePipeline
from
edge_engine.edge_processor
import
ExecutePipeline
from
edge_engine.edge_processor
import
Pubs
from
edge_engine.edge_processor
import
Pubs
from
scripts
import
CementBagCounter
from
scripts
import
CementBagCounter
...
...
edge_engine/common/config.py
View file @
6997fd7e
...
@@ -30,10 +30,11 @@ if not os.path.isdir(BASE_LOG_PATH):
...
@@ -30,10 +30,11 @@ if not os.path.isdir(BASE_LOG_PATH):
CONFIG_ENV
=
json
.
loads
(
os
.
environ
.
get
(
'config'
,
default
=
None
))
CONFIG_ENV
=
json
.
loads
(
os
.
environ
.
get
(
'config'
,
default
=
None
))
DEPLOYMENT_ID
=
CONFIG_ENV
.
get
(
'MONGO_VALUE'
,
None
)
DEPLOYMENT_ID
=
CONFIG_ENV
.
get
(
'deployment ID'
,
None
)
GET_JANUS_DETAILS
=
CONFIG_ENV
.
get
(
'GET_JANUS_DETAILS'
,
None
)
url
=
f
'http://192.168.3.181/camera_api/custom/get_janus?deploymentId={DEPLOYMENT_ID}'
MONGO_URI_ADD_EVENTLOGS
=
CONFIG_ENV
.
get
(
'MONGO_URI_ADD_EVENTLOGS'
,
None
)
url
=
GET_JANUS_DETAILS
+
DEPLOYMENT_ID
print
(
url
)
EDGE_CONFIG
=
requests
.
get
(
url
)
.
json
()[
"data"
]
EDGE_CONFIG
=
requests
.
get
(
url
)
.
json
()[
"data"
]
LAST_COUNT
=
requests
.
get
(
url
)
.
json
()[
"latest_count"
]
LAST_COUNT
=
requests
.
get
(
url
)
.
json
()[
"latest_count"
]
...
...
scripts/cement_counter.py
View file @
6997fd7e
...
@@ -19,7 +19,7 @@ from scripts.utils.infocenter import MongoLogger
...
@@ -19,7 +19,7 @@ from scripts.utils.infocenter import MongoLogger
from
scripts.utils.tracker
import
Tracker
from
scripts.utils.tracker
import
Tracker
from
scripts.utils.yolov5_trt
import
YoloV5TRT
from
scripts.utils.yolov5_trt
import
YoloV5TRT
from
scipy.optimize
import
linear_sum_assignment
as
linear_assignment
from
scipy.optimize
import
linear_sum_assignment
as
linear_assignment
from
edge_engine.common.config
import
EDGE_CONFIG
,
LAST_COUNT
from
edge_engine.common.config
import
EDGE_CONFIG
,
LAST_COUNT
,
MONGO_URI_ADD_EVENTLOGS
import
requests
import
requests
from
uuid
import
uuid1
from
uuid
import
uuid1
...
@@ -328,8 +328,7 @@ class CementBagCounter(ModelWrapper):
...
@@ -328,8 +328,7 @@ class CementBagCounter(ModelWrapper):
elif
object_id
in
self
.
uncounted_objects
:
elif
object_id
in
self
.
uncounted_objects
:
self
.
uncounted_objects
.
pop
(
object_id
,
None
)
self
.
uncounted_objects
.
pop
(
object_id
,
None
)
self
.
count
+=
1
self
.
count
+=
1
url
=
"http://192.168.3.181/camera_api/events/add_event"
url
=
MONGO_URI_ADD_EVENTLOGS
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
...
...
scripts/utils/edge_utils.py
deleted
100644 → 0
View file @
663fd942
# from scripts.common.constants import JanusDeploymentConstants
#
# import cv2
#
# from edge_engine.common.logsetup import logger
# #from scripts.common.config import MONGO_DB_OBJ, APP_MONGO_COLLECTION
# #from scripts.common.constants import JanusDeploymentConstants
#
#
# class Utilities:
#
# @classmethod
# def get_extra_fields(
# cls,
# device_id,
# ):
# _janus_deployment = MONGO_DB_OBJ[
# APP_MONGO_COLLECTION.get(JanusDeploymentConstants.JANUS_DEPLOYMENT_COLLECTION)].find_one(
# {JanusDeploymentConstants.DEPLOYMENT_ID: device_id}).get(
# JanusDeploymentConstants.EXTRA_FIELDS_KEY)
# if _janus_deployment is None:
# raise ValueError("Janus deployment configuration is not found/corrupted")
#
# _key_dictionary = dict()
# for each_field in _janus_deployment:
# _key_dictionary[each_field['key']] = each_field['value']
# return _key_dictionary
#
# @classmethod
# def get_direction(
# cls,
# device_id,
# ):
# logger.debug("Getting the direction from DB")
# return MONGO_DB_OBJ[APP_MONGO_COLLECTION.get(JanusDeploymentConstants.JANUS_DEPLOYMENT_COLLECTION)].find_one(
# {JanusDeploymentConstants.DEPLOYMENT_ID: device_id}).get(
# JanusDeploymentConstants.DIRECTION_KEY)
#
# @classmethod
# def set_direction(
# cls,
# device_id: str,
# direction: bool,
# ):
# logger.debug("Updating the direction in DB")
# updated_values = {"$set": {JanusDeploymentConstants.DIRECTION_KEY: direction}}
# MONGO_DB_OBJ[APP_MONGO_COLLECTION.get(JanusDeploymentConstants.JANUS_DEPLOYMENT_COLLECTION)].update_one(
# {JanusDeploymentConstants.DEPLOYMENT_ID: device_id}, updated_values)
#
# @classmethod
# def draw_circles_on_frame(
# cls,
# frame,
# point,
# radius=3,
# color=(255, 255, 255),
# thickness=1,
# ):
# """
# draw circle on the objects
# :param radius: radius of the circle
# :param frame: frame to draw on
# :param point: co-ordinate to draw on
# :param color: color of the circle
# :param thickness: thickness of the circle
# :return: frame
# """
# return cv2.circle(frame, tuple(point), radius, color, thickness)
#
# @classmethod
# def resize_to_64_64(
# cls,
# frame,
# ):
# """
# resize the from
# :param frame: frame
# :return: frame
# """
# return cv2.resize(frame, (64, 64))
#
#
# def get_extra_fields(device_id):
# # _janus_deployment = [
# # {
# # "type": "number",
# # "key": "x1",
# # "value": 1000
# # },
# # {
# # "type": "number",
# # "key": "y1",
# # "value": 0
# # },
# # {
# # "type": "number",
# # "key": "x2",
# # "value": 1001
# # },
# # {
# # "type": "number",
# # "key": "y2",
# # "value": 720
# # },
# # {
# # "type": "dropdown",
# # "key": "alignment",
# # "value": "vertical"
# # }
# # ]
# _janus_deployment = MONGO_DB_OBJ[APP_MONGO_COLLECTION.get(JanusDeploymentConstants.JANUS_DEPLOYMENT_COLLECTION)]. \
# find_one({JanusDeploymentConstants.DEPLOYMENT_ID: device_id}).get(JanusDeploymentConstants.EXTRA_FIELDS_KEY)
#
# if _janus_deployment is None:
# raise ValueError("Janus deployment configuration is not found/corrupted")
#
# _key_dictionary = dict()
# for each_field in _janus_deployment:
# _key_dictionary[each_field['key']] = each_field['value']
# return _key_dictionary
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