13 Replies
      Latest reply: Sep 11, 2017 10:49 AM by rmsmith RSS
      srikris Apple Staff Apple Staff (30 points)

        coremltools-0.6.3 release notes

         

         

        • Linux support
        • Added a “useCPUOnly” flag that lets you run predictions using CoreML through Python bindings using only the CPU

         

        Note: coremltools-0.6.2 has a known issue with the useCPUOnly flag that failed on certain neural network models. This has been fixed with 0.6.3

         

        Neural Network Builder

         

        • Added support for layers in the NeuralNetworkBuilder that were present in the neural network protobuf but missing from the builder:
          • Local response normalization (LRN) layer
          • Split layer
          • Unary function layer
          • Bias, scale layers
          • Load constant layer
          • L2 normalization layer
          • Mean variance normalization (MVN) layer
          • Elementwise min layer
          • Depthwise and separable convolutions
        • Added support for some of the missing parameters in NeuralNetworkBuilder:
          • Padding options in convolution, pooling and padding layers
          • Scale and shift options for linear activation

         

        Other bug fixes & enhancements

        • Bug-fix in the caffe converter that was preventing the elementwise max layer from converting.
        • Support for converting DepthwiseConv2D and SeparableConv2D from Keras
        • Re: [Announcement] coremltools-0.6.2 release notes
          mikhail_p Level 1 Level 1 (10 points)

          After I converted my caffe model with this version, prediction on Iphone SE became 2 time slower. With this version of converter I've started to use Xcode 9 beta 6. May be problem not only with converter 0.6.2.

            • Re: [Announcement] coremltools-0.6.2 release notes
              srikris Apple Staff Apple Staff (30 points)

              The only change form the 0.5.1 to the 0.6.2 version of coremltools with respect to the Caffe converter was the enabling of elementwise max operation. Can I ask a few clairifying questions:

               

              * I assume you meant the 2x slowdown was when you executed the model in the app?

              * If you reverted back to 0.5.1 and re-did the conversion, did you see the speed going back up again?

              * A diff (just binary diffing the 2 .mlmodel files) would be a quick way to perform a sanity check of whether the two models produced by the 2 versions are indeed different.

                • Re: [Announcement] coremltools-0.6.3 release notes
                  mikhail_p Level 1 Level 1 (10 points)

                  Thank you for reply

                  1) Yes 2x slowdown on iphone SE

                  2) Previous mlmodel was converted by 0.4.0 because 0.5.1 return error with deconvolution layers. And yes, when I reverted, model performance became as usual. I use 0.4.0 model with Xcode beta (9M136h) and 0.6.2 (try 0.6.3 - same problem) with Xcode beta 6 (9M214v).

                  3) I've performed binary diff of 0.4.0 and 0.6.2 converted models and it was 14 bytes difference

              • Re: [Announcement] coremltools-0.6.2 release notes
                hwoolery Level 1 Level 1 (0 points)

                Any idea when there will be support for Keras DepthwiseConv2D (MobileNets?).  Thank you!

                  • Re: [Announcement] coremltools-0.6.3 release notes
                    srikris Apple Staff Apple Staff (30 points)

                    We added support for DepthwiseConv2D in coremltools-0.6.3 but missed mentioning it in our release notes. That has been fixed now. Thanks!

                      • Re: [Announcement] coremltools-0.6.2 release notes
                        hwoolery Level 1 Level 1 (0 points)

                        Thank you for your help... is there anything special that needs to be done to get it to work:

                         

                        WARNING:root:Keras version 2.0.7 detected. Last version known to be fully compatible of Keras is 2.0.6 .

                        WARNING:root:TensorFlow version 1.3.0 detected. Last version known to be fully compatible is 1.2.1 .

                        Traceback (most recent call last):

                          File "coreml.py", line 9, in <module>

                            coreml_model = coremltools.converters.keras.convert(model_path, input_names="data", image_input_names='data')

                          File "/lib/python2.7/site-packages/coremltools/converters/keras/_keras_converter.py", line 504, in convert

                            predicted_probabilities_output = predicted_probabilities_output)

                          File "/lib/python2.7/site-packages/coremltools/converters/keras/_keras2_converter.py", line 155, in _convert

                            model = _keras.models.load_model(model)

                          File "/lib/python2.7/site-packages/keras/models.py", line 239, in load_model

                            model = model_from_config(model_config, custom_objects=custom_objects)

                          File "/lib/python2.7/site-packages/keras/models.py", line 313, in model_from_config

                            return layer_module.deserialize(config, custom_objects=custom_objects)

                          File "/lib/python2.7/site-packages/keras/layers/__init__.py", line 54, in deserialize

                            printable_module_name='layer')

                         

                        Possibly something to do with this in Keras/mobilenets.py:

                         

                        To load a MobileNet model via `load_model`, import the custom

                          objects `relu6` and `DepthwiseConv2D` and pass them to the

                          `custom_objects` parameter.

                          E.g.

                          model = load_model('mobilenet.h5', custom_objects={

                          'relu6': mobilenet.relu6,

                          'DepthwiseConv2D': mobilenet.DepthwiseConv2D})

                        • Re: [Announcement] coremltools-0.6.3 release notes
                          hwoolery Level 1 Level 1 (0 points)

                          Looking at it further, there is no way to supply the custom_objects param to coremltools.converters.keras.convert.  Is there any kind of workaround?  MobileNets expects you to load the module like so:

                            model = load_model('mobilenet.h5', custom_objects={

                            'relu6': mobilenet.relu6,

                            'DepthwiseConv2D': mobilenet.DepthwiseConv2D})

                        • Re: [Announcement] coremltools-0.6.3 release notes
                          allenlin Apple Staff Apple Staff (20 points)

                          Hi,

                          We've added support for Keras DepthwiseConv2D and SeparableConv2D in this release. Thank you!

                        • Re: [Announcement] coremltools-0.6.3 release notes
                          Guohui Wang Level 1 Level 1 (0 points)

                          Hi the following parameters are still not supported yet.

                          I got the following error message "Message type "caffe.LayerParameter" has no field named "permute_param"."

                          This is an SSD model.

                           

                          Details:

                           

                          (cv-py2) ⬢  coreml0.6.3  python convert.py
                          [libprotobuf ERROR /Users/sohaibqureshi/github/coremltools/deps/protobuf/src/google/protobuf/text_format.cc:287] Error parsing text-format caffe.NetParameter: 2707:17: Message type "caffe.LayerParameter" has no field named "permute_param".
                          Traceback (most recent call last):
                            File "convert.py", line 10, in <module>
                              coreml_model = coremltools.converters.caffe.convert(model=(caffe_model, caffe_proto))
                            File "/anaconda2/envs/cv-py2/lib/python2.7/site-packages/coremltools/converters/caffe/_caffe_convertert
                              predicted_feature_name)
                            File "/anaconda2/envs/cv-py2/lib/python2.7/site-packages/coremltools/converters/caffe/_caffe_converter.py", line 230, in _export
                              predicted_feature_name)
                          
                          
                          • Re: [Announcement] coremltools-0.6.3 release notes
                            rmsmith Level 1 Level 1 (0 points)

                            Does any Keras RNN with return_sequences=True work yet?