YOLO class
YOLO (You Only Look Once) is a class that provides machine learning inference capabilities for object detection, segmentation, classification, pose estimation, and oriented bounding box detection.
This class handles the initialization of YOLO models and provides methods to perform inference on images.
Example usage:
final yolo = YOLO(
modelPath: 'assets/models/yolo11n.tflite',
task: YOLOTask.detect,
);
await yolo.loadModel();
final results = await yolo.predict(imageBytes);
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- instanceId → String
-
The unique instance ID for this YOLO instance
no setter
- modelPath → String
-
Path to the YOLO model file. This can be:
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- task → YOLOTask
-
The type of task this YOLO model will perform (detection, segmentation, etc.)
final
Methods
-
dispose(
) → Future< void> - Disposes this YOLO instance and releases all resources
-
loadModel(
) → Future< bool> - Loads the YOLO model for inference.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
predict(
Uint8List imageBytes, {double? confidenceThreshold, double? iouThreshold}) → Future< Map< String, dynamic> > - Runs inference on a single image.
-
setViewId(
int viewId) → void - Sets the view ID for this controller (called internally by YoloView)
-
switchModel(
String newModelPath, YOLOTask newTask) → Future< void> - Switches the model on the associated YoloView.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
checkModelExists(
String modelPath) → Future< Map< String, dynamic> > - Checks if a model exists at the specified path.
-
getStoragePaths(
) → Future< Map< String, String?> > - Gets the available storage paths for the app.