Custom Vision: Chapter 9 - Train and Deploy an Object Detection model using Vertex AI

Computer Vision Aug 11, 2021

Hello again!!! We are back with yet another article where we will talk about the most fun and practical part of Vertex AI: Train and Deploy. We have finally reached the end of our journey with Custom Vision.

Or have we?

Story So Far

Let's have a quick recap of what we learned so far in this series.

  1. How do computers perceive images like humans do and identify different objects: Custom Vision: Chapter 6 - Object Detection
  2. How to use Label Studio or any other data annotation tools to annotate our images: Custom Vision: Chapter 7 - Object Detection - Data Annotation
  3. How to setup Google - Vertex AI to train an Object Detection model: Custom Vision: Chapter 8 - Object Detection with Vertex AI

Today we will talk about the final step which will logically conclude all the tasks we performed earlier in this series. So what are we waiting for? Let's dive right in...

Let's Start Training

Now let's see how can we start training on the dataset we uploaded earlier. We just need to navigate to Vertex AI and locate the dataset we created earlier.

Now that we have located the desired dataset, we can start training just by clicking on the "Train New Model" button on the right side of the screen.

Wait, is that it?

Not yet. We need to provide some additional details for Vertex AI to understand what are we trying to do here. There are few attributes we need to provide before starting the training process.

  1. Training Method: Which training methodology we need our model to follow. AutoML, AutoML Edge, or Custom training. Refer to our previous article where we have explained all these different methods in detail.
  2. Model Name: A unique name for the trained model. This will help us locate the model later.
  3. Type of Training: We need to make a selection here whether we want our inferences to be higher on the accuracy or higher on prediction speed. This decision can be made based on business requirements. If accuracy is a priority or low latency.
  4. Compute and Pricing: Let's talk money now. We need to enter the number of nodes we need to train our model on. The selection we make here will directly impact our monthly bill, so we need to keep this in mind before providing a number.
  5. Early Stopping: Vertex AI provides us an option to enable early stopping while training our model. Early Stopping is a widely used approach to prevent the Deep-Learning model from overfitting.

Now that we have configured the training job the way we want, let's initiate training by clicking on "Start Training"

Too much information? Don't worry, we have consolidated all the steps mentioned above in the video below.
Train Object Detection Model on Vertex AI
The training process will take few hours to complete depending on the type of model and size of the dataset. Its time for a short break. :)

Deploy Model

After few cups of coffee and a short power nap, we got a notification from Google stating that the model we trained, is ready for deployment. So we are back on the Vertex AI landing page.

Let's locate our model in the "Models" section, with the name we provided at the time of training, and drill down on the model to see details.

Here we can evaluate and visualize what our model has learned. There are multiple evaluation matrices available to monitor and analyze.

  1. Precision Score
  2. Recall Score
  3. IoU Threshold
  4. Confidence Score
Model Evaluation Screen
We would like to spend some time here to analyze and evaluate what our model has learned. This is a critical step that may highly depend on business requirements.

Now that we have evaluated the model and are satisfied with what the model has learned, it's time to finally deploy the model and make it available for others to test on.

To do so, we need to navigate to the "Deploy & Test" tab and just click on the "Deploy To Endpoint" button.

Wait!!! there is more to the story. We need to pass on some more attributes.

  1. Model Endpoint: Provide a name to your hosted model endpoint. This can be anything but should only contain letters, numbers, and underscores.
  2. Compute Nodes: We need to host the model for inference and that requires an always-on instance to host it. We need to provide the number of nodes we want to be always hosting our trained model. Keep in mind, this will have an impact on pricing.
  3. Region: Next we need to select the region where we want our model to be hosted.

Once all the attributes are selected, click on the "Deploy" button and sit back.

Model Deployment Screen

All done!!! We have trained and deployed our own Object Detection model using Vertex AI. Now we can share the endpoint with the business users and test our model on real-time data.

Conclusion

We have concluded our mini-series on Custom Object Detection and we have a custom object detection model in our hand. What could have been a better way to conclude a series!!!

Stay tuned to stay updated with all the latest AI tools and frameworks available in the market. See you soon in our future posts.

Tags

Arpit Jain

Machine Learning Engineer

Great! You've successfully subscribed.
Great! Next, complete checkout for full access.
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.