Open emreakcan opened 3 years ago
if I run the L2Norm with the FloatArrays that I get from the Xiaomi, Samsung can do the calculation correctly.
This is because of different device configurations. Probably switching off the GpuDelegate
and XNNPack
might help.
In the FaceNetModel.kt
class, you'll see these lines,
init {
// Initialize TFLiteInterpreter
val interpreterOptions = Interpreter.Options().apply {
// Add the GPU Delegate if supported.
// See -> https://www.tensorflow.org/lite/performance/gpu#android
if ( CompatibilityList().isDelegateSupportedOnThisDevice ) {
addDelegate( GpuDelegate( CompatibilityList().bestOptionsForThisDevice ))
}
else {
// Number of threads for computation
setNumThreads( 4 )
}
setUseXNNPACK( true )
}
interpreter = Interpreter(FileUtil.loadMappedFile(context, model.assetsFilename ) , interpreterOptions )
Logger.log("Using ${model.name} model.")
}
Replace these lines with,
init {
// Initialize TFLiteInterpreter
val interpreterOptions = Interpreter.Options().apply {
setNumThreads( 4 )
}
interpreter = Interpreter(FileUtil.loadMappedFile(context, model.assetsFilename ) , interpreterOptions )
Logger.log("Using ${model.name} model.")
}
@emreakcan Could you resolve the error by removing GpuDelegate
?
HI @shubham0204,
I'm also facing the same issue with face recognition. Initially, it generated multiple results for the same face. But now after removing the GPUDelegate and XNNPack, for all the faces it is giving me the same result as unknown.
@DineshIT can you send me some more details of the Samsung A21 device on which you're testing the app? I need these details specifically:
You can get these details by installing the Device Info app on the device.
Hi Shubham,
Please find the details below.
If you need any other details please let me know.
On Mon, Apr 25, 2022 at 7:52 PM Shubham Panchal @.***> wrote:
@DineshIT https://github.com/DineshIT can you send me some more details of the Samsung A21 device on which you're testing the app? I need these details specifically:
- Android OS Version
- GPU Renderer
- Supported ABIs
- CPU architecture
You can get these details by installing the Device Info https://play.google.com/store/apps/details?id=com.ytheekshana.deviceinfo app on the device.
— Reply to this email directly, view it on GitHub https://github.com/shubham0204/FaceRecognition_With_FaceNet_Android/issues/25#issuecomment-1108643191, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC7WWBMXE6FUFWM34CDSPTDVG2TBVANCNFSM5JHXRYAQ . You are receiving this because you were mentioned.Message ID: <shubham0204/FaceRecognition_With_FaceNet_Android/issues/25/1108643191@ github.com>
-- -With great regards Dineshkumar
Hi @shubham0204
I have worked on this issue and fixed it by adding the properties in the interpreter class object.
Please check my commit in the repo and merge it to handle this issue.
Hi @emreakcan
You can make the mentioned changes in your FaceNetModel Class and verify whether this issue got fixed at your end. If you got success please share with us.
@DineshIT Can you open a PR in this repo, so that I can review the changes?
PR has been created
App working correctly on all devices I have, but somehow on Samsung A21s, it is producing incorrect results. It is nearly producing same output for all faces probability between .2 .3, for l2, cosine is also the same.
I thought maybe camera is the problem, so I embedded the pictures inside drawable and matched, but still it is producing nearly the same results for everything.
I noticed FloatArray returned from getCroppedFaceEmbedding producing different results for different phones.
My xiaomi mi9 works alright.
Do you have any ideas?