davidsandberg / facenet

Face recognition using Tensorflow
MIT License
13.76k stars 4.81k forks source link

Convert to CoreML (iOS) #926

Open ramiro-feria-puron opened 5 years ago

ramiro-feria-puron commented 5 years ago

Can anyone provide insights on the steps to convert the trained models to CoreML? Any help would be really appreciated!

taylorlu commented 5 years ago

The model seems cannot convert to CoreML directly, I have write a py script which convert to caffemodel first, and then use coremltools to convert to CoreML model.

You can refer to my git: https://github.com/taylorlu/Facenet-Caffe https://github.com/taylorlu/face_recognition_ios

import coremltools coreml_model = coremltools.converters.caffe.convert(('InceptionResnet_Model/inception_resnet_v1_conv1x1.caffemodel', 'resnetInception.prototxt2'), image_input_names='data', is_bgr=True) coreml_model.save('InceptionResnet_Model/InceptionResnet.mlmodel')