Skip to content

My solution for the semantic segmentation project at Udacity Self Driving Car Nanodegree

License

Notifications You must be signed in to change notification settings

KiqueGar/CarND-Semantic-Segmentation

Repository files navigation

Semantic Segmentation

Introduction

The goal of this project is to implement a convolutional neural network to perform semantic segmentation on road images. The project is trained and tested over the KITTI dataset and implemented over the VGG-16 architecture

Architecture

A pre-trained VGG-16 network was converted to a fully convolutional network, converting it's fully connected layer into 1x1 convolution and upsampling to it's previous layers. Only 2 categories are present: road and not road

  • Loss function is cross entropy
  • Adam optimizer is used
  • Dropout is 0.5
  • Learning rate starts at 0.001
  • Batch size = 1
  • Epochs = 50

An Amazon EC2 g2.8xlarge instance was used for training, however, by memory constraints, batch size is defined as 1

Loss is decaying as expected, it might seem that it's tarting to rise after epoch 40 A first training was made wich seems to converge around epoch 40, fromwhere it starts to rise. Another training was made using a g3.4xlarge instance, a lower learning rate (0.00003) and higher dropout rate (0.75) helped to counterbalance for a higher batch size (8 vs 2)

Below we can see the comparisson between 2 training runs, we see a almost the same steady value, however, we see a smoother loss function with a lower learning rate (also, initial error is bigger)

Loss plot

Results

The road is mostly correctly classified as driveable, also, the model performs as expeted on some of the videos propossed

Sample1 Sample2 Sample3

Videos on youtube

Original Udacity Readme ahead

Introduction

In this project, you'll label the pixels of a road in images using a Fully Convolutional Network (FCN).

Setup

GPU

main.py will check to make sure you are using GPU - if you don't have a GPU on your system, you can use AWS or another cloud computing platform.

Frameworks and Packages

Make sure you have the following is installed:

Dataset

Download the Kitti Road dataset from here. Extract the dataset in the data folder. This will create the folder data_road with all the training a test images.

Start

Implement

Implement the code in the main.py module indicated by the "TODO" comments. The comments indicated with "OPTIONAL" tag are not required to complete.

Run

Run the following command to run the project:

python main.py

Note If running this in Jupyter Notebook system messages, such as those regarding test status, may appear in the terminal rather than the notebook.

Submission

  1. Ensure you've passed all the unit tests.
  2. Ensure you pass all points on the rubric.
  3. Submit the following in a zip file.
  • helper.py
  • main.py
  • project_tests.py
  • Newest inference images from runs folder (all images from the most recent run)

Tips

  • The link for the frozen VGG16 model is hardcoded into helper.py. The model can be found here
  • The model is not vanilla VGG16, but a fully convolutional version, which already contains the 1x1 convolutions to replace the fully connected layers. Please see this forum post for more information. A summary of additional points, follow.
  • The original FCN-8s was trained in stages. The authors later uploaded a version that was trained all at once to their GitHub repo. The version in the GitHub repo has one important difference: The outputs of pooling layers 3 and 4 are scaled before they are fed into the 1x1 convolutions. As a result, some students have found that the model learns much better with the scaling layers included. The model may not converge substantially faster, but may reach a higher IoU and accuracy.
  • When adding l2-regularization, setting a regularizer in the arguments of the tf.layers is not enough. Regularization loss terms must be manually added to your loss function. otherwise regularization is not implemented.

Using GitHub and Creating Effective READMEs

If you are unfamiliar with GitHub , Udacity has a brief GitHub tutorial to get you started. Udacity also provides a more detailed free course on git and GitHub.

To learn about REAMDE files and Markdown, Udacity provides a free course on READMEs, as well.

GitHub also provides a tutorial about creating Markdown files.

About

My solution for the semantic segmentation project at Udacity Self Driving Car Nanodegree

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages