segment method
Segments encoded image bytes.
imageBytes should contain encoded image data (JPEG, PNG, etc.).
The image is decoded, preprocessed, and segmented in the worker isolate.
Returns a SegmentationMask (or MulticlassSegmentationMask for multiclass model) with per-pixel probabilities.
Throws SegmentationException on decode or inference failure.
Implementation
Future<SegmentationMask> segment(Uint8List imageBytes) async {
final Map result = await sendRequest<Map>('segment', {
'imageBytes': TransferableTypedData.fromList([imageBytes]),
});
return _rebuildMask(result);
}