Introduction to U-Net and Res-Net for Image Segmentation

Background — Convolutional Neural Network (CNN)

CNNs are similar to a neural network with various neutrons with learnable weights and biases. Each neuron is given a number of inputs, weighted sum is performed, activation function is applied and output is given. The network has a loss function which is used to minimize the error in weights. A machine sees an image as a matrix of pixels with image resolution as h x w x d where h is the height, w is the width and d is the dimension. d depends on the color scale such as 3 for RGB scale and 1 for grayscale. In CNN, the image is converted into a vector which is largely used in classification problems. But in U-Net, an image is converted into a vector and then the same mapping is used to convert it again to an image. This reduces the distortion by preserving the original structure of the image.
CNN is largely used when the whole image is needed to be classified as a class label. But many tasks requires to classify each pixel of the image. This is solved by the U-net and Res-Net.

U-Net Architecture

Residual Networks (Res-Net)

In traditional neural networks, more layers mean a better network but because of the vanishing gradient problem, weights of the first layer won’t be updated correctly through the back-propagation. As the error gradient is back-propagated to earlier layers, repeated multiplication makes the gradient small. Thus, with more layers in the networks, its performance gets saturated and starts decreasing rapidly. Res-Net solves this problem by using the identity matrix. When the back-propagation is done through identity function, the gradient will be multiplied only by 1. This preserves the input and avoids any loss in the information.

Res-Net Architecture
Residual Block
R(x) = Output - Input = H(x) - x



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Aditi Mittal

Aditi Mittal

Machine Learning Enthusiast | Software Developer