In this lab, you carry out a transfer learning example based on Inception-v3 image recognition neural network. The objective is to classify coastline images captured using drones based on their potential for flood damage. This lab is part of a series of labs on processing scientific data.
Transfer learning is a machine learning method which utilizes a pre-trained neural network. For example, the image recognition model called Inception-v3 consists of two parts:
The pre-trained Inception-v3 model achieves state-of-the-art accuracy for recognizing general objects with 1000 classes, like "Zebra", "Dalmatian", and "Dishwasher". The model extracts general features from input images in the first part and classifies them based on those features in the second part.
In transfer learning, when you build a new model to classify your original dataset, you reuse the feature extraction part and re-train the classification part with your dataset. Since you don't have to train the feature extraction part (which is the most complex part of the model), you can train the model with less computational resources and training time.
To launch Cloud Datalab:
Open Cloud Shell. The cloud shell icon is at the top right of the GCP web console:
In Cloud Shell, type:
gcloud compute zones list
Pick a zone in a geographically closeby region.
In Cloud Shell, type:
datalab create coastline --zone <ZONE>
Datalab will take about 5 minutes to start. Move on to the next step.
Enable the Cloud Machine Learning API.
Enable the Cloud Dataflow API.
You have about 8,000 images that were captured from drones and classified into categories based on their potential to suffer flood damage. For example, the aerial image above depicts "scarps and steep slopes in clay". This diagram, from "The Landslide Handbook" by LM Highland, shows the underlying structure:
Can a machine learning model that is shown examples of such coastlines learn to classify new images? As you can see, the "scarp" in question is barely visible in the image -- instead, it has to be inferred.
Switch back to the Cloud Shell tab.
If necessary, wait for Datalab to finish launching. Datalab is ready when you see a message prompting you to do a "Web Preview".
Click on the Web Preview icon on the top-right corner of the Cloud Shell ribbon.
In Datalab, click on the icon for "Open ungit" in the top-right ribbon.
In the Ungit window, select the text that reads /content/datalab/notebooks and remove the notebooks so that it reads /content/datalab, then hit enter.
In the panel that comes up, type the following as the GitHub repository to Clone from:
Then, click on Clone repository.
Switch back to the browser window where you have Cloud Datalab open and navigate to training-data-analyst/quests/scientific/coastline.ipynb
Read the narrative and click Shift + Enter (or Run) on each cell in the notebook.
Click on the person icon in the top-right corner of your Datalab window and click on the link to manage the VM.
In the web console, select the Datalab VM and click DELETE.
In the web console, navigate to the Storage section and delete the newly created bucket (its name is that of your project with
-txf appended to it).
In the web console, navigate to the BigQuery section and delete the newly created dataset called