All Projects → DVLP-CMATERJU → RectiNet

DVLP-CMATERJU / RectiNet

Licence: GPL-3.0 License
A Gated and Bifurcated Stacked U-Net Module for Document Image Dewarping

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to RectiNet

awesome-nn-optimization
Awesome list for Neural Network Optimization methods.
Stars: ✭ 39 (-37.1%)
Mutual labels:  bifurcation
BifurcationKit.jl
A Julia package to perform Bifurcation Analysis
Stars: ✭ 185 (+198.39%)
Mutual labels:  bifurcation
transitime
TheTransitClock real-time transit information system
Stars: ✭ 60 (-3.23%)
Mutual labels:  predictions
image-optimisation-tools-comparison
A Benchmarking Suite for popular Image Optimisation Tools
Stars: ✭ 28 (-54.84%)
Mutual labels:  ssim
Corona-Tracker-Bot
Discord bot for coronavirus (COVID-19) , With Ai [Machine learning algorithms] integrated into it
Stars: ✭ 26 (-58.06%)
Mutual labels:  predictions
mindsdb-examples
Examples for usage of Mindsdb https://www.mindsdb.com/
Stars: ✭ 25 (-59.68%)
Mutual labels:  predictions
SuperResolution-with-Perceptual-loss
In this project I have used an convolution neural network with perceptual loss to convert low res image into high res image.
Stars: ✭ 17 (-72.58%)
Mutual labels:  ssim
ewstools
Python package for early warning signals (EWS) of bifurcations in time series data.
Stars: ✭ 29 (-53.23%)
Mutual labels:  bifurcation
timemachines
Predict time-series with one line of code.
Stars: ✭ 342 (+451.61%)
Mutual labels:  predictions
video-quality-metrics
Test specified presets/CRF values for the x264 or x265 encoder. Compares VMAF/SSIM/PSNR numerically & via graphs.
Stars: ✭ 87 (+40.32%)
Mutual labels:  ssim
Amplify Cli
The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development.
Stars: ✭ 2,399 (+3769.35%)
Mutual labels:  predictions
MVTec-Anomaly-Detection
This project proposes an end-to-end framework for semi-supervised Anomaly Detection and Segmentation in images based on Deep Learning.
Stars: ✭ 161 (+159.68%)
Mutual labels:  ssim

RectiNet

PWC

A Gated and Bifurcated Stacked U-Net Module for Document Image Dewarping

Capturing images of documents is one of the easiest and most used methods of recording them. These images however, being captured with the help of handheld devices, often lead to undesirable distortions that are hard to remove. We propose a supervised Gated and Bifurcated Stacked U-Net module to predict a dewarping grid and create a distortion free image from the input. While the network is trained on synthetically warped document images, results are calculated on the basis of real world images. The novelty in our methods exists not only in a bifurcation of the U-Net to help eliminate the intermingling of the grid coordinates, but also in the use of a gated network which adds boundary and other minute line level details to the model. The end-to-end pipeline proposed by us achieves state-of-the-art performance on the DocUNet dataset after being trained on just 8 percent of the data used in previous methods.


Screenshot

Demo

Open In Colab

Requirements

Required packages:

  • torch (>1.4.0)
  • torchvision (>0.6.0)
  • numpy (>1.18.4)

To install all required packages, use pip install -r requirements.txt

Training the model

Required Directory Structure:


.
+-- data_gen
|   +-- .
|   +-- image
|   +-- label
|   +-- image_test
+-- model_save
|   +-- .
+-- loader
|   +-- .
|   +-- __init__.py
|   +-- dataset.py
+-- predict
|   +-- .
|   +-- model_pred.py
|   +-- predict.py
+-- unets
|   +-- .
|   +-- __init__.py
|   +-- Punet.py
|   +-- Sunet.py
+-- utils
|   +-- .
|   +-- __init.py
|   +-- GCN.py
|   +-- plot_me.py
|   +-- utils_model.py
+-- model.py
+-- train.py

  • Run: python3 train.py --batch-size 16
  • For custom location of training data run: python3 train.py --batch-size 16 --data-path PATH_TO_DATA
  • For more parameters run: python3 train.py -help

Dense Grid Prediction and Image Unwarp

  • In same directory: mkdir save
  • Navigate to predict directory cd predict/
    • For predicting single image: python3 predict.py --save-path ../save --img-path IMAGE_PATH --model-path ../model_save/SAVED_MODEL_PATH --multi=False
    • For predicting many image in a folder: python3 predict.py --save-path ../save --img-path IMAGE_FOLDER_PATH --model-path ../model_save/SAVED_MODEL_PATH --multi=True
  • For more parameters: python3 predict.py -help

Generating data

For generating your own dataset, follow this repository. Do note, they use pkl to save the ground truth dense grid while I make use of npz. To get save arrays as npz, just change the way the grid is saved in the generation code.

Note:

  • Please note that we used Matlab 2018b for implementing SSIM (Structural Similarity Index) and MS-SSIM ( Multi-Scale Structural Similarity Index) values. Matlab 2020a, however, uses a different SSIM implementation. Do take that into consideration while comparing your results with the values in our paper.
  • Please use the 'Discussion' option to ask questions about the code instead of raising an issue -- unless it has something to do with an error in the code.

Loading pre-trained Model

  • Download model weights here
  • Save under model_save folder
  • Run: python3 predict.py --save-path save --img-path IMAGE_PATH --model-path model_save/weights.pt --multi=False

Citation

If you use this code please consider citing :

@misc{b2020gated,
    title={A Gated and Bifurcated Stacked U-Net Module for Document Image Dewarping},
    author={Hmrishav Bandyopadhyay and Tanmoy Dasgupta and Nibaran Das and Mita Nasipuri},
    year={2020},
    eprint={2007.09824},
    archivePrefix={arXiv},
    primaryClass={cs.CV}
}

Todo

  • Upload pre-trained weights for predictions
  • Upload Images for Evaluation
  • Increase code readability
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].