Giter VIP home page Giter VIP logo

detect-document's Introduction

Detect-document

Instance segementation using MaskRCNN for localization of document (object) images.

Usage instructions.

  • clone this repo

  • To use pretrained coco weights, download h5 file from here

Install the required packaged
  • pip3 install -r requirements.txt

  • cd samples\My_docs

To train the model with pretrained coco weights.
  • python3 doc.py train --dataset=/path/to/doc/dataset --weights=coco
The model generates bounding boxes and segmentation masks for each instance of an object in the image
  • run 'Inspect_docs_model.ipynb' where masked outputs are tested.

We can get the masked output from this ipynb.

Click here to go to annotation tool link

1 Choose file directory

2 Annotate all the files with labels & polygons.

3 Export as Json and store it in train & val

Detecting border/corners using OpenCV

Others simple choices:

Canny Edge Detection

Converts to gray scale and reduces noise using bilateral filter , smoothening color preserving the edges though! Uses adaptiveThreshold to calculate optimal threshold for small regions & to control lights. Median filter for removing sall details.

Edge detection doesn’t count with sides of the image, therefore in case that page touching a side of the image, the algorithm won’t produce a continuous, closed edge.

To prevent that we have to add small border, border 5 pixels wide works just fine. Finally, we can use Canny Edge Detection where we have to specify values of so called hysteresis thresholding, which separates edges into three groups: definitely an edge, definitely not an edge and something between.

GrabCut

Getting foreground images with contour

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.