In this project, you'll label the pixels of a road in images using a Fully Convolutional Network (FCN).
Make sure you have the following is installed:
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.
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 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.
- Does the project load the pretrained vgg model?
- Does the project learn the correct features from the images?
- Does the project optimize the neural network?
- Does the project train the neural network?
Four tests,
tests.test_load_vgg(load_vgg, tf)
,tests.test_layers(layers)
,tests.test_optimize(optimize)
, andtests.test_train_nn(train_nn)
are passed correctly. However, If I do data_augmentation intrain_nn
with my own class (this line:img, label_mask = dataAug.do(img,label_mask)
),tests.test_train_nn(train_nn)
will got error. I'm not sure what happens but I have verified that my augmentation function is correct and works fine during training. Also, loss is certainly printed while training.
in train_nn() function:
print("EPOCH {} with {} training time...".format(itr+1,etime - stime))
print("\t ",loss_per_epoch)
- Does the project train the model correctly? On average, the model decreases loss over time.
- Does the project use reasonable hyperparameters?
- epoch number = 300
- batch_size = 4
- Adam learning rate = 0.001, with a decreasing value w.r.t. epoch
- l2 regularizations with value 1e-3 in decoder part. (manually add regularization loss with xent loss)
- Data augmentation with three types of pre-processing: flip, create shadow, blur
- As suggested in Tips, I scaled
vgg_layer3_out
andvgg_layer4_out
in decoder part. It really produces more accurate images.- VGG parameters are not updated during training. Pass variables in decoder part to optimizer:
train_op = optimizer.minimize(loss_operation, var_list = trainable_collection)
with tf.variable_scope('decoder'):
layer_output = layers(l3out, l4out, l7out, num_classes)
vars_decoder = tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES,scope='decoder')
# We only update variables in this collection, vars_decoder, which will pass to optimizer later
- Does the project correctly label the road?
Since we don't have the ground truth for test images. We can only measure by eye. These are the results: