Skip to content

Commit 8fed348

Browse files
committed
fix: prime the EI pipeline at startup
1 parent 61f9e5b commit 8fed348

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/arduino/app_bricks/video_imageclassification/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import inspect
88
import threading
99
import socket
10+
import numpy as np
1011
from typing import Callable
1112

1213
from websockets.sync.client import connect, ClientConnection
@@ -179,6 +180,11 @@ def camera_loop(self):
179180
tcp_socket.connect((self._host, 5050))
180181
logger.info(f"TCP connection established to {self._host}:5050")
181182

183+
# Send a priming frame to initialize the EI pipeline and its web server
184+
frame = np.zeros((320, 320, 3), dtype=np.uint8)
185+
jpeg_frame = compress_to_jpeg(frame)
186+
tcp_socket.sendall(jpeg_frame.tobytes())
187+
182188
while self._is_running.is_set():
183189
try:
184190
frame = self._camera.capture()

src/arduino/app_bricks/video_objectdetection/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import inspect
88
import threading
99
import socket
10+
import numpy as np
1011
from typing import Callable
1112

1213
from websockets.sync.client import connect, ClientConnection
@@ -171,6 +172,11 @@ def camera_loop(self):
171172
tcp_socket.connect((self._host, 5050))
172173
logger.info(f"TCP connection established to {self._host}:5050")
173174

175+
# Send a priming frame to initialize the EI pipeline and its web server
176+
frame = np.zeros((320, 320, 3), dtype=np.uint8)
177+
jpeg_frame = compress_to_jpeg(frame)
178+
tcp_socket.sendall(jpeg_frame.tobytes())
179+
174180
while self._is_running.is_set():
175181
try:
176182
frame = self._camera.capture()

0 commit comments

Comments
 (0)