1 year ago

#387906

test-img

rehan fernandopulle

Error The size of byte buffer and the shape do not match

I am making my first ML integrated android app and I am trying to add this model to my app. But I am facing this error

        var resized = Bitmap.createScaledBitmap(bitmap, 416, 416, true)
        val model = Yolov4416Fp16.newInstance(this)
        var tbuffer = TensorImage.fromBitmap(resized)
        var byteBuffer = tbuffer.buffer


        val inputFeature0 = TensorBuffer.createFixedSize(intArrayOf(1, 416, 416, 3), DataType.FLOAT32)
        inputFeature0.loadBuffer(byteBuffer)


        val outputs = model.process(inputFeature0)
        val outputFeature0 = outputs.outputFeature0AsTensorBuffer

        var max = getMax(outputFeature0.floatArray)

        text_view.text = labels[max]

        model.close()

android

kotlin

machine-learning

0 Answers

Your Answer

Accepted video resources