How to extract the informations of bounding box from TensorOutput TFLite Model in Android?

Viewed 73

Tensors Information (Input and Outputs)

I've procced the inputs and have the outputs without error. I want to extract the information from the outputs in android, but I don't know how to do it.

Sample code

        var resized:Bitmap = Bitmap.createScaledBitmap(bitmap, 320,320,true)
        val model = ModelJerawatAutoml.newInstance(this)

        // Creates inputs for reference.
        val normalizedInputImageTensor = TensorImage.fromBitmap(bitmap)

        // Runs model inference and gets result.
        val outputs = model.process(normalizedInputImageTensor)
        val locations = outputs.locationsAsTensorBuffer
        val classes = outputs.classesAsTensorBuffer
        val scores = outputs.scoresAsTensorBuffer
        val numberOfDetections = outputs.numberOfDetectionsAsTensorBuffer
   
        textView1.setText((locations.floatArray[0] ).toString())
        textView2.setText((locations.floatArray[1]).toString())
        textView3.setText((locations.floatArray[2]).toString())
        textView4.setText((locations.floatArray[3]).toString())

Can you guys tell me how to create the bounding box in android? and also I don't do real-time detection just only from the images

0 Answers
Related