Complete U-net Implementation with keras

Overview

U Net Lowered with Keras

Complete U-net Implementation with keras






Original Paper Link : https://arxiv.org/abs/1505.04597

Special Implementations :


The model is implemented using the original paper. But I have changed the number of filters of the layers. The implemented number of layers are reduced to 25% of the original paper.

Original Model Architecture :

Dataset :


The dataset has been taken from kaggle . It had a specific directory tree, but it was tough to execute dataset building from it, so I prepared an usable dat directory.

Link : https://www.kaggle.com/azkihimmawan/chest-xray-masks-and-defect-detection

Primary Directory Tree :

.
└── root/
    ├── train_images/
    │   └── id/
    │       ├── images/
    │       │   └── id.png
    │       └── masks/
    │           └── id.png
    └── test_images/
        └── id/
            └── id.png

Given Images :

Image Mask

Supporting Libraries :

Numpy opencv Matplotlib

Library Versions :

All versions are up to date as per 14th June 2021.

Dataset Directory Generation :


We have performed operations to ceate the data directory like this :

              .
              └── root/
                  ├── train/
                  │   ├── images/
                  │   │   └── id.png
                  │   └── masks/
                  │       └── id.png
                  └── test/
                      └── id.png

Model Architecture ( U-Net Lowered ):

Model: “UNet-Lowered”

Layer Type Output Shape Param Connected to
input_1 (InputLayer) [(None, 512, 512, 1) 0
conv2d (Conv2D) (None, 512, 512, 16) 160 input_1[0][0]
conv2d_1 (Conv2D) (None, 512, 512, 16) 2320 conv2d[0][0]
max_pooling2d (MaxPooling2D) (None, 256, 256, 16) 0 conv2d_1[0][0]
conv2d_2 (Conv2D) (None, 256, 256, 32) 4640 max_pooling2d[0][0]
conv2d_3 (Conv2D) (None, 256, 256, 32) 9248 conv2d_2[0][0]
max_pooling2d_1 (MaxPooling2D) (None, 128, 128, 32) 0 conv2d_3[0][0]
conv2d_4 (Conv2D) (None, 128, 128, 64) 18496 max_pooling2d_1[0][0]
conv2d_5 (Conv2D) (None, 128, 128, 64) 36928 conv2d_4[0][0]
max_pooling2d_2 (MaxPooling2D) (None, 64, 64, 64) 0 conv2d_5[0][0]
conv2d_6 (Conv2D) (None, 64, 64, 128) 73856 max_pooling2d_2[0][0]
conv2d_7 (Conv2D) (None, 64, 64, 128) 147584 conv2d_6[0][0]
dropout (Dropout) (None, 64, 64, 128) 0 conv2d_7[0][0]
max_pooling2d_3 (MaxPooling2D) (None, 32, 32, 128) 0 dropout[0][0]
conv2d_8 (Conv2D) (None, 32, 32, 256) 295168 max_pooling2d_3[0][0]
conv2d_9 (Conv2D) (None, 32, 32, 256) 590080 conv2d_8[0][0]
dropout_1 (Dropout) (None, 32, 32, 256) 0 conv2d_9[0][0]
up_sampling2d (UpSampling2D) (None, 64, 64, 256) 0 dropout_1[0][0]
conv2d_10 (Conv2D) (None, 64, 64, 128) 131200 up_sampling2d[0][0]
concatenate (Concatenate) (None, 64, 64, 256) 0 dropout[0][0] & conv2d_10[0][0]
conv2d_11 (Conv2D) (None, 64, 64, 128) 295040 concatenate[0][0]
conv2d_12 (Conv2D) (None, 64, 64, 128) 147584
up_sampling2d_1 (UpSampling2D) (None, 128, 128, 128) 0 conv2d_12[0][0]
conv2d_13 (Conv2D) (None, 128, 128, 64) 32832 up_sampling2d_1[0][0]
concatenate_1 (Concatenate) (None, 128, 128, 128) 0 conv2d_5[0][0] & conv2d_13[0][0]
conv2d_14 (Conv2D) (None, 128, 128, 64) 73792 concatenate_1[0][0]
conv2d_15 (Conv2D) (None, 128, 128, 64) 36928 conv2d_14[0][0]
up_sampling2d_2 (UpSampling2D) (None, 256, 256, 64) 0 conv2d_15[0][0]
conv2d_16 (Conv2D) (None, 256, 256, 32) 8224 up_sampling2d_2[0][0]
concatenate_2 (Concatenate) (None, 256, 256, 64) 0 conv2d_3[0][0] & conv2d_16[0][0]
conv2d_17 (Conv2D) (None, 256, 256, 32) 18464 concatenate_2[0][0]
conv2d_18 (Conv2D) (None, 256, 256, 32) 9248 conv2d_17[0][0]
up_sampling2d_3 (UpSampling2D) (None, 512, 512, 32) 0 conv2d_18[0][0]
conv2d_19 (Conv2D) (None, 512, 512, 16) 2064 up_sampling2d_3[0][0]
concatenate_3 (Concatenate) (None, 512, 512, 32) 0 conv2d_1[0][0] & conv2d_19[0][0]
conv2d_20 (Conv2D) (None, 512, 512, 16) 4624 concatenate_3[0][0]
conv2d_21 (Conv2D) (None, 512, 512, 16) 2320 conv2d_20[0][0]
conv2d_22 (Conv2D) (None, 512, 512, 2) 290 conv2d_21[0][0]
conv2d_23 (Conv2D) (None, 512, 512, 1) 3 conv2d_22[0][0]

Data Preparation :

Taken single channels of both image and mask for training.

Hyperparameters :

      Image Shape : (512 , 512 , 1)
      Optimizer : Adam ( Learning Rate : 1e-4 )
      Loss : Binary Cross Entropy 
      Metrics : Accuracy
      Epochs on Training : 100
      Train Validation Ratio : ( 85%-15% )
      Batch Size : 10

Model Evaluation Metrics :

Model Performance on Train Data :

Model Performance on Validation Data :

One task left : Will update the tutorial notebooks soon ;)

