0

I am making an app that needs a model to output a long feature(like 1,2024) given an image. I'm using iphone, so I chose coreml. But other framework is also welcome if anyone knows which one can output a long feature rather than prediction label.

黄冠斌
  • 11
  • 3
  • Are you working a face verification application? Do you want to input an image and get emmbedings from a dense layer? – Farmaker Jun 25 '20 at 18:45
  • I'm working on person re-identification. But you can think of it as face verification. The model i'm using is customized. So I need to access the middle layer or I need to output feature rather than prediction. – 黄冠斌 Jun 25 '20 at 22:25
  • Do you have sth to recommend?? – 黄冠斌 Jun 25 '20 at 22:29
  • I have worked earlier this year with such model. We have a lot to discuss,depend on file. Is it possible to upload somewhere the generated .h5 file to process it and give you recommendations? – Farmaker Jun 26 '20 at 04:17
  • I only have the model created by pytorch and the verson of onnx. I didn't get your point. What do you want me to upload? – 黄冠斌 Jun 26 '20 at 05:20
  • It seems .h5 is tensorflow or keras file. You want me to convert the model .onnx to tensorflow ??? So I can upload otherwise I don't know what you want from me. – 黄冠斌 Jun 26 '20 at 05:24
  • I found you did have a face verification project on your github, which may help me a lot. Now I would try to convert my model to tf so that I can do the similar thing as you did. Stay tuned. – 黄冠斌 Jun 26 '20 at 05:30
  • Yes if you have any questions tag me. Pytorch gives model files with a lot MB...How are you going to use it inside phone? – Farmaker Jun 26 '20 at 05:46
  • @Farmaker TensorFlow lite enalbes us to run it on the phone. – 黄冠斌 Jun 26 '20 at 06:33
  • Yes but size is biggggggggg – Farmaker Jun 26 '20 at 06:44
  • My model is 90M. Is it really big for mobile?? Do you know how to convert from pytorch model to tf?? I got stuck now.@Farmaker When i tried to convert it from onnx to tf, it gives me this error. TypeError: pad() got multiple values for argument 'name' – 黄冠斌 Jun 26 '20 at 07:33
  • I think we should continue to mail. Send me there farmaker47@gmail.com – Farmaker Jun 26 '20 at 07:35

1 Answers1

0

Yes, Core ML can do that. Just don't convert it as a "classifier". Core ML treats classifiers special and outputs a dictionary of probabilities for those kinds of models. But if your model is not a classifier, then you get an MLMultiArray with the feature vector as output.

Matthijs Hollemans
  • 7,706
  • 2
  • 16
  • 23
  • Thanks, after I get the long feature(MLMultiArray), can I manipulate it in CoreML? My case is a person of re-identification model, which get an image as input and output a long feature. Then I want to compare this long feature with a pre-defined number of other long features and check their similarity. Let say I got a long feature reprenting Dave. I pre-stored 3 long features which are Tom, Dave and Amy. Can I do the array similarity comparision in swift by using for loop? – 黄冠斌 Jun 26 '20 at 10:11
  • Yes you can, but you'll have to implement the distance calculation yourself. – Matthijs Hollemans Jun 26 '20 at 11:13