public void onClick(View view) {
try {
Yolov4Tiny416 model = Yolov4Tiny416.newInstance(MainActivity.this);
// Creates inputs for reference.
TensorBuffer inputFeature0 = TensorBuffer.createFixedSize(new int[]{1, 416, 416, 3}, DataType.FLOAT32);
bitmap = Bitmap.createScaledBitmap(bitmap, 416, 416, true);
inputFeature0.loadBuffer(TensorImage.fromBitmap(bitmap).getBuffer());
// Runs model inference and gets result.
Yolov4Tiny416.Outputs outputs = model.process(inputFeature0);
TensorBuffer outputFeature0 = outputs.getOutputFeature0AsTensorBuffer();
result.setText(labels[getMax(outputFeature0.getFloatArray())]+"");
TensorBuffer outputFeature1 = outputs.getOutputFeature1AsTensorBuffer();
result.setText(labels[getMax(outputFeature1.getFloatArray())]+"");
// Releases model resources if no longer used.
model.close();
} catch (IOException e) {
// TODO Handle the exception
}
}
});
}
I am getting an error when trying to run a tensorflow light model in android studio,
Haven't been able to fix it for a week,
How do I write code that resizes?
Please help me.... It's a university project T.T