Skip to main content

Train and Deploy an AutoML Image Classification Model with Vertex AI

· 4 min read

This tutorial guides you through the process of using Vertex AI to train and deploy an AutoML Image Classification model. You'll use a public flower image dataset, train the model using AutoML, evaluate its performance, deploy it to an endpoint, and send predictions — all from the Google Cloud Console.


🧱 Step 1: Set Up Your Google Cloud Project

Select or Create a Project

  1. Visit the Google Cloud Console project selector.
  2. Choose an existing project or create a new one for this tutorial.

💡 Tip: If you don't plan to retain the resources, create a new project so cleanup is easier.

Open Cloud Shell

Click the Activate Cloud Shell button in the top-right of the console. Once ready, set your project ID:

gcloud config set project PROJECT_ID
export projectid=PROJECT_ID
echo $projectid

Replace PROJECT_ID with your actual project identifier.


🔧 Step 2: Enable Required APIs

Run the following command in Cloud Shell:

gcloud services enable   iam.googleapis.com   compute.googleapis.com   notebooks.googleapis.com   storage.googleapis.com   aiplatform.googleapis.com

🔐 Step 3: Set IAM Permissions

Grant the necessary IAM roles:

gcloud projects add-iam-policy-binding PROJECT_ID   --member="user:your-email@example.com"   --role=roles/aiplatform.user

gcloud projects add-iam-policy-binding PROJECT_ID --member="user:your-email@example.com" --role=roles/storage.admin

These permissions allow you to use Vertex AI and access Cloud Storage for dataset management.


🗂️ Step 4: Create and Import Image Dataset

Open Vertex AI > Datasets

  1. Click Create Dataset.
  2. Select Image as the data type.
  3. Choose Image Classification (Single-label).
  4. Set region to us-central1.
  5. Enter a name for the dataset (optional).
  6. Click Create.

Import Data from Cloud Storage

Use this public CSV containing image URIs and labels:

cloud-samples-data/ai-platform/flowers/flowers.csv

This CSV includes rows like:

gs://cloud-samples-data/ai-platform/flowers/daisy/10559679065_50d2b16f6d.jpg,daisy
gs://cloud-samples-data/ai-platform/flowers/dandelion/10828951106_c3cd47983f.jpg,dandelion

📌 You'll see a preview of your images and labels after import completes (takes a few minutes).


🧠 Step 5: Train AutoML Model

  1. Go to the Models section.
  2. Click Train new model.
  3. Select:
    1. Training method: AutoML
    2. Target dataset: Your image dataset
  4. (Optional) Name your model.
  5. Define training options:
    • Training budget: 8 node hours
    • Enable Incremental Training: Only if you have a base model
  6. Click Start training.

📬 You’ll get an email notification when training finishes (can take several hours).


📈 Step 6: Evaluate Model

Navigate to the Evaluate tab of your model:

  • View key metrics:
    • Precision
    • Recall
    • Confusion Matrix
  • Analyze false positives, false negatives, and true positives.
  • Use Review Similar Images to find label inconsistencies or outliers.

🔍 Fix incorrect labels and re-train if needed to improve accuracy.


🚀 Step 7: Deploy Model to Endpoint

  1. Go to Deploy & Test tab.
  2. Click Deploy to Endpoint.
  3. Choose:
    • Create New Endpoint
    • Name: image-classification
    • Traffic Split: 100%
    • Compute Nodes: 1
  4. Click Deploy.

Deployment takes a few minutes.


🧪 Step 8: Send a Prediction

After deployment:

  1. Go to Deploy & Test > Test your model.
  2. Click Upload Image.
  3. Choose a local image.
  4. View the predicted label and confidence.

🧹 Step 9: Clean Up Resources

To avoid charges, delete the resources:

Undeploy Model

Vertex AI > Models > Deploy & Test > Undeploy

Delete Endpoint

Vertex AI > Endpoints > Delete image-classification

9.3 Delete Model and Dataset

Vertex AI > Models > Delete
Vertex AI > Datasets > Delete

Delete Cloud Storage Bucket

Go to Cloud Storage and delete your bucket.


📚 Summary

  • ✅ Created dataset with labeled images
  • ✅ Trained an AutoML image classification model
  • ✅ Evaluated model performance
  • ✅ Deployed to a live endpoint
  • ✅ Sent predictions and cleaned up

Vertex AI simplifies machine learning workflows with a UI-based AutoML approach. Stay tuned for more advanced tutorials on custom training, multi-class classification, and model explainability.


💡 "Teaching AI has never been easier. With Vertex AI, all you need is your data."