Attempt to invoke virtual method 'int java.util.Vector.size()' on a null object reference
Hello, I sent a tf lite model I made to my frontend developer, who's using your flutter package. We get the picture from the camera and we ran the data through the code you provided:
Uint8List imageToByteListFloat32( img.Image image, int inputSize, double mean, double std) { var convertedBytes = Float32List(1 * inputSize * inputSize * 3); var buffer = Float32List.view(convertedBytes.buffer); int pixelIndex = 0; for (var i = 0; i < inputSize; i++) { for (var j = 0; j < inputSize; j++) { var pixel = image.getPixel(j, i); buffer[pixelIndex++] = (img.getRed(pixel) - mean) / std; buffer[pixelIndex++] = (img.getGreen(pixel) - mean) / std; buffer[pixelIndex++] = (img.getBlue(pixel) - mean) / std; } } return convertedBytes.buffer.asUint8List(); }
and then into the method runModelOnBinary().
Here, we get the error I wrote in the title, and we have no idea what's causing it.
Do you may know the answer?
Facing the same but with runModelOnFrame method. The package was last updated 15 moths ago and very less support is given here. Do we have any other option to use Tflite in flutter
Hello, I sent a tf lite model I made to my frontend developer, who's using your flutter package. We get the picture from the camera and we ran the data through the code you provided:
Uint8List imageToByteListFloat32( img.Image image, int inputSize, double mean, double std) { var convertedBytes = Float32List(1 * inputSize * inputSize * 3); var buffer = Float32List.view(convertedBytes.buffer); int pixelIndex = 0; for (var i = 0; i < inputSize; i++) { for (var j = 0; j < inputSize; j++) { var pixel = image.getPixel(j, i); buffer[pixelIndex++] = (img.getRed(pixel) - mean) / std; buffer[pixelIndex++] = (img.getGreen(pixel) - mean) / std; buffer[pixelIndex++] = (img.getBlue(pixel) - mean) / std; } } return convertedBytes.buffer.asUint8List(); }and then into the method runModelOnBinary(). Here, we get the error I wrote in the title, and we have no idea what's causing it. Do you may know the answer?
I solved this problem, it seems it is mandatory to pass labels while loading the model and boom it works
@IronHeartDan @LuginiAndrea
Am facing same issue in Gesture Classification in flutter and am using loadModel(model:"Model_path") without any label file
So what you think this will cause error for me
ava.lang.NullPointerException: Attempt to invoke virtual method 'int java.util.Vector.size()' on a null object reference