Commit dd217aee authored by Sikhin VC's avatar Sikhin VC

initial commit

parent 8592705b
...@@ -77,7 +77,6 @@ class ExecutePipeline: ...@@ -77,7 +77,6 @@ class ExecutePipeline:
self.model = model self.model = model
def run_model(self): def run_model(self):
if EDGE_CONFIG["inputConf"]["sourceType"].lower() in ["rtsp", "usbcam"]: if EDGE_CONFIG["inputConf"]["sourceType"].lower() in ["rtsp", "usbcam"]:
logger.info("Selected input stream as Direct cv input") logger.info("Selected input stream as Direct cv input")
self.threadedVideoStream = ThreadedVideoStream(stream_config=EDGE_CONFIG["inputConf"]) self.threadedVideoStream = ThreadedVideoStream(stream_config=EDGE_CONFIG["inputConf"])
...@@ -85,7 +84,6 @@ class ExecutePipeline: ...@@ -85,7 +84,6 @@ class ExecutePipeline:
self.frameProcessor = FrameProcessor(stream=self.threadedVideoStream, self.frameProcessor = FrameProcessor(stream=self.threadedVideoStream,
model=self.model) model=self.model)
elif EDGE_CONFIG["inputConf"]["sourceType"].lower() == "videofile": elif EDGE_CONFIG["inputConf"]["sourceType"].lower() == "videofile":
self.fileVideoStream = FileVideoStream(stream_config=EDGE_CONFIG["inputConf"]) self.fileVideoStream = FileVideoStream(stream_config=EDGE_CONFIG["inputConf"])
self.fileVideoStream.start() self.fileVideoStream.start()
self.frameProcessor = FrameProcessor(stream=self.fileVideoStream, model=self.model) self.frameProcessor = FrameProcessor(stream=self.fileVideoStream, model=self.model)
......
...@@ -7,6 +7,7 @@ class FrameProcessor: ...@@ -7,6 +7,7 @@ class FrameProcessor:
self.model = model self.model = model
self.stream = stream self.stream = stream
logger.info("Setting up frame processor !!") logger.info("Setting up frame processor !!")
self.count = 0
def run_model(self): def run_model(self):
while self.stream.stream.isOpened(): while self.stream.stream.isOpened():
...@@ -14,9 +15,10 @@ class FrameProcessor: ...@@ -14,9 +15,10 @@ class FrameProcessor:
logger.debug("Getting frame mask_model") logger.debug("Getting frame mask_model")
frame = self.stream.read() frame = self.stream.read()
logger.debug("Running mask_model") logger.debug("Running mask_model")
data = {"frame": frame, "frameId": "{}".format(uuid4()), "deviceId": "{}".format(DEVICE_ID)} data = {"frame": frame, "frameId": "{}".format(self.count), "deviceId": "{}".format(DEVICE_ID)}
self.model.predict(data) self.model.predict(data)
logger.debug("publishing mask_model output") logger.debug("publishing mask_model output")
self.count += 1
except Exception as e: except Exception as e:
logger.error(e) logger.error(e)
logger.error(traceback.format_exc()) logger.error(traceback.format_exc())
\ No newline at end of file
...@@ -111,4 +111,4 @@ class FileVideoStream: ...@@ -111,4 +111,4 @@ class FileVideoStream:
# indicate that the thread should be stopped # indicate that the thread should be stopped
self.stopped = True self.stopped = True
# wait until stream resources are released (producer thread might be still grabbing frame) # wait until stream resources are released (producer thread might be still grabbing frame)
self.thread.join() self.thread.join()
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment