2 Replies
      Latest reply: Aug 10, 2017 11:34 PM by michael_s RSS
      michael_s Apple Staff Apple Staff (20 points)

        (including Beta 4 changes)

        Neural Networks:

        • Additional neural network layers: linear option in upsampling, reduction with axis mode, slice, spaces to depth, depth to spaces
        • Separate preprocessing (channel bias and mean image subtraction) for multiple input images is now fully supported

         

        API:

         

        Model Validation:

        • The model compiler (and Xcode viewer) now requires validated models with all type information filled in.
        • You may see errors in Xcode or from the compiler with statements such as:
          • "validator error: Description of multiarray feature '__feature_vector__' has invalid or unspecified dataType. It must be specified as DOUBLE, FLOAT32 or INT32"
        • If you see this or a similar validation error you must update your model. You can do this by either
          • Re-converting the model from its source using the latest coremltools 0.5.1
          • Try running the following on the macOS 10.13 command line:
            • xcrun coremlcompiler repair <path/to/invalid.mlmodel>

         

        Xcode:

        • Generated code now includes availability macros
        • Known Bug: Availability for macOS/OSX is incorrect (13.0 instead of 10.13). This will be fixed in an upcoming release

         

        Fixes:

        • Removed memory leaks when a model outputs an image.
        • Removed memory leaks in SVM models.
        • Fixes to allow the use of pipeline classifiers where the class labels were integers.
        • Fixes to input and output layer selection in neural networks.
        • Float32 input and output MLMultiArrays for Neural Networks now fully supported

         

        Coremltools - 0.5.1

        • The new permanent home for the documentation is https://apple.github.io/coremltools/. The old documentation links on PyPI have been removed.
        • Keras 2 converter now supports dilated convolution, depth-wise and separable convolution.
        • Keras 1.2 converter now supports atrous convolution.
        • Image outputs now supported in the Python bindings for model prediction.
        • Fixes to the 'add' operator in the neural network builder.
        • Re: Core ML Beta 5 Release Notes
          Guohui Wang Level 1 Level 1 (0 points)

          How can I convert the model so that the input output MLMultiArray would accept Float32 data type?

          Currently, the mlmodel only accepts double data type.

            • Re: Core ML Beta 5 Release Notes
              michael_s Apple Staff Apple Staff (20 points)

              coremltools defaults to using Double as the dataType for MLMultiArrays.

               

              You can manually change this for neural networks after the conversion is done by modifying the feature descriptions in the resulting spec or .mlmodel file.

               

              For example, here is a script that takes a path to a .mlmodel file, sets any multidimensional array input and output features to have dataType be Float32, and then saves the result to a supplied output model path.

               

              import coremltools
              import sys
              
              def update_multiarray_to_float32(feature):
                  if feature.type.HasField('multiArrayType'):
                      import coremltools.proto.FeatureTypes_pb2 as _ft
                      feature.type.multiArrayType.dataType = _ft.ArrayFeatureType.FLOAT32
              
              if __name__ == "__main__":
                  if len(sys.argv) != 3:
                      print "USAGE: %s <input_model_path> <output_model_path>" % sys.argv[0]
                      sys.exit(1)
              
                  input_model_path = sys.argv[1]
                  output_model_path = sys.argv[2]
              
                  spec = coremltools.utils.load_spec(input_model_path)
              
                  for input_feature in spec.description.input:
                      update_multiarray_to_float32(input_feature)
              
                  for output_feature in spec.description.output:
                      update_multiarray_to_float32(output_feature)
              
                  coremltools.utils.save_spec(spec, output_model_path)