My model takes images and a np.ndarray
Below is the Sample code generated by Android Studio in Kotlin language after importing my model.
val model = ConvertedModel.newInstance(context)
// Creates inputs for reference.
val inputFeature0 = TensorBuffer.createFixedSize(intArrayOf(1, 1), DataType.FLOAT32)
inputFeature0.loadBuffer(byteBuffer)
val inputFeature1 = TensorBuffer.createFixedSize(intArrayOf(1, 1, 1, 3), DataType.FLOAT32)
inputFeature1.loadBuffer(byteBuffer)
...
...
// Runs model inference and gets result.
val outputs = model.process(inputFeature0, inputFeature1, inputFeature2)
...
...
// Releases model resources if no longer used.
model.close()
I have taken 2 images and converted into bitmap
var tensorImage0 = TensorImage(DataType.FLOAT32)
tensorImage0.load(my_img_bitmap)
...
val batchBuff = TensorBuffer.createFixedSize(intArrayOf(1, 1), DataType.FLOAT32)
Added additional processing
var imageProcessor = ImageProcessor.Builder()
.add(ResizeOp(1, 1, ResizeOp.ResizeMethod.BILINEAR))
.build()
tensorImage0 = imageProcessor.process(tensorImage0)
...
Then passed it into the input buffer
val inputFeature0 = TensorBuffer.createFixedSize(intArrayOf(1, 1), DataType.FLOAT32)
inputFeature0.loadBuffer(batchBuff.buffer)
val inputFeature1 = TensorBuffer.createFixedSize(intArrayOf(1, 1, 1, 3), DataType.FLOAT32)
inputFeature1.loadBuffer(tensorImage0.buffer)
...
When this process starts the app crashes.
#00 pc 000000000005e03c /system/lib64/libbinder.so (android::IPCThreadState::transact(int, unsigned int, android::Parcel const&, android::Parcel*, unsigned int)+248)
Please help me overcome the issue.