flutter-tflite icon indicating copy to clipboard operation
flutter-tflite copied to clipboard

null check operator used on a null value

Open NQHuy1905 opened this issue 1 year ago • 2 comments
trafficstars

Hi, i am trying to deploy app with tflite_flutter.

But when i test the code like below, it, log out error null check operator used on a null value though as i see input and output of model is not null

Can anyone explain why

Screenshot from 2024-03-21 11-38-10

NQHuy1905 avatar Mar 21 '24 07:03 NQHuy1905

provide all code its not coming from the code you provide

azzurritech-talha avatar May 08 '24 19:05 azzurritech-talha

I am having the same issue. The issue is coming from runForMultipleInputs() in interpreter.dart

Model: blaze_face_short_range.tflite

The interpreter outputShape is [1,896,16] but the outputTensors in runForMultipleInputs() is [ 2, 896, 16]

final output = [
            List.filled(896, List.filled(16, 0.0))
];
interpreter.run(input, output);

interpreter.dart:

void runForMultipleInputs(List<Object> inputs, Map<int, Object> outputs) {
   if (outputs.isEmpty) {
     throw ArgumentError('Input error: Outputs should not be null or empty.');
   }
   runInference(inputs);
   var outputTensors = getOutputTensors();
   for (var i = 0; i < outputTensors.length; i++) {
     outputTensors[i].copyTo(outputs[i]!);
   }
 }

This project is based off of the Image Segmentation example at https://github.com/tensorflow/flutter-tflite/tree/main/example/image_segmentation

lib.zip

Tylerchristensen100 avatar Jun 26 '24 19:06 Tylerchristensen100