[mob][onnx] Specify return type

This commit is contained in:
Neeraj Gupta
2024-07-09 13:29:28 +05:30
parent 107162fa2c
commit bc04a3f87f
4 changed files with 5 additions and 23 deletions

View File

@@ -142,7 +142,7 @@ class FaceDetectionService extends MlModel {
"YOLO_FACE",
);
final List<List<List<double>>> reconstructedTensor = [];
for (int i = 0; i < result.length; i += 25200 * 16) {
for (int i = 0; i < result!.length; i += 25200 * 16) {
final List<List<double>> outerArray = [];
for (int j = 0; j < 25200; j++) {
final List<double> innerArray =

View File

@@ -16,7 +16,7 @@ class OnnxDart {
.init(modelType, modelPath, sessionsCount: sessionsCount);
}
Future<dynamic?> predict(
Future<Float32List?> predict(
Float32List inputData,
String modelType, {
int sessionAddress = 0,

View File

@@ -37,31 +37,13 @@ class MethodChannelOnnxDart extends OnnxDartPlatform {
return result;
}
// @override
// Future<List<double>?> predict(
// List<double> inputData,
// String modelType, {
// int sessionAddress = 0,
// }) async {
// final List<dynamic>? result =
// await methodChannel.invokeMethod<List<double>?>(
// 'predict',
// {
// 'sessionAddress': sessionAddress,
// 'inputData': inputData,
// 'modelType': modelType,
// },
// );
// return result!.cast<double>();
// }
@override
Future<dynamic?> predict(
Future<Float32List?> predict(
Float32List inputData,
String modelType, {
int sessionAddress = 0,
}) {
return methodChannel.invokeMethod<dynamic?>(
return methodChannel.invokeMethod<Float32List?>(
'predict',
{
'sessionAddress': sessionAddress,

View File

@@ -41,7 +41,7 @@ abstract class OnnxDartPlatform extends PlatformInterface {
throw UnimplementedError('release() has not been implemented.');
}
Future<dynamic?> predict(
Future<Float32List?> predict(
Float32List inputData,
String modelType, {
int sessionAddress = 0,