Developing ML models with AI Platform for image segmentation on CT scans requires a lot of
computation and experimentation, as image segmentation is a complex and challenging task that
involves assigning a label to each pixel in an image. Image segmentation can be used for various
medical applications, such as tumor detection, organ segmentation, or lesion localization1
To minimize the computation costs and manual intervention while having version control for the
code, one should use Cloud Build linked with Cloud Source Repositories to trigger retraining when
new code is pushed to the repository. Cloud Build is a service that executes your builds on Google
Cloud Platform infrastructure. Cloud Build can import source code from Cloud Source Repositories,
Cloud Storage, GitHub, or Bitbucket, execute a build to your specifications, and produce artifacts
such as Docker containers or Java archives2
Cloud Build allows you to set up automated triggers that start a build when changes are pushed to a
source code repository. You can configure triggers to filter the changes based on the branch, tag, or
file path3
Cloud Source Repositories is a service that provides fully managed private Git repositories on Google
Cloud Platform. Cloud Source Repositories allows you to store, manage, and track your code using
the Git version control system. You can also use Cloud Source Repositories to connect to other
Google Cloud services, such as Cloud Build, Cloud Functions, or Cloud Run4
To use Cloud Build linked with Cloud Source Repositories to trigger retraining when new code is
pushed to the repository, you need to do the following steps:
Create a Cloud Source Repository for your code, and push your code to the repository. You can use
the Cloud SDK, Cloud Console, or Cloud Source Repositories API to create and manage your
repository5
Create a Cloud Build trigger for your repository, and specify the build configuration and the trigger
settings. You can use the Cloud SDK, Cloud Console, or Cloud Build API to create and manage your
trigger.
Specify the steps of the build in a YAML or JSON file, such as installing the dependencies, running the
tests, building the container image, and submitting the training job to AI Platform. You can also use
the Cloud Build predefined or custom build steps to simplify your build configuration.
Push your new code to the repository, and the trigger will start the build automatically. You can
monitor the status and logs of the build using the Cloud SDK, Cloud Console, or Cloud Build API.
The other options are not as easy or feasible. Using Cloud Functions to identify changes to your code
in Cloud Storage and trigger a retraining job is not ideal, as Cloud Functions has limitations on the
memory, CPU, and execution time, and does not provide a user interface for managing and tracking
your builds. Using the gcloud command-line tool to submit training jobs on AI Platform when you
update your code is not optimal, as it requires manual intervention and does not leverage the
benefits of Cloud Build and its integration with Cloud Source Repositories. Creating an automated
workflow in Cloud Composer that runs daily and looks for changes in code in Cloud Storage using a
sensor is not relevant, as Cloud Composer is mainly designed for orchestrating complex workflows
across multiple systems, and does not provide a version control system for your code.
Reference: 1: Image segmentation 2: Cloud Build overview 3: Creating and managing build
triggers 4: Cloud Source Repositories overview 5: Quickstart: Create a repository : [Quickstart: Create
a build trigger] : [Configuring builds] : [Viewing build results]