Use a TFLite model imported in Template Manager to recognize objects or classify an image. Select the correct model type there. Supported outputs: YOLOv8/YOLO11 detection [1,N,4+C]/[1,4+C,N]; YOLO26 detection [1,N,6]/[N,6]; YOLO11/YOLO26 and MobileNetV3 classification [1,C]. FLOAT32, INT8 and UINT8 are supported automatically. Classification returns class scores and metadata without screen points or bounds. Inference requires a local model file; failure to obtain it raises an error.
Syntax
TfliteModel(model)Constructor parameters
| Name | Description |
|---|---|
modelString | Model reference to use for inference (prefer template model name). Required · Positional or named No default |
Returns
Example
# Check model availability before running detection
if TfliteModel.exists("enemy_model"):
detector = TfliteModel("enemy_model")
hits = detector.inference()
if len(hits) > 0:
click(hits[0])Fields
| Name | Description |
|---|---|
modelString | Model reference in current macro (prefer template model name; legacy model id still accepted). |
resize_modeString | How the image is resized: LETTERBOX preserves its proportions and adds padding; STRETCH fills the input size; CROP_CENTER crops the center. Default: LETTERBOX |
color_modeString | Image color format used by the model: RGB, BGR or GRAYSCALE. Default: RGB |
norm_modeString | How pixel values are converted for the model: ZERO_ONE, MINUS_ONE_ONE, IMAGENET or CUSTOM. Default: ZERO_ONE |
padding_colorInt | Value from 0 to 255 used to fill the border added by LETTERBOX. Default: 114 |
# Import a supported TFLite model and choose its output type in Template Manager.
# Create a model handle bound to one TFLite model name in Template Manager.
model = TfliteModel("enemy_model")