Conclusion :

The full model on the simpliefied 1 channel images was giving bad overfitted accuracy. But this structure shows better and efficient tuning over the data.

STAR the repository if this was helpful :) Also follow me on kaggle and Linkedin.

THANK YOU for visiting :)

Owner
Sagnik Roy
Kaggle Expert exploring Computer Vision as no one did!
Sagnik Roy
Auto grind btdb2 exp for tower

Bloons TD Battles 2 EXP Grinder Auto grind btdb2 exp for towers Setup I suggest checking out every screenshot to see what they are supposed to be, so

Vincent 6 Jul 29, 2022
Data, model training, and evaluation code for "PubTables-1M: Towards a universal dataset and metrics for training and evaluating table extraction models".

PubTables-1M This repository contains training and evaluation code for the paper "PubTables-1M: Towards a universal dataset and metrics for training a

Microsoft 365 Jan 04, 2023
Streamlit component for TensorBoard, TensorFlow's visualization toolkit

streamlit-tensorboard This is a work-in-progress, providing a function to embed TensorBoard, TensorFlow's visualization toolkit, in Streamlit apps. In

Snehan Kekre 27 Nov 13, 2022
Individual Treatment Effect Estimation

CAPE Individual Treatment Effect Estimation Run CAPE python train_causal.py --loop 10 -m cape_cau -d NI --i_t 1 Run a baseline model python train_cau

S. Deng 4 Sep 02, 2022
NeurIPS'21 Tractable Density Estimation on Learned Manifolds with Conformal Embedding Flows

NeurIPS'21 Tractable Density Estimation on Learned Manifolds with Conformal Embedding Flows This repo contains the code for the paper Tractable Densit

Layer6 Labs 4 Dec 12, 2022
Code for the published paper : Learning to recognize rare traffic sign

