How to register a Model

Here we will create a Model from files that we have on our computer, save it to our Registry, use it in an Experiment and then export this experiment to create a new Model, sounds good? Let's go πŸš€

Create a Model

As of today, you can only create models using our Python SDK, let's see how it's done considering that we have trained an image classification model on three classes (normal, covid, pneumonia) and that it gave us the files below:

181181

Here is the code that will create a Model in the Registry with the right properties and upload the files that we want to attach

from picsellia import Client

api_token = "<your_api_token>"

client = Client(api_token)
model_name = "new_model"
model = client.create_model(model_name, type="detection")

parameters = {
  "batch_size": 4,
  "epochs": 100,
  "learning_rate": 0.001
}

# It's important that the labels keys starts at "1"

labels = { 
  "1": "normal",
  "2": "covid",
  "3": "pneumonia"
}

model.update(
  framework="tensorflow",
  base_parameters=parameters,
  labels=labels
)

saved_model_path = "new_model/saved_model.zip"
keras_model_path = "new_model/model.h5"
  
model.store('model-latest', saved_model_path)
model.store('keras-model', keras_model_path)

Once this ran correctly, you can head over to your Model page in your Registry, it should look like something like this

14621462

Now we have everything we need to use this model as a base model for an Experiment, see you on the next tutorial πŸ‘‡


Did this page help you?