top of page

Project:

Semantic Segmentation using U-Net

​

Skills Involved:

Deep Learning

Tensorflow

Convolutional Neural Networks

Python

​

github(1).png
Code

Description

Aim: To perform Semantic Segmentation using the U-Net architecture in Deep Learning.

​

Steps Involved:

  1. Creating a script test_utils.py which gives us a summary of the model through the summary function.

  2.  Importing the required packages like tensorflow, matplotlib, imageio, etc.

  3. Loading and splitting the dataset: (a) RGB Images and (b) Mask Images.

  4. Checking out the masked and unmasked images from the dataset to make sure they are in order and have the same index.

  5. Splitting the dataset to masked and unmasked images while setting the shuffle parameter as False.

  6. Preprocessing the data: Resizing the images to (96, 128) and setting the method parameter to the nearest.

  7. Writing functions for conv block(Encoder) and upsampling box(decoder) while the former returns the skip connections and the latter concatenates them with each output.

  8. Creating a function for building the model including both the functions created above.

  9. Conv2D from tf.keras.layers was used with parameters: activation-relu, padding-same, kernel_initializer-he_normal.

  10. Setting model Dimensions as: img_height = 96, img_width = 128, num_channels = 3 and getting the summary of the model.

  11. Using the compile function with adam optimizer and CategoricalCrossentropy loss and accuracy as the metrics.

  12. Training the model with epochs=5, validation subsplits=5, batch_size=32.

  13. Created a mask function to return the predicted mask.

  14. Plotting the accuracy.

  15. Getting the predictions from the output using matplotlib functions.

Latest Accuracy of the model

ip1.png
ip6.png
ip4.png
ip3.png
ip2.png
ip5.png

Input Image

True Mask

Predicted Mask

bottom of page