ML Models

Machine Learning (ML) models are mathematical models that can recognize patterns.

The ML model service runs ML models on your machines. Services like the vision service can then use the ML model services to provide your machine with information about its surroundings. The ML model service works with models trained inside and outside the Viam app:

  • You can upload externally trained models on the MODELS tab in the DATA section of the Viam app.
  • You can train models on data from your machines.
  • You can use ML models from the Viam Registry.
  • You can use a model trained outside the Viam platform that’s already available on your machine.

Available machine learning models in the registry

You can search the machine learning models that are available to deploy on this service from the registry here:

Model
Type
Framework
Description

Model framework support

Viam currently supports the following frameworks:

Model FrameworkML Model ServiceHardware SupportSystem ArchitectureDescription
TensorFlow Litetflite_cpuAny CPU
Nvidia GPU
Linux, Raspbian, MacOS, AndroidQuantized version of TensorFlow that has reduced compatibility for models but supports more hardware. Uploaded models must adhere to the model requirements.
ONNXonnx_cpuAny CPU
Nvidia GPU
Android, MacOS, Linux arm-64Universal format that is not optimized for hardware inference but runs on a wide variety of machines.
TensorFlowtritonNvidia GPULinux (Jetson)A full framework that is made for more production-ready systems.
PyTorchtritonNvidia GPULinux (Jetson)A full framework that was built primarily for research. Because of this, it is much faster to do iterative development with (model doesn’t have to be predefined) but it is not as “production ready” as TensorFlow. It is the most common framework for OSS models because it is the go-to framework for ML researchers.

Versions

If you deploy a model to a machine, Viam automatically assumes that this is the latest version of the model and that you would always like to deploy the latest version of the model to the machine. If you train a new version of that model, Viam will automatically deploy the new version to the machine and replace the old version.

If you do not want Viam to automatically deploy the latest version of the model, you can change packages configuration in the JSON machine configuration. The model package config looks like this:

{
  "package": "<model_id>/<model_name>",
  "version": "YYYY-MM-DDThh-mm-ss",
  "name": "<model_name>",
  "type": "ml_model"
}

You can get the version number from a specific model version by navigating to the models page finding the model’s row, clicking on the right-side menu marked with and selecting Copy package JSON. For example: 2024-02-28T13-36-51.

If you need to make changes to a model, you can edit or delete it on its page which you can access from the MODELS tab.

Next steps

Use the ML model service to deploy a machine learning model to your machine:

Follow one of these tutorials to see ML models in action:

Have questions, or want to meet other people working on robots? Join our Community Discord.

If you notice any issues with the documentation, feel free to file an issue or edit this file.