minivision-ai / Silent-Face-Anti-Spoofing-APK

Apache License 2.0
258 stars 131 forks source link

Model is not giving correct prediction scores on android #35

Open nahla-naz opened 7 months ago

nahla-naz commented 7 months ago

Hi, I created Face Antispoof .pth model which is similar to the layers of model_1.param. The .pth model gives good results on my PC. I am getting prediction scores between 0-100. However, the model is giving optimised prediction scores such as 0 and 1 while running on android ( I used Silent-Face-Anti-Spoofing-APK project's code).

I did the following preprocessing for training the model:

transform = transforms.Compose([ transforms.RandomResizedCrop(size=tuple([80, 80]), scale=(0.9, 1.1)), transforms.ColorJitter(brightness=0.4, contrast=0.4, saturation=0.4, hue=0.1), transforms.RandomRotation(10), transforms.RandomHorizontalFlip(), transforms.ToTensor() ]) I need to implement the same preprocessing in 'Silent-Face-Anti-Spoofing-APK' project's code to get the correct prediction scores on android. Can anyone help? If the preprocessing is not the problem, what else could it be? I tried to fix the conversion ( pth-> onnx -> param,bin). The onnx file is giving good results as well. So I'm guessing it could be because of the preprocessing. Please help. Thanks. :)