Use our custom Keras callback class to reduce the number of steps needed to test out the latest version of a model in your mobile app. The
FritzSnapshotCallback helps upload and convert mobile models as you train your model.
Create converter functions to convert Keras model to Mobile Frameworks
Build converter functions for each mobile framework you wish to use. Each converter function should return an instance of that framework's model:
You will most likely use the
coremltools library from Apple.
If you are unsure how to convert the model, the coremltools documentation can help you get started.
Here is an example on how to convert the Image Segmentation model available Image Segmentation Model:
Configure the FritzSnapshotCallback
Next, you will configure the
FritzSnapshotCallback with the converters you wish to use for training.
You can configure the following parameters for the
|output_file_name|| (Required) |
Output file name of saved Keras model.
|model_uids_by_framework||None (default) |
Dictionary mapping model framework to model uids. If model_uid not set for a given platform, a new model will be created.
|converters_by_framework||None (default) |
Dictionary mapping model framework to conversion function.
|period||10 (default) |
Interval (number of epochs) between uploading new versions of models.
|deploy||False (default) |
If True, will update the active version to the newly uploaded models.
|api_key||None (default) |
Optional API Key which overrides the globally set value
|project_uid||None (default) |
Optional Project UID which overrides the globally set value.
Connecting to existing Fritz AI models
Specify the Model ID
If you already have a model in Fritz AI that you wish to update you can specify which model to update:
When the callback runs, it will upload models to the specified model ID.
Use an existing model name
Alternatively, if you do not specify a Model ID, Fritz AI will look for models with the same name as the filename.
Re-training a model used in a production app
If you are re-training a model deployed in a production app, you may want to test out a model as it is being retrained without deploying the model to all users. In this case, we strongly recommend you create a new development version of the model in the webapp. Here are the basic steps:
- Create a new model development model from the Models page using the current version of the model.
- Update the
modelIdentifierin your local development app with the model identifier of the newly created model.
- Create a
FritzSnapshotCallbackcallback specifying the Model ID:
- Begin training the model. During training, your local development app will update, but production apps will not be affected.
- After you have finished training and wish to deploy model to all users, download the model version and add as a new version in the webapp.
- To deploy this update to all devices, set the active version to the latest uploaded version from the Model Details page in the webapp.
- If you are done using the development model, archive it from the Model Details page so it does not show up in your active model list.