EE3901/EE5901 Sensor Technologies
Week 11 Tutorial

Profile picture
College of Science and Engineering, James Cook University
Last updated: 09 May 2023

Near infrared spectroscopy — software exercise

Your task is to build a classifier that can locate avocados using near infrared (NIR) images.

Click here to download the data and Matlab starter code (313 MB zip). The file contains three hyperspectral images of avocados, which were captured in the JCU Rapid Assessment Unit laboratory. Each image has a single avocado against a dark metal background. In visible light these are a similar colour and so automatically locating the avocados would require substantial programming effort. However, in NIR light, these two materials are dramatically different. Hence the classification based on the hyperspectral images is fairly easy.

There is Matlab starter code provided alongside the data that will guide you through the steps. Download this code and work through the instructions in the file. Some key steps are illustrated in Figures 1 – 5.

Figure 1: True colour image of avocado fruit against the dark metal background. In visible light these objects are not easy to distinguish. Zoom:
Figure 2: Example of using the hyperspectral image viewer with two spectral plots (blue and red dots) enabling comparison of the different spectra between the different material. Zoom:
Figure 3: Example of using the image segmenter tool to export data for training. Zoom:
Figure 4: Hand-labelled image mask used for training. Zoom:
Figure 5: The prediction result when testing the model on a different image. Zoom: