You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 22, 2024. It is now read-only.
I want to use genderage.onnx to recognize the age and gender of photos on Android, so I used the onnx2tflite tool to convert genderage.onnx to genderage.tflite, and loaded it with TensorFlow Lite. It ran normally and output the results, but the results were not accurate at all. I want to know where I went wrong. Here is my kotlin code
<
val interpreter = Interpreter(FileUtil.loadMappedFile( applicationContext , "genderage.tflite"), options )
val inputImageProcessor =
ImageProcessor.Builder()
.add(ResizeOp(inputImageSize, inputImageSize, ResizeOp.ResizeMethod.BILINEAR))
.add(NormalizeOp(0f, 255f))
.build()
val tensorInputImage = TensorImage.fromBitmap(image)
val ageOutputArray = Array(1){ FloatArray(3) }
val processedImageBuffer = inputImageProcessor.process(tensorInputImage).buffer
interpreter?.run(
processedImageBuffer,
ageOutputArray
)
Log.d("test","predictAge out [0]:${ageOutputArray[0][0]} [1]:${ageOutputArray[0][1]} [2]:${ageOutputArray[0][2]}")
Log.d("test","age:${ageOutputArray[0][2] * 100}")
The out put all ways like :
| predictAge out [0]:0.36035335 [1]:-0.3603145 [2]:0.35510007
| age:35.510006
The three output values are always around 0.35
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I want to use genderage.onnx to recognize the age and gender of photos on Android, so I used the onnx2tflite tool to convert genderage.onnx to genderage.tflite, and loaded it with TensorFlow Lite. It ran normally and output the results, but the results were not accurate at all. I want to know where I went wrong. Here is my kotlin code
<
val interpreter = Interpreter(FileUtil.loadMappedFile( applicationContext , "genderage.tflite"), options )
val inputImageProcessor =
ImageProcessor.Builder()
.add(ResizeOp(inputImageSize, inputImageSize, ResizeOp.ResizeMethod.BILINEAR))
.add(NormalizeOp(0f, 255f))
.build()
val tensorInputImage = TensorImage.fromBitmap(image)
val ageOutputArray = Array(1){ FloatArray(3) }
val processedImageBuffer = inputImageProcessor.process(tensorInputImage).buffer
interpreter?.run(
processedImageBuffer,
ageOutputArray
)
Log.d("test","predictAge out [0]:${ageOutputArray[0][0]} [1]:${ageOutputArray[0][1]} [2]:${ageOutputArray[0][2]}")
Log.d("test","age:${ageOutputArray[0][2] * 100}")
The out put all ways like :
| predictAge out [0]:0.36035335 [1]:-0.3603145 [2]:0.35510007
| age:35.510006
The three output values are always around 0.35
The text was updated successfully, but these errors were encountered: