YOLO constructor
YOLO({})
Creates a new YOLO instance with the specified model path and task.
The modelPath can refer to an official model ID, asset, internal storage,
remote URL, or absolute file path.
The task is optional when the exported model metadata already includes it.
The useGpu parameter controls whether to use GPU acceleration (default: true).
If useMultiInstance is true, each YOLO instance gets a unique ID and its own channel.
If false, uses the default channel for backward compatibility.
Implementation
YOLO({
required this.modelPath,
this.task,
this.useGpu = true,
bool useMultiInstance = false,
this.classifierOptions,
int? numItemsThreshold,
}) {
if (useMultiInstance) {
_instanceId = 'yolo_${DateTime.now().millisecondsSinceEpoch}_$hashCode';
YOLOInstanceManager.registerInstance(_instanceId, this);
} else {
_instanceId = 'default';
}
this.numItemsThreshold = numItemsThreshold ?? 30;
_channel = ChannelConfig.createSingleImageChannel(instanceId: _instanceId);
}