User Tools


This is an old revision of the document!


Image Tagging

Sloth


Setup

In order to tag images, we use a piece of software called Sloth. To install it from the robosub debian repository, run the following command:

sudo aptitude install sloth

Since we use Darknet, there are special configurations needed. After having cloned the vision_dev repository, add the following line to your .bashrc, replacing the dummy path with the path to the vision_dev/sloth directory so that sloth can create darknet files.

export PYTHONPATH=/path/to/vision_dev/sloth:$PYTHONPATH

Using Sloth

To use sloth and start tagging images, you can run the following command.

sloth -c /path/to/vision_dev/sloth/robosub_config.py /path/to/annotation/file

*-c* Is a flag to give the path to a configuration file. This file is provided in the vision_dev/sloth directory. The path you provide should point to this file.

The last argument is a path to an annotation file. This is most likely named something like `labels.json`. You will need to provide this path in order to tag images.

Should you find this tedious, there is a script in the sloth directory of the vision_dev repository which performs some of this for you. It can be used as follows:

./robosub_sloth.sh /path/to/annotation/file

This removes the need to add the -c flag repeatedly. This script can also be symlinked to without issues.


Using sloth output with Darknet

When attempting to use tagged images with darknet, the annotation file will need to be in the correct format. To convert to this format, use the following command

sloth convert <original file> <new_filename>.darknet

This will ask sloth to convert an annotation file in one format to the correct *.darknet format.

Once the file is in this format, you will need to run the `sloth_to_darknet.py` script which will generate the multiple files darknet requires based upon the compact information in the *.darknet file.

The following is an example command to generate said files.

./sloth_to_darknet.py -f /path/to/label/file -o /path/to/annotation/dir/ (optional)[-t training_list_filename.txt]

Sloth Keybindings

The full list of keybindings used in sloth can be found in the robosub_config.py file near the bottom. A shorthand list is provided below

Default keybindings

  • Space
  • Backspace
  • PgDown
  • PgUp
  • Tab
  • Shift+Tab
  • Ctrl+f
  • Del
  • Esc
  • Shift+l
  • Shift+c

Mark image as labeled/confirmed and go to next
Next image/frame
Previous image/frame
Previous image/frame
Select next annotation
Select previous annotation
Fit current image/frame into window
Delete selected annotations
Exit insert mode
Mark current image as labeled
Mark all annotations in image as confirmed

Robosub Specific

  • F5
  • Ctrl+Shift+Del
  • c
  • n

Annotations

  • r
  • y
  • g
  • s
  • p
  • m
  • ,
  • .
  • h
  • t
  • z
  • x

Toggle the visibility of label names on annotation boxes
Delete all annotations from the current image and mark it as unlabeled
Copy all annotations from the previous image to this one
Mark image as labeled/confirmed and go to next then copy all annotations from the previous image.
(Equivalent to Space then c)


Red Buoy
Yellow Buoy
Green Buoy
Start Gate Post
Path Marker
Marker Drop Platform
Object Pickup Platform
Object Drop-off Platform
Hexagon
Torpedo Target
Navigation Channel Post
Navigation Channel Bar


Sloth Mouse Controls

While creating annotations, the following are useful mouse controls.

  • Right Click and Drag

Resize an annotation. Resizing is based upon the quadrant of the annotation clicked on.

  • Ctrl+Left Click

Select multiple annotations at once.

Getting Data to Label

We use the download_data.sh and download_data_current.sh scripts from the vision_dev repository to get data from the server. Make sure that you always do a git pull before getting new data because the scripts change frequently.

First claim one or more batches to label from the current spreadsheet of data. The current spreadsheet is located here. Note which numbers you want.

Once you have claimed some batches run the following command in vision_dev to download and extract the data:

./download_data.sh bag_prefix_0 ## ## ##

For example if you want batch numbers 00 04 and 12 of the path_marker batch you would run:

./download_data.sh path_marker_0 00 04 12

Before downloading the data it will ask you for a username and password, please ask in either the it or general channels on slack

Uploading Data

Here is the upload link for .json files. Just drag and drop it.