Skip to content

vection/smartAnnotation

Repository files navigation

👋 Smart Annotation Tool 👋

Easy and smart annotation tool based on jupyter notebook

Fun tool to annotate your documents using jupter notebook, if you have low volume of data and you want easy, smart and free annotation tool you arrived to the right place. This tool based on jupyter-bbox-widget. The motivation is to create smart tool in jupter notebook environment that supports OCR annotation.

The extra feature designed for Key-value assignments or cases of correlations between key and value on coordinates axis. By enabling Key Finder checkbox the script will try to find best options for his key.

How it works 🖖

First we set BBoxWidget with correct parameters which is list of images (depending on your sitatuation) and all classes.

In annotation tool class there are few types of values - number,text; this can help to filter final value that will be registered in annotation file. By default all values declared as text.

After marking first VALUE class the tool tries to find the corresponding text value from ocr and record it in annotation file.

Extra feature available to detect also corresponding keys automatically using some logic and also support by vocabulary. When all bounds filled, hitting sumbit button will save the keys in vocabulary and for next image it will try to annotate automatically.

Vocabulary file and json annotation files will saved each sumbit event.

Note that rendering is quite unstable and may affect some unrelated results.

Installation

  • Make sure you have pytesseract ocr engine installed, you have to specify tesseract_cmd path in the code.
  • Install all requirements.txt libraries
  • Configure testwidget, files_path, annotation tool constructor (last cell)
  • Run container

Supported features

  • Key finder checkbox - enable/disable key finder for each marked value
  • Starter feature - enable/disable finding possible keys from vocabulary and annotate it automatically - triggered after first mark

Output format

Annotation file

[
    {
        "x": 20,
        "y": 18,
        "label": "r_number_key",
        "value": "Customer Invoices",
        "width": 186,
        "height": 14
    },
    {
        "x": 199,
        "y": 13,
        "width": 155,
        "height": 29,
        "label": "r_number",
        "value": "/ INV/2018/0004"
    },
    {
        "x": 728,
        "y": 397,
        "width": 84,
        "height": 9,
        "label": "salesperson",
        "value": "Administrator"
    },
    {
        "x": 554,
        "y": 393,
        "label": "salesperson_key",
        "value": "Administrator",
        "width": 95,
        "height": 28
    },
    {
        "x": 204,
        "y": 259,
        "width": 206,
        "height": 9,
        "label": "client_name",
        "value": "Demo"
    },
    {
        "x": 37,
        "y": 252,
        "label": "client_name_key",
        "value": "Customer",
        "width": 68,
        "height": 16
    }
]

How to take it from here 👆

  • can prepare layoutlmv3 dataset from annotation file and make it easy to train proper detection model which will feed himself afterwards.
  • use better OCR service to raise detection accuracy.

Short video example

example_v_1.mp4

Original Libraries:

jupyter-bbox-widget

boundbox

About

fast smart annotation tool with jupyter notebook

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published