np.ndarray with shape (height, width, 3), dtype uint8, in RGB channel order. Input buffers are cleaned up automatically between client sessions, so you don’t need to handle disconnection or reset anything.
Declaring input tracks
webcam buffer automatically. You access them via self.input.webcam.
Reading frames
Usetry_read() to read input frames inside inference(). It always returns the most recent frames and discards any older backlog, so your model always processes the freshest input.
try_read()
Returns a list of the most recent n frames, or None if fewer than n are available. When None is returned the buffer is left untouched, so nothing is lost.
while loop yields Idle until a frame arrives. Each yield Idle hands control back to the runtime so events can be delivered and the output stream stays smooth. Without it, the generator would spin without yielding, starving the event loop.
By default try_read() reads one frame (n=1). Pass n to read multiple frames at once (e.g. self.input.webcam.try_read(n=4)). The return value is always a list when frames are available, even for n=1.
Full example: video-to-video
Next
Bring Your Own Model
Convert an existing research pipeline to Reactor.