I am very new to tensorflow lite app using kotlin.I have taken a sample kotlin code for image classification using mobilenet model and it is working fine and now i am trying it with my own custom image classifier model. I am using a VGG architecture with input shape of 32x32x3 and converted it to tflite and it is working correctly using tflite interpreter. But when i try this on the kotlin app i am facing the below error and i am finding it very hard to convert it to float due to val type in kotlin(auto type casting)
fun recognizeImage(bitmap: Bitmap): List<Recognition> {
val scaledBitmap = Bitmap.createScaledBitmap(bitmap, inputSize, inputSize, false)
val byteBuffer = convertBitmapToByteBuffer(scaledBitmap)
val result = Array(1) { ByteArray(labelList.size) }
interpreter.run(byteBuffer, result)
return getSortedResult(result)
}
error log
E/Exception: java.lang.IllegalArgumentException: Cannot convert between a TensorFlowLite tensor with type FLOAT32 and a Java object of type [[B (which is compatible with the TensorFlowLite type UINT8).
how can i solve it