Skip to content

basic_bot.commons.recognition_provider

RecognitionProvider Objects

class RecognitionProvider()

This singleton class detects objects in frames it gets from the camera object passed to the constructor.

It uses the TFLiteDetect class to detect objects in the frames.

It sends the detected objects to the central hub via a websocket connection using the recognition key

To use, simply instantiate it:

from basic_bot.commons.recognition_provider import RecognitionProvider
from basic_bot.commons.camera_opencv import OpenCvCamera

camera = OpenCvCamera()
recognition_provider = RecognitionProvider(camera)

__init__

def __init__(camera: Any) -> None

Constructor

get_objects

def get_objects() -> List[Dict[str, Any]]

Return the last objects seen

get_next_objects

def get_next_objects() -> List[Dict[str, Any]]

Wait for and return the next objects seen

pause

def pause() -> None

Pause the recognition thread

resume

def resume() -> None

Resume the recognition thread

stop

def stop() -> None

Stops the singleton recognition thread

stats

@classmethod
def stats(cls) -> Dict[str, Any]

Return the fps stats dictionary.