Speeding Up Semantic Segmentation Using MATLAB Container from NVIDIA NGC

MATLAB makes it easy for engineers to train deep-learning models for semantic segmentation, taking advantage NVIDIA GPU acceleration

Bruce Tannenbaum
8 min readintermediate
--
View Original

Overview

This article discusses how to accelerate semantic segmentation training using the MATLAB container from NVIDIA NGC on AWS cloud instances. It highlights the advantages of using multi-GPU setups and provides insights into the implementation and performance improvements achieved with NVIDIA GPUs.

What You'll Learn

1

How to utilize multi-GPU setups for training deep learning models in MATLAB

2

Why semantic segmentation is crucial for applications like automated driving and medical imaging

3

How to implement data augmentation techniques in MATLAB for improving model accuracy

4

When to use the MATLAB container for deep learning on AWS cloud instances

Prerequisites & Requirements

  • Basic understanding of deep learning concepts and semantic segmentation
  • MATLAB software and access to AWS cloud instances

Key Questions Answered

What is semantic segmentation and why is it important?
Semantic segmentation is a deep learning algorithm that assigns a label to every pixel in an image, providing detailed recognition capabilities. This is essential in fields like automated driving, where precise identification of road surfaces is critical, and in medical imaging for accurately identifying the shape and size of cancer cells.
How much faster is training with multiple GPUs compared to a single GPU?
Using a single V100 NVIDIA GPU on a p3.2xlarge instance took about 121 minutes for training, while using eight V100 GPUs on a p3.16xlarge instance reduced the training time to just 37 minutes, achieving a performance improvement of 3.25 times.
What are the key MATLAB commands for managing image datasets?
The key MATLAB command for managing large image datasets is 'imageDatastore', which allows the entire dataset to be treated as a single object. Additionally, 'pixelLabelDatastore' is used for managing pixel labels in semantic segmentation tasks, facilitating efficient data handling during training.
What training options should be set for using multiple GPUs in MATLAB?
To utilize multiple GPUs in MATLAB, the 'ExecutionEnvironment' training option should be set to 'multi-gpu'. This simple change allows the training process to leverage the power of multiple NVIDIA GPUs, significantly speeding up the training time.

Key Statistics & Figures

Training time with single V100 GPU
121 minutes
This was the time taken for training the SegNet model on a p3.2xlarge instance.
Training time with eight V100 GPUs
37 minutes
This was the reduced training time achieved on a p3.16xlarge instance, demonstrating a 3.25x performance improvement.

Technologies & Tools

Some links below are affiliate links. We may earn a commission if you make a purchase.

Software
Matlab
Used for developing and training deep learning models.
Hardware
Nvidia Gpus
Utilized for accelerating the training process of deep learning models.
Cloud Service
AWS
Provides scalable cloud instances for running MATLAB containers.

Key Actionable Insights

1
Leverage the MATLAB container for deep learning to simplify the setup process on AWS.
Using the MATLAB container from NVIDIA NGC allows developers to focus on model training without worrying about the complexities of environment setup, making it ideal for rapid experimentation.
2
Implement data augmentation techniques to enhance model performance.
By using functions like 'imageDataAugmenter', you can create more diverse training data, which is crucial for improving the robustness and accuracy of your semantic segmentation models.
3
Utilize AWS P3 instances for scalable GPU resources.
AWS P3 instances provide access to powerful NVIDIA GPUs, allowing for efficient training of deep learning models without the need for upfront hardware investment.

Common Pitfalls

1
Setting the MiniBatchSize too high can lead to memory issues during training.
In semantic segmentation, the default MiniBatchSize of 256 is often too large, so it is recommended to adjust this value to prevent memory overload, especially when using high-resolution images.

Related Concepts

Deep Learning
Semantic Segmentation
Data Augmentation
Multi-gpu Training