This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
cs:vision:image_tagging:start [2017/10/31 10:10] Daylan Kelting [Sloth] |
cs:vision:image_tagging:start [2022/02/18 23:01] Chris Nathman [labelImg] |
||
---|---|---|---|
Line 2: | Line 2: | ||
====== Image Tagging ====== | ====== Image Tagging ====== | ||
- | ===== Sloth ===== | ||
- | ---- | + | ===== labelImg ===== |
- | === 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 | + | For complete details on using labelImg, see [[https://github.com/tzutalin/labelImg]]. |
- | + | ||
- | Since we use Darknet, there are special configurations needed. After having cloned the [[https://github.com/PalouseRobosub/vision_dev|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 [[https://github.com/PalouseRobosub/vision_dev/blob/master/sloth/robosub_config.py|robosub_config.py]] file near the bottom. A shorthand list is provided below | + | |
- | + | ||
- | **__Default keybindings__** | + | |
- | + | ||
- | <WRAP group> | + | |
- | <WRAP 20% column> | + | |
- | * **Space** | + | |
- | * **Backspace** | + | |
- | * **PgDown** | + | |
- | * **PgUp** | + | |
- | * **Tab** | + | |
- | * **Shift+Tab** | + | |
- | * **Ctrl+f** | + | |
- | * **Del** | + | |
- | * **Esc** | + | |
- | * **Shift+l** | + | |
- | * **Shift+c** | + | |
- | </WRAP> | + | |
- | <WRAP column> | + | |
- | 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 | + | |
- | </WRAP> | + | |
- | </WRAP> | + | |
- | + | ||
- | + | ||
- | **__Robosub Specific__** | + | |
- | + | ||
- | <WRAP> | + | |
- | <WRAP 20% column> | + | |
- | * **F5** | + | |
- | * **Ctrl+Shift+Del** | + | |
- | * **c** | + | |
- | * **n** | + | |
- | **__Annotations__** | + | |
- | * **r** | + | |
- | * **y** | + | |
- | * **g** | + | |
- | * **s** | + | |
- | * **p** | + | |
- | * **m** | + | |
- | * **,** | + | |
- | * **.** | + | |
- | * **h** | + | |
- | * **t** | + | |
- | * **z** | + | |
- | * **x** | + | |
- | </WRAP> | + | |
- | <WRAP column> | + | |
- | 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 | + | |
- | </WRAP> | + | |
- | </WRAP> | + | |
- | + | ||
- | ---- | + | |
- | === Sloth Mouse Controls === | + | |
- | + | ||
- | While creating annotations, the following are useful mouse controls. | + | |
- | + | ||
- | + | ||
- | * **Right Click and Drag** | + | |
- | + | ||
- | <WRAP indent> | + | |
- | <WRAP indent> | + | |
- | Resize an annotation. Resizing is based upon the quadrant of the annotation clicked on. | + | |
- | </WRAP> | + | |
- | </WRAP> | + | |
- | + | ||
- | * **Ctrl+Left Click** | + | |
- | + | ||
- | <WRAP indent> | + | |
- | <WRAP indent> | + | |
- | Select multiple annotations at once. | + | |
- | </WRAP> | + | |
- | </WRAP> | + | |
- | + | ||
- | === Getting Data to Label === | + | |
- | + | ||
- | We use the download_data.sh and download_data_current.sh scripts from the [[https://github.com/PalouseRobosub/vision_dev|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 [[https://docs.google.com/spreadsheets/d/1gZoNsu4mMQkK1nrG51-dcXYuddHLSNPcrzo4cxPayyE/edit?usp=sharing|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 [[https://palouserobosub.slack.com|slack]] | + | |
- | + | ||
- | === Uploading Data === | + | |
- | <WRAP indent> | + | |
- | Here is the [[http://robosub-vm.eecs.wsu.edu/labelupload/|upload link]] for .json files. Just drag and drop it. | + | |
- | </WRAP> | + | |
+ | We use labelImg to tag objects in images. labelImg can be installed with pip with the command ''pip3 install labelImg''. Once installed you can run ''labelImg'' from a terminal. |