IBM  Cloud Annotations
IBM Developer

Training a model

After we have collected and labeled our first round of images, we are ready to start training our model!


To train our model we need to install the Cloud Annotation CLI.

Homebrew (macOS)

If you are on macOS and using Homebrew, you can install cacli with the following:

$ brew install cacli

Shell script (Linux / macOS)

If you are on Linux or macOS, you can install cacli with the following:

$ curl -sSL | sudo sh

Binary (Windows / Linux / macOS)

Download the appropriate version for your platform from the releases page. Once downloaded, the binary can be run from anywhere. You don’t need to install it into a global location. This works well for shared hosts and other systems where you don’t have a privileged account.

Ideally, you should install it somewhere in your PATH for easy use. /usr/local/bin is the most probable location.

Submit a training run to WML

The model we will be training is the SSD MobileNet architecture. SSD MobileNet models have a very small file size and can execute very quickly with compromising little accuracy, which makes it perfect for running in the browser.

When we say we are training the model, we are technically re-training the model. The model we are training has already been trained on millions of image and thousands of categories ranging from ducks to airplanes. This helps teach the model ideas like basic edges and shapes, letting us train it on the things we care about with little training data.

To start training, run the following commands:

cacli login
cacli train

Note: You can monitor the training run at any point by running cacli progress <model_id>.

Download the model

Once the model training is complete, we can download our model:

cacli download <model_id> --tfjs --coreml --tflite

This will download a model_* directory from our TensorFlow graph, which is what we will use in our app.