encorechow / image-annotator

Image annotator for labeling the objects in images
Other
1 stars 0 forks source link

Multi-class Image Segments Annotator

This is a web application for custom multi-class annotation. The current applied algorithm in back-end is GrabCut. We may switch to other more efficient algorithms later, but for the sake of completion of the application, we will keep use GrabCut for the moment. There is also a manual mode for fine-tuning.

Instructions

Since this is still incomplete, I haven't put an dependencies file into repo, which is necessary for running the flask back-end. But if you want to try it, you have to install following python dependencies:

The project was primarily built up with Javascript, Python flask, jQuery. In terms of jQuery, I used jqtree to implement the tree view of naming system. For more information about jqtree, please go to jqtree. Some of the downloaded Javascript files were not useful in the project. You can just leave them there. Regarding saving files, I used FileSaver.js widget to allow client-side downloading. For more information go to FileSaver.

The structure of project was organized as follow:

To run the project, simply type python grabcut.py after download the repo. The prompt will show a local URL. Open up it in the browser to run the application.

Developer Documentation

Template

Developer is not necessary to change code in the generic.html since it is pre-defined template for user interface. In order to add components into the user interface, developer should find the id or class of the parent wrapper and add the components by using jQuery. There are a lot of functions for appending components. More details can be found on the official documentation of jQuery.

imageloader.js

This file contains the ImgLoader class loads the image file into canvas when user drops images. $ele handles all events happened in the drop box.

Member functions
typeChecks

Description: Checks the type of dropped file. Return true if file is an image file.

Usage: self.typeChecks(filename). Should use in the init function.

reader

Description: read the file as FileList object.

render

Description: render the first image file of FileList into canvas.

animations

Description: change the background of drop box with animations.

hideWrapper

Description: Hide the drop box.

exposeWrapper

Description: Shows up the drop box.

annotator.js

This file contains some major data structures:

Annotator

-

grabcut.py

data_manipulation.py