Need Help with TensorFlow Lite Model Running on GPU - Output Interpretation Issue (Android Studio Kotlin)
Hi @rafrxx, so as I understand your situation, Your code runs but you're not sure if it ran correctly? It seems like you're running a Computer Vision model of some sort... are you trying to do classification or something else? What is the model's intended output? It seems like feature extraction -- in which case most humans probably can't interpret that. Any additional information will be helpful! Hello. Thank you for your response. This is an object detection model. I have a short code that displays the Frames Per Second (FPS) between captured frames. On a good phone without model inference, it runs at 80-100 FPS. When uncommenting the line responsible for model inference, the refresh rate drops to 8-10 FPS. When using GPU, it reaches 20-23 FPS. However, I'm unsure how to interpret the output. Hi @rafrxx, what is your exact model? or how did you build/architecture it? Where did you get the .tflite model from? It seems like it's just doing feature extraction and not doing the actual classification. Basically my current hypothesis is your tflite model is headless, it computes the features but doesn't have a classification head... but I am not sure how you created or got to that state. This model is based on ssd-mobilenet-v2-fpnlite-320 architecture. It provides output containing the locations, classes, and probabilities that I can utilize in the subsequent part of the code. I prepared the data myself, but I'm not as proficient in this area. It's possible that what I'm trying to achieve may not be feasible. Nevertheless, thank you for your response. Hi @rafrxx, no worries, what format are the expected outputs and what exactly are you seeing? It's kind of hard for me to help as I don't know how they look like and I don't have the model file. If you can upload a toy model, toy project or both that I can reproduce locally that'll be the most helpful. This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you. This issue was closed because it has been inactive for 7 days since being marked as stale. Please reopen if you'd like to work on this further. Are you satisfied with the resolution of your issue?
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=Yes&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/61367">Yes</a>
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=No&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/61367">No</a>
 I also have the concern  @rafrxx. I created a machine learning model for object detection. I got the code above from a sample code provided by android studio. Now, I am not sure on how to output the prediction. 
Hello. I have created an Android application in Android Studio that uses a tflite model. Its implementation works without any issues and looks as follows:

val model = Ssd.newInstance(context)

// Creates inputs for reference.
val inputFeature0 = TensorBuffer.createFixedSize(intArrayOf(1, 320, 320, 3), DataType.UINT8)
inputFeature0.loadBuffer(byteBuffer)

// Runs model inference and gets result.
val outputs = model.process(inputFeature0)
val outputFeature0 = outputs.outputFeature0AsTensorBuffer
val outputFeature1 = outputs.outputFeature1AsTensorBuffer
val outputFeature2 = outputs.outputFeature2AsTensorBuffer
val outputFeature3 = outputs.outputFeature3AsTensorBuffer

// Releases model resources if no longer used.
model.close()

However, the application is running slowly, and I would like to perform the model computations on the GPU.

I am facing an issue with the input and output parts.

I couldn't find any information about it anywhere. The current code looks like this:

val options = Interpreter.Options().apply {
    if(compatList.isDelegateSupportedOnThisDevice) {
        val delegateOptions = compatList.bestOptionsForThisDevice
        this.addDelegate(GpuDelegate(delegateOptions))
    } else {
        this.setNumThreads(4)
    }
}
interpreter = Interpreter(loadModelFile(assets,"Ssd.tflite"), options)
val inputFeature0 = TensorBuffer.createFixedSize(intArrayOf(1, 320, 320, 3), DataType.FLOAT32)
inputFeature0.loadBuffer(byteBuffer)

Then, I should create the input.buffer for the main line:

interpreter.run(inputFeature0.buffer, outputs.buffer)

I tried doing some adjustments, but the outputs.buffer I got as a result was something I couldn't interpret. Has anyone encountered a similar problem? If so, please, I would appreciate your help.

