Skip to content

basic_bot.commons.tflite_detect

TFLiteDetect Objects

class TFLiteDetect()

This class provides object detection using Tensor Flow Lite.

__init__

def __init__(model: Optional[str] = None,
             use_coral_tpu: Optional[bool] = None) -> None

Constructor

Arguments:

  • model: the path to the tflite model file
  • use_coral_tpu: whether to use the Coral TPU for inference

get_prediction

def get_prediction(img: Any) -> List[Dict[str, Any]]

Given an image array, return a list of detected objects.

Each detected object is a dictionary with the following:

  • bounding_box: [x1, y1, x2, y2]
  • classification: string
  • confidence: float (0-1)