Kelp Wanted Challenge Starter Code

Getting Started with MATLAB

We at MathWorks, in collaboration with DrivenData, are excited to bring you this challenge! The goal is to develop an algorithm that can use provided satellite imagery to predict where kelp is present and where it is not. Kelp is a type of algae that often grows in clusters known as kelp forests, which provide shelter and stability for many coastal ecosystems. The presence and growth of kelp is an important measurement for evaluating the health of these ecosystems, so the ability to easily and consistently monitor kelp forests could be a huge step forward in coastal climate science. In this blog, we will explore the data using the Hyperspectral Viewer app, preprocess the dataset, then create, evaluate, and use a basic semantic segmentation model to solve this challenge. Note that this model was trained on a subset of the data, so the numbers and individual file and folder names may be different from what you see in the full competition dataset.
To request your complimentary MATLAB license and access additional learning resources, check out this website!

Table of Contents:

  1. Explore and Understand the Data
  2. Import the Data
  3. Preprocess the Data
  4. Design and Train a Neural Network
  5. Evaluate the Model
  6. Create Submissions

Explore and Understand the Data

Instructions for accessing and downloading the competition data can be found here. Let's read in a sample image and label for tile ID AA498489, which we will explore to gain a better understanding of the data.
firstImage = imread('train_features/AA498489_satellite.tif');
firstLabel = imread('train_labels/AA498489_kelp.tif');

The Input: Satellite Images

The input data is a set of augmented satellite images that have seven layers or "bands", so you can think of it as 7 separate images all stacked on top of each other, as shown below
Each band is looking at the same exact patch of earth, but they each contain different measurements. The first 5 bands contain measurements taken at different wavelengths of the light spectrum, and the last two are supplementary metrics to better understand the environment. The following list shows what each of the seven bands measures:
  1. Short-wave infrared (SWIR)
  2. Near infrared (NIR)
  3. Red
  4. Green
  5. Blue
  6. Cloud Mask (binary - is there cloud or not)
  7. Digital Elevation Model (meters above sea-level)
Typically, most standard images just measure the red, green, and blue values, but by including additional measurements, hyperspectral images can enable us to identify objects and patterns that may not be easily seen with the naked eye, such as underwater kelp. For more detail on what each band captures, check out the competition�s problem description page.

The Spectral Bands (1-5)

Let's start by exploring the first five layers. The rescale function adjusts the values of the bands so that they can be visualized as grayscale images, and the montage function displays each band next to each other.
montage(rescale(firstImage(:, :, 1:5)));
Here we can see that there are some land masses present, and that the SWIR and NIR bands have higher values than the red, green, and blue bands when looking at this patch of earth, as they are brighter. This doesn't tell us much about the data, but gives us an idea of what we are looking at.

Hyperspectral Viewer

You can use the Hyperspectral Viewer app to further explore the first five layers. Note that this requires the Image Processing Toolbox� Hyperspectral Imaging Library, which can be installed through the Add-On Explorer, and is not supported in MATLAB Online. The center wavelengths shown below are approximated from this resource.
firstImSatellite = firstImage(:, :, 1:5);
centerWavelengths = [1650, 860, 650, 550, 470]; % in nanometers
hcube = hypercube(firstImSatellite, centerWavelengths);
hyperspectralViewer(hcube);
When the app opens, you'll have the ability to view single bands on the left pane and various band combinations on the right. Note that the bands are shown in order of wavelength, not in the order they are loaded, so in the app the bands are in reverse order. Band 1 = Blue, Band 5 = SWIR.
On the left pane, you can scroll through and view each band one at a time. You can also manually adjust the contrast to make it easier to see or to make it representative of a different spectrum than the default.
ExploreBands.gif
On the right, you'll have the ability to see False Color, RGB, and CIR images. RGB images are just standard color images, and show the earth as we would see it from a typical camera. False Color and CIR images convert the measurements from the SWIR and NIR bands, which are not visible from the human eye, to colors that we can see. You can manually adjust the bands to create custom images as well.
In this pane, you also have the ability to create spectral plots for a single pixel, which shows what value that pixel holds for each band. Since this image has land, sea, and coast, I'll create spectral plots for a pixel in each of these areas to see how they differ.
BandCombos.gif
This app also provides the ability to plot and interact with various spectral indices that calculate different measurements related to vegetation, which could provide helpful additional information when looking for kelp. Learn more about these spectral indices by checking out this documentation link.