I am trying to make an image classification android app with a custom model through Firebase.
But when i try to run the interpreter, It fails and gives me this error.
I cross checked the input-output dimensions. What can I do
Please Help Me!.
public List<Recogonition> recImg(Bitmap bm) {
bm.createScaledBitmap(bm, 224, 224, false);
int batchNum = 0;
float[][][][]input = new float[1][224][224][3];
for (int x = 0; x < 224; x++) {
for (int y = 0; y < 224; y++) {
int pixel = bm.getPixel(x, y);
input[batchNum][x][y][0] = (Color.red(pixel) - 127) / 128.0f;
input[batchNum][x][y][1] = (Color.green(pixel) - 127) / 128.0f;
input[batchNum][x][y][2] = (Color.blue(pixel) - 127) / 128.0f;
}
}
FirebaseModelInputs
inputs = null;
try {
inputs = new FirebaseModelInputs.Builder().add(input).build();
System.out.println("________ INPUT DONE ___________");
} catch (FirebaseMLException e) {
e.printStackTrace();
System.out.println("INPUT ERROR ___________");
}
System.out.println("______RUNNING__________");
interpreter.run(inputs, inoutOptions).addOnSuccessListener(new OnSuccessListener<FirebaseModelOutputs>() {
public void onSuccess(FirebaseModelOutputs result) {
float[][] results = new float[1][5];
results = result.getOutput(0);
probs = results[0];
Log.i("tag","________ProBS__"+probs);
System.out.println("______ RAN __________");
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
System.out.println("___ Run Error__"+e);
}
});