├── LICENSE └── README.md /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 mahdieslaminet 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SegNet Implementation with TensorFlow 2 2 | 3 | This repository contains an implementation of the SegNet deep convolutional neural network architecture for semantic pixel-wise image segmentation using TensorFlow 2. The implementation is provided in a Jupyter Notebook (`SegNet_Implementation.ipynb`). The dataset used for training and evaluation is stored in a Google Drive link, and a video explaining the article and the implementation is included. 4 | 5 | ## SegNet 6 | 7 | SegNet is a deep convolutional neural network architecture specifically designed for semantic pixel-wise image segmentation. It aims to be efficient in terms of memory and computational time while still providing high-quality segmentation results. 8 | 9 | ### Architecture 10 | 11 | SegNet consists of three main components: 12 | 1. **Encoder Network**: 13 | - The encoder network is composed of 13 convolutional layers, identical to the VGG16 network. 14 | - Each convolutional layer is followed by a batch normalization layer and a ReLU activation. 15 | - Max-pooling is performed after some convolutional layers to reduce the spatial dimensions of the feature maps. The pooling indices (locations of maximum values) are stored for use in the decoder network. 16 | 17 | 2. **Decoder Network**: 18 | - The decoder network consists of corresponding upsampling layers for each max-pooling layer in the encoder. 19 | - Each upsampling layer uses the stored pooling indices to perform non-linear upsampling, ensuring accurate reconstruction of the input image's spatial dimensions. 20 | - After upsampling, convolutional layers refine the feature maps to produce dense, high-resolution outputs. 21 | 22 | 3. **Pixel-wise Classification Layer**: 23 | - The final layer is a softmax classifier that assigns a class label to each pixel in the input image. 24 | - This produces a segmented output where each pixel is classified into one of the predefined categories. 25 | 26 | ### Key Features 27 | 28 | - **Efficient Memory Usage**: By reusing pooling indices from the encoder during the decoding process, SegNet reduces the memory overhead typically associated with large decoder networks. 29 | - **High-Quality Segmentation**: The architecture preserves spatial resolution and reduces the loss of boundary information, resulting in accurate segmentation outputs. 30 | - **Simplicity and Speed**: SegNet is designed to be both simple and fast, making it suitable for real-time applications. 31 | 32 | ### Applications 33 | 34 | SegNet is widely used in various applications, including: 35 | - Autonomous driving (road, vehicle, and pedestrian segmentation) 36 | - Medical imaging (organ and tissue segmentation) 37 | - Environmental monitoring (land cover classification) 38 | - Industrial inspection (defect detection) 39 | 40 | ### Further Reading 41 | 42 | For more detailed information, you can refer to the original paper: [SegNet: A Deep Convolutional Encoder-Decoder Architecture for Image Segmentation](https://arxiv.org/abs/1511.00561). 43 | 44 | ## Implementation 45 | 46 | The implementation of SegNet using TensorFlow 2 is provided in the Jupyter Notebook: `SegNet_Implementation.ipynb`. 47 | 48 | ### Dataset 49 | 50 | The dataset used for training and evaluation is stored in Google Drive. You need to upload the dataset folder to your Google Drive.you can find dataset from here: (https://drive.google.com/drive/folders/15xYx78EgD0TYFSDrsYpOBoWIg9jLc0xf?usp=sharing) 51 | 52 | ### Video Explanation 53 | 54 | A detailed video explaining the article and the implementation can be found here: 55 | Video Explanation Link: (https://drive.google.com/file/d/12Yyssij54xAImIDTCzVE-IYRhbN4B8Pl/view?usp=sharing) 56 | 57 | ## Running the Notebook 58 | 59 | To run the Jupyter Notebook, follow these steps: 60 | 1. upload dataset folder to your google drive. 61 | 2. clone the repository in google colab 62 | 3. select GPU device 63 | 4. run the code 64 | 65 | --------------------------------------------------------------------------------