Improving traffic sign recognition by active search This repo contains code for the paper : "Learning to recognise rare traffic signs" How to use this

samsja 4 Jan 05, 2023
General purpose GPU compute framework for cross vendor graphics cards (AMD, Qualcomm, NVIDIA & friends)

General purpose GPU compute framework for cross vendor graphics cards (AMD, Qualcomm, NVIDIA & friends). Blazing fast, mobile-enabled, asynchronous and optimized for advanced GPU data processing usec

The Kompute Project 1k Jan 06, 2023
This repository is the official implementation of Using Time-Series Privileged Information for Provably Efficient Learning of Prediction Models

Using Time-Series Privileged Information for Provably Efficient Learning of Prediction Models Link to paper Abstract We study prediction of future out

Rickard Karlsson 2 Aug 19, 2022
This is the official implementation of "One Question Answering Model for Many Languages with Cross-lingual Dense Passage Retrieval".

CORA This is the official implementation of the following paper: Akari Asai, Xinyan Yu, Jungo Kasai and Hannaneh Hajishirzi. One Question Answering Mo

Akari Asai 59 Dec 28, 2022
Residual Dense Net De-Interlace Filter (RDNDIF)

Residual Dense Net De-Interlace Filter (RDNDIF) Work in progress deep de-interlacer filter. It is based on the architecture proposed by Bernasconi et

Louis 7 Feb 15, 2022
Open-source implementation of Google Vizier for hyper parameters tuning

Advisor Introduction Advisor is the hyper parameters tuning system for black box optimization. It is the open-source implementation of Google Vizier w

tobe 1.5k Jan 04, 2023
PRTR: Pose Recognition with Cascade Transformers

PRTR: Pose Recognition with Cascade Transformers Introduction This repository is the official implementation for Pose Recognition with Cascade Transfo

mlpc-ucsd 133 Dec 30, 2022
Jittor 64*64 implementation of StyleGAN

StyleGanJittor (Tsinghua university computer graphics course) Overview Jittor 64

Song Shengyu 3 Jan 20, 2022
A PyTorch Extension: Tools for easy mixed precision and distributed training in Pytorch

Introduction This is a Python package available on PyPI for NVIDIA-maintained utilities to streamline mixed precision and distributed training in Pyto

Artit 'Art' Wangperawong 5 Sep 29, 2021
Jittor implementation of PCT:Point Cloud Transformer

PCT: Point Cloud Transformer This is a Jittor implementation of PCT: Point Cloud Transformer.

MenghaoGuo 547 Jan 03, 2023
Parameter Efficient Deep Probabilistic Forecasting

PEDPF Parameter Efficient Deep Probabilistic Forecasting (PEDPF) is a repository containing code to run experiments for several deep learning based pr

Olivier Sprangers 10 Jun 13, 2022
Accurate identification of bacteriophages from metagenomic data using Transformer

PhaMer is a python library for identifying bacteriophages from metagenomic data. PhaMer is based on a Transorfer model and rely on protein-based vocab

Kenneth Shang 9 Nov 30, 2022
Official implementation of "A Unified Objective for Novel Class Discovery", ICCV2021 (Oral)

A Unified Objective for Novel Class Discovery This is the official repository for the paper: A Unified Objective for Novel Class Discovery Enrico Fini

Enrico Fini 118 Dec 26, 2022
Robot Hacking Manual (RHM). From robotics to cybersecurity. Papers, notes and writeups from a journey into robot cybersecurity.

RHM: Robot Hacking Manual Download in PDF RHM v0.4 ┃ Read online The Robot Hacking Manual (RHM) is an introductory series about cybersecurity for robo

Víctor Mayoral Vilches 233 Dec 30, 2022
A tool for calculating distortion parameters in coordination complexes.

OctaDist Octahedral distortion calculator: A tool for calculating distortion parameters in coordination complexes. https://octadist.github.io/ Registe

OctaDist 12 Oct 04, 2022