CoreML: how to use a NeuralNetworkBuilder to make a model updatable

I'm trying to create an updatable model, but this seems possible only by creating from scratch a neural network model and then, using the NeuralNetworkBuilder, call the make_updatable method.

But I met a lot of problems on this way for the solution.

In this example I try to open a converted ML Model (neural network) using the NeuralNetworkBuilder:

import coremltools

model = coremltools.models.MLModel("SimpleImageClassifier.mlpackage")
spec = model.get_spec()

builder = coremltools.models.neural_network.NeuralNetworkBuilder(spec=spec)
builder.inspect_layers()

But I met this error in the builder instance line: AttributeError: 'NoneType' object has no attribute 'layers'

I also tried to define a neural network using the NeuralNetworkBuilder but then what do I have to do with this object? I didn't find a way to save it or convert it.

The result I want is simple, the possibility to train more the model on the user device to meet his exigences. However the way to obtain an updatable model seems incomprehensible.

In my case, the model should be an image classification.

What approach should I follow to achieve this result?

Thank you

Although better documentation of the use of the CoreML Tools in Python would be appreciated, if the question boils down to the use of the models made available to Create ML, you can achieve the same result using the Swift classes like MLImageClassifier: https://developer.apple.com/documentation/createml/mlimageclassifier

They support the additional training of the models, I guess on the same architecture where the model was created.

CoreML: how to use a NeuralNetworkBuilder to make a model updatable
 
 
Q