Skip to content

Commit f12ada0

Browse files
committed
Don not draw
1 parent 99c8b7a commit f12ada0

File tree

2 files changed

+26
-24
lines changed

2 files changed

+26
-24
lines changed

edgetpu_server/__init__.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ def __init__(
5151
homeassistant_config,
5252
port
5353
):
54-
self.app = get_app()
55-
self.port = port
54+
# self.app = get_app()
55+
# self.port = port
5656
labels = _read_label_file(label_path)
5757
detection_lock = Lock()
5858
self.engine = FilteredDetectionEngine(
@@ -76,7 +76,7 @@ def __init__(
7676
grabber_thread.start()
7777

7878
detection = DetectionThread(
79-
self.app.set_image_data,
79+
# self.app.set_image_data,
8080
entity_stream,
8181
self.engine,
8282
HomeAssistantApi(homeassistant_config),
@@ -89,4 +89,6 @@ def __init__(
8989

9090
def run(self):
9191
"""Start application loop."""
92-
self.app.run(host="0.0.0.0", port=self.port)
92+
# self.app.run(host="0.0.0.0", port=self.port)
93+
while True:
94+
time.sleep(1000)

edgetpu_server/detection_thread.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
class DetectionThread:
2525
"""Image detection thread."""
2626

27-
def __init__(self, set_image_data, entity_stream, engine, hass, video_stream_lock):
28-
self._set_image_data = set_image_data
27+
def __init__(self, entity_stream, engine, hass, video_stream_lock):
28+
# self._set_image_data = set_image_data
2929
self.entity_stream = entity_stream
3030
self.engine = engine
3131
self.hass = hass
@@ -47,7 +47,7 @@ def _retrieve_frame(self):
4747
self.video_stream_lock.release()
4848

4949
if not ret or not frame:
50-
return None, None
50+
return None
5151

5252
frame = cv2.cvtColor( # pylint: disable=no-member
5353
imutils.resize(
@@ -64,7 +64,7 @@ def _retrieve_frame(self):
6464
self.entity_stream.stream_url
6565
)
6666

67-
return Image.fromarray(frame), Image.fromarray(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB))
67+
return Image.fromarray(frame) #, Image.fromarray(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB))
6868

6969
def _process_frame(self, frame):
7070
start = datetime.now().timestamp()
@@ -112,12 +112,12 @@ def run(self):
112112
_LOGGER.warn('Running detection thread')
113113
while self.video_stream.isOpened():
114114
start = datetime.now().timestamp()
115-
frame, original = self._retrieve_frame()
116-
if original is None:
117-
_LOGGER.warning(
118-
"Unable to get original frame for %s",
119-
self.video_url
120-
)
115+
frame = self._retrieve_frame()
116+
# if original is None:
117+
# _LOGGER.warning(
118+
# "Unable to get original frame for %s",
119+
# self.video_url
120+
# )
121121
if frame is None:
122122
_LOGGER.warning(
123123
"Unable to retrieve frame %s, sleeping for %f s",
@@ -130,7 +130,7 @@ def run(self):
130130
detection_entity = self._process_frame(frame)
131131

132132
self._set_state(detection_entity)
133-
self._annotate_image(original, detection_entity)
133+
# self._annotate_image(original, detection_entity)
134134

135135
_LOGGER.debug(
136136
"Detection loop took %f ms time for %s (%s)",
@@ -140,12 +140,12 @@ def run(self):
140140
)
141141
_LOGGER.warn('Video stream closed')
142142

143-
def _annotate_image(self, frame, detection_entity):
144-
image_writer = ImageWriterThread(
145-
self._set_image_data,
146-
frame,
147-
detection_entity
148-
)
149-
150-
image_writer = Process(target=image_writer.run, daemon=True)
151-
image_writer.start()
143+
# def _annotate_image(self, frame, detection_entity):
144+
# image_writer = ImageWriterThread(
145+
# self._set_image_data,
146+
# frame,
147+
# detection_entity
148+
# )
149+
#
150+
# image_writer = Process(target=image_writer.run, daemon=True)
151+
# image_writer.start()

0 commit comments

Comments
 (0)