Face-Anti-spoofing.pytorch icon indicating copy to clipboard operation
Face-Anti-spoofing.pytorch copied to clipboard

how to use my trained pytorch model into android project?

Open billhyde opened this issue 5 years ago • 6 comments

hi,thanks for sharing~ if I trained my own model ,how to convert it into android project and how to do inference in android? thanks~

billhyde avatar Aug 19 '19 01:08 billhyde

you can save ONNX model and then transform to Caffe model.

liurs1990 avatar Aug 19 '19 11:08 liurs1990

Hi,thank you for reply. Is your Android example use caffe model? If you did not use the caffe framework, would you tell me what Deep learning framework you use? I tested the android example ,it's pretty good, but i can not find the android infercence C++ source code. I want to use my own train pytorch model in android example like you,please help me,thanks .

billhyde avatar Aug 19 '19 12:08 billhyde

No, I don't use Caffe on Android. NCNN is a good choice for Android.

liurs1990 avatar Aug 19 '19 12:08 liurs1990

we have trained a pytorch model and then convert to onnx model, the onnx model can be loaded and runned by python and get same predict score as pytorch model. and then we convert onnx to ncnn using ncnn tool 'onnx2ncnn', we can load and run the ncnn model but predict is error, can you share you method, thanks

vwillagent avatar Aug 20 '19 15:08 vwillagent

Can someone please provide your pretrained model with inference code in python

PhenomenalOnee avatar Oct 14 '19 06:10 PhenomenalOnee

we have trained a pytorch model and then convert to onnx model, the onnx model can be loaded and runned by python and get same predict score as pytorch model. and then we convert onnx to ncnn using ncnn tool 'onnx2ncnn', we can load and run the ncnn model but predict is error, can you share you method, thanks

Can you share how accurate you get with the model?

luan1412167 avatar Sep 13 '20 12:09 luan1412167