createCompiledFromBuffer static method
Future<FaceLandmark>
createCompiledFromBuffer(
- Uint8List modelBytes, {
- Set<
Accelerator> accelerators = const {Accelerator.gpu, Accelerator.cpu}, - Precision precision = Precision.fp16,
Creates a face landmark model backed by LiteRT CompiledModel.
Implementation
static Future<FaceLandmark> createCompiledFromBuffer(
Uint8List modelBytes, {
Set<Accelerator> accelerators = const {Accelerator.gpu, Accelerator.cpu},
Precision precision = Precision.fp16,
}) async {
final CompiledModel compiledModel = compiledModelFromBufferAuto(
modelBytes,
accelerators: accelerators,
precision: precision,
onGpuFallback: _onGpuFallback,
);
final int side;
try {
side = compiledSquareInputSide(
compiledModel,
label: 'Compiled face landmark',
);
} catch (_) {
compiledModel.close();
rethrow;
}
final obj = FaceLandmark._compiled(compiledModel, side, side);
try {
obj._initializeCompiledModel();
return obj;
} catch (_) {
obj.dispose();
rethrow;
}
}