Skip to content

epam/deps-fe-labeling-tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 

Repository files navigation

labeling-tool

labeling-tool is powerful package built with React. It is designed for data labeling to assist with document markup tasks and training ML models.

Data labeling involves adding relevant keywords to unstructured data, such as text or images, enabling machines to automatically recognize and categorize the information. As the crucial first step in the ML lifecycle, data labeling forms the foundation for accurate predictive models.

The labeling-tool package simplifies editing table layouts and labeling documents, ultimately improving data extraction processes and preserving document structure.

img.png

Features and Benefits

Features

  • Import/Export Markup: labeling-tool allows users to seamlessly import and export markup data.
  • Feature-rich interface: A comprehensive panel with document controls such as zoom, undo, and pointer tool for selecting and moving markup.
  • Markup Creation: Easily create data markups within the document.
  • Merge/Split Table Cells: Allows managing table cells manually as needed during the labeling process.
  • Data Extraction: labeling-tool interface allows to extract data from the labeling tool (when the appropriate API handler is passed) improving efficiency and saving time.
  • Editable Extracted Content: Users have the ability to create, modify, and delete extracted content for each label, providing greater flexibility over the labeling process.
  • Delete Markup: Allows users to delete unnecessary or incorrect markup to maintain organized and accurate data labeling.
  • Labels Assignment: Assign selected labels to existing fields, simplifying data organization and extraction.
  • Markup Object Panel: Easily view and manage markup objects in a dedicated panel, with JSON preview available.
  • Hotkeys: Enhance productivity by using hotkeys to quickly access different tools.
  • Table Detection: Allows automatic table detection feature within the document (when the appropriate API handler is passed).
  • AutoSave: Ensure the security of your work with an autosave functionality that periodically saves markup data automatically.

Benefits

  • Streamlines data labeling, leading to better ML model training and development.
  • Preserves document content structure, ensuring the accuracy of extracted data.
  • Simplify data labeling and extraction process.
  • Enhances workflow efficiency, saving time and effort during the ML lifecycle.

API

The root LabelingTool component accepts the following prop to configure and customize its behavior:

config (required) The config object contains all necessary settings and configurations.

config object

Key Type Required Description
api Object Yes Contains functions related to API interactions
addFieldForm () => ReactNode No Renders a custom form to create a new document fields
document Object Yes Describes the document being labeled
events Object No Contains possible handlers for events
fields Array of objects Yes Defines the available document fields
markup Object No Defines existed markup objects
ocr Object No Contains configuration related to Optical Character Recognition (OCR)
settings Object No Settings related to the appearance and capabilities of the labeling-tool

document object

Key Type Required Description
extraName string No Document extra name (displayed on UI)
engine string Yes The primary OCR engine for handling data extraction
language string No The document language
name string Yes Document name (displayed on UI)
pages string[] Yes List of images, for ex. ['https://domain/doc-page.png']

field object

Key Type Required Description
code string Yes Field code
fieldType string Yes Field type, see possible values
fieldMeta Object No Additional Field data depending on Field type.
See enumFieldMetaShape, listFieldMetaShape, pairFieldMetaShape here
index number Yes - only for fieldType list Field index
name string Yes Field name
required boolean Yes Define whenever field is required

ocr object

Key Type Required Description
engines { code: string, name: string }[] No The list of the available OCR engines
languages { code: string, name: string }[] No The list of the available languages

api object

Key Type Required Description
close Function Yes The function handles the Labeling Tool closing
detectTables Function No The function handles automatic table detection.
Required only in case the tool for Table detection is available.
Format: function(imageUrl, detectCoords){}
getImage Function No The function for getting the data of the document image.
Format: (imageUrl) => URL.createObjectURL(imageBlob)
notify Object No Contains functions for showing notifications: error, info, success, warning.
Ex. { success: (text) => console.log(text) }
ocrTable Function No The function handles extracting table data.
Required only in case Table tool is available and ocr prop is passed as well).
Format: function(engine, imageUrl, markupTable, language){}
ocrText Function No The function handles extracting labels data.
Required only in case Label tool is available and ocr prop is passed as well).
Format: function(engine, imageUrl, labelCoords, language){}
save Function No The function handles data extraction and markup saving.
Format: function(markup, rotationAngles, language){}
saveMarkup Function Yes The function handles markup saving.
Format: function(markup, rotationAngles, language, fields){}

markup object

Key Type Required Description
labels { label }[] No The list of the existed markup labels.
Required only in case Label tool is available
tables { table }[] No The list of the existed markup tables.
Required only in case Table tool is available

settings object

Key Type Required Description
features string[] No List of the available features. Possible values.
mode 'default' or 'markup' No Represents the current mode.
Markup mode enables the possibility to extract and see labels' content
panels string[] No List of the panels displayed on UI.
Toolbar panel displayed in the header and contains available tools.
Markup sidebar locates in the right sidebar, contains markup objects properties and possible actions.
Left sidebar displays markup objects list
tools string[] No List of the available tools. Possible values

events object

Key Type Required Description
onClose Function No The callback function, executed on Labeling Tool close

Check the working example of the config here. This config could be used for playing with LabelingTool package.

Requirements

Min NodeJS version is 14.16.0

Installation and Usage

To get started, follow these steps:

  1. Install the package:
# If you use npm:
npm install labeling-tool

# Or if you use Yarn:
yarn add labeling-tool
  1. Then import the LabelingTool package and use as in the example:
import { LabelingTool } from 'labeling-tool'

function App() {
  return (
    <div className="App">
      <LabelingTool config={yourConfigHere} />
    </div>
  )
}

export default App
  1. Update yourConfigHere with your desired configurations.

Demo

There is a demo hosted on Demo Labeling Tool which allows to check labeling-tool package.

License

labeling-tool is licensed under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published