Closed oishi89 closed 6 years ago
I don't know if CoreML supports it. It looks your model was made using a custom version of Caffe, while coremltools only supports the original version of Caffe.
I've implemented (the TensorFlow version of) MobileNet+SSD in Metal for a client and that works fine, but it did require a few custom Metal kernels.
So is it possible to convert my model to metal ?
Yes, that should be possible but it might involve writing custom compute kernels.
There is an example project using TensorFlow 1.4.0 that runs the following models: ssd_mobilenet_v1_coco, ssd_inception_v2_coco, faster_rcnn_resnet101_coco
https://github.com/JieHe96/iOS_Tensorflow_ObjectDetection_Example
There are some issues currently, I needed to recompile the protbuff headers with protoc version 3.4.0.
Get the correct 3.4.0 binary for your system here: https://github.com/google/protobuf/releases
Get the original .proto definition file here: https://github.com/tensorflow/models/blob/master/research/object_detection/protos/string_int_label_map.proto
Then run something like: ./protoc --cpp_out=./ ./string_int_label_map.proto
Make sure to use the protoc binary for 3.4.0 that you downloaded above. Then replace the files in the ex_SSD_Mobilenet_TF folder: string_int_label_map.pb.cc string_int_label_map.pb.h
I haven't yet hooked this up to video input yet but I will be trying shortly and I might commit and push some changes to the repo.
@madhavajay Recommend trying https://github.com/tf-coreml/tf-coreml instead of. It's support using GPU on ios device so the performance would be better than.
Yes, I just saw that and will give it a try but wanted to provide a working solution (even if its slow) that I found in case someone else finds it useful. Seems there are few and far between solutions for a lot of this stuff at the moment.
Should we all be looking at NASnet now though? https://research.googleblog.com/2017/11/automl-for-large-scale-image.html https://github.com/tensorflow/models/tree/master/research/slim
Anyone got a working implementation for mobile?
Just so people know, there is a partial port made here: https://github.com/vonholst/SSDMobileNet_CoreML
The end of the network output has been re-implemented in swift code.
@madhavajay cool I have not had oppotinity to check it out yet. If you did tried it please highlight something Thanks 👍
Yes, it works straight from the master branch on load in xcode, just change your Developer team. 👍
Hi Hollance I followed the tutorial https://github.com/chuanqi305/MobileNet-SSD After that I try to convert my deployed model to CoreML and I got the issue
[libprotobuf ERROR /Users/sohaibqureshi/github/coremltools/deps/protobuf/src/google/protobuf/text_format.cc:287] Error parsing text-format caffe.NetParameter: 1177:17: Message type "caffe.LayerParameter" has no field named "permute_param". Traceback (most recent call last): File "mobilenet_2_coreml.py", line 23, in <module> class_labels='caffe_model/synset_words.txt') File "/Users/ln160c/Downloads/YOLO-CoreML-MPSNNGraph-master/Convert/coreml/coreml/lib/python2.7/site-packages/coremltools/converters/caffe/_caffe_converter.py", line 171, in convert predicted_feature_name) File "/Users/ln160c/Downloads/YOLO-CoreML-MPSNNGraph-master/Convert/coreml/coreml/lib/python2.7/site-packages/coremltools/converters/caffe/_caffe_converter.py", line 230, in _export predicted_feature_name) RuntimeError: Unable to load caffe network Prototxt file: caffe_model/MobileNetSSD_deploy.prototxt
I'm not sure if CoreML supports MobileNetSSD or not. Could you take a look ?