Giter Club home page Giter Club logo

image-labeler-react's Introduction

Image Labeler ( Bounding Box Labeling Tool )

A react component to build image-labeling-tool.

  • Label image with bounding boxes and scene types
  • Scale by wheel and gesture
  • Resize and move bounding boxes easily

screenshot.png

labeler.gif

Usage

npm install image-labeler-react
import React from 'react';
import {Annotator} from 'image-labeler-react';

const App: React.FC = () => {
  return (
    <div className="App">
      <Annotator 
        height={600} 
        width={600} 
        imageUrl={""} 
        asyncUpload={async (labeledData)=>{
            // upload labeled data
        }} 
        types={['A', 'B', 'Cylinder']}
        defaultType={"Cylinder"} />
    </div>
  );
}

export default App;

Shortkeys

Shortcut Key Action
Enter / Space Upload
Tab Switch Mode (Annotate
Q Delete Bounding Box
+ Zoom In
- Zoom Out

Props

interface Props {
    imageUrl: string,
    height: number, // height of the labeling window
    width: number, // width of the labeling window
    types: Array<string>, // annotation types
    asyncUpload?: (data: any) => Promise<any>, // will be invoked when uploading. you can switch to next image in this callback
    disableAnnotation?: boolean, // default false
    defaultType?: string, // default type, can be empty
    defaultSceneType?: string, // default sceneType, can be empty
    defaultBoxes?: Array<BoundingBox>, // default bounding boxes, can be empty
    showButton?: boolean, // showing button or not, default true
    sceneTypes?: Array<string>, // if provided, the sceneType select box will show up
    className?: string,
    style?: any
}

asyncUpload

asyncUpload will be invoked when clicking Upload button or press Enter.

The structure of param labeledData is

{
  image: this.image.src,
  height: this.image.naturalHeight,
  width: this.image.naturalWidth,
  sceneType?: "undefined when props.sceneTypes is empty",
  boxes: [
    {
      x: 100,
      y: 100,
      w: 10,
      h: 10,
      annotation: 'Cylinder'
    }
  ]
}

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.