Giter VIP home page Giter VIP logo

instance_segmentation's Introduction

Instance Segmentation for Contract Documents

Semantic structure identification model for general contract documents using MASK_RCNN. Generates JSON file containing semantic structures of each component in a document.

Semantic labels are below:

  • Title
  • Subtitle
  • Paragraph
  • Footnotes
  • Header
  • Footer
  • Page
  • Signature

Installation


  git clone https://github.com/kasimebrahim/instance_segmentation
  cd instance_segmentation

Option 1

  # Open conda_environment.yml and change the last line to your own conda environment path.
  conda env create -f conda_environment.yml

Option 2

  pip install -r requirements.txt

Prerequisite


You will need python>3.7 and optionally conda>4.7.10

Getting Started


NoteBooks

To inspect and visualize your dataset use dataset_inspect.

To evaluate your model or visualize your output use model_eval.

To train your model

  # If you want to train from a pretrained model.
  python Segmentation.py train --datasets=datasets --log=log --model=models/mask_rcnn_pub_lay_seg_0100.h5
  # If you dont have.
  python Segmentation.py train --datasets=datasets --log=log
  # If you want to pickup from a stoped training.
  python Segmentation.py train --datasets=datasets --log=log --pickup=true

To segment your documents

  python Segmentation.py segment --model=models/mask_rcnn_doc_seg_0100.h5 --image=infer
  # --image is the directory where your documents to be segmented are stored.
  # Your documents should be stored in a directory in two ways.
  # One: Each documenat is in its own directory and every
  #      page of the document is in the directory.
  #      i:e ds/doc/p01.jpg
  # Two: All pages of all the documents are under one
  #      directory. And every image is named as document_page
  #      concatinated with page name/number.
  #      i:e ds/doc_p01.jpg

The out put of the segmented documents will be stored in a json file named "documents.json".

Acknowledgements

This repository heavily reuses code from the amazing tensorflow Mask RCNN implementation by @waleedka. Many thanks to all the contributors of that project. You are encouraged to checkout https://github.com/matterport/Mask_RCNN for documentation on many other aspects of this code.

Author

Kasim Ebrahim [email protected]

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.