Alp’s Labeling Tool (ALT)

(Updated April 4, 2017)

Macro plugin to label images for Detectnet / KITTI dataset

This macro code allows easy labeling of images, and creates text files compatible with DetectnetKITTI dataset format.

It runs under Fiji (ImageJ) and requires “ActionBar” plugin installed.

Whole setup requires the following 3 software, but no real setup process necessary, no need to type any command in Windows or Ubuntu. Please download these three pieces first;

  • Fiji (no setup required, just drag the folder from archive to anywhere you like)
  • action_bar-2.0.5-SNAPSHOT.jar plugin (choosing ‘install plugin’ from Fiji menu and selecting the .jar file is enough to install)

The macro code is installed by drag and drop of the folder in the archive file below into the main Fiji directory. And the third part is the ALT plugin (choose appropriate one for your operating system);

It allows you to draw rectangles around objects, name these rectangles, rotate the image with the rectangles altogether, save all this info and reload later along with selected image to continue labeling from where you left. Label “.txt” files are created in same folder with the image and contains labels and their bounding box coordinates, so upon completion of labeling work, you can move relevant “.txt” label-files to actual dataset, to “labels” folders under “train” & “val”.

clowns

I consider myself as hobbyist-grade programmer so please dont expect perfectly written code, failsafes, etc etc, although slowly enhancing, if you would like to try it, please use it on a backup set of images then manually copy the outputs.

ALT is open to public and feel free to modify it for your needs. I appreciate if you keep my name, in case you decide to publish an updated version of it.

ALT for Windows was written and tested under Windows 10 (64bit) environment. Fiji (ImageJ) version is 1.51h (64bit), java version 1.8.0_66 (64bit), ActionBar plugin version is 2.02.

ALT for Ubuntu was tested under Ubuntu 14.04. Only difference in usage is, instead of “Alt” key, you need to keep “Ctrl+Alt” key pressed before choosing “Add[t]” button, to view “Rename as:” window (with Feb. 10th version, this button is not necessary anymore since a customized “add” button was integrated to Ubuntu version, too).

Please use rotate button with patience, wait until all extra windows (including “results”) will be closed, before pressing again. The rotate routine works a bit slower.

Of course I did not test all of them, but theoretically you should be able to annotate the image formats found within the following list, you are only limited with image import capabilities of Fiji.


TIFF (.tiff, .tif), JPEG (.jpeg, .jpg), BMP (.bmp), FITS (.fits), PGM (.pgm) PPM (.ppm) PBM (.pbm), GIF (.gif), Animated GIF (.gif), PNG (.png), DICOM (.dic, .dcm, .dicom), PICT (.pict, .pic, .pct), PSD (.psd), TGA (.tga), ICO (.ico), CUR (.cur), Sunraster (.sun), XBM (.xbm), XPM (.xpm), PCX (.pcx), ANALYZE, NIfTi, AHF (.ahf), SPE (.spe), PIC (.pic), Leica TIFF (.tiff, .lei), Quicktime (.pic, .mov), AVI (.avi), PDS (.pds), LSM (.lsm), RAW, ISAC, FluoView TIFF (.tiff), Fluoview FV1000 OIB (.oib), Fluoview FV1000 OIF (.oif, .tif, -ro.pty, .lut, .bmp), IPLAB (.ipl), Bruker NMR (.fid, .ser, .2dseq, .2rr, .2ii, .3rrr, .3iii), FDF (.fdf), VFF (.vff), SIF (.sif), AxioVision ZVI (.zvi), DM3 (.dm3), Deltavision (.dv, .r3d), MI, NII, NIII, IMG (.img), UNC, PerkinElmer (.tif, .tim, .zpo, .csv, .htm, .ano, .rec, .cfg, .2, .3, .4, .5, .6, .7, .8, …), EPS (.eps, .epsi), SEQ (.seq), IPW (.ipw), OpenLab LIFF (.liff), OpenLab RAW (.raw), Metamorph (.stk), ICS (.ics, .ids), Leica Lif (.lif), Imaris (.ims), OME-XML (.ome), OME-TIFF (.tiff), ABD-TIFF (.tiff), GEL (.gel), Nikon (.nef, .tiff), Slidebook (.sld), SPCImage (.sdt), AL3D (.al3d), ND2 (.nd2), μManager (.tif, .txt), MRC (.mrc), JPEG2000 (.jp2), MNG (.mng), Flex (.flex), NRRD (.nrrd, .nhdr), VIFF bitmap image (.xv), ROI (.roi), ERS (.ers), RS (.rs), HPGL


ALT macro plugin is provided “as is” and I take no responsibility from any kind of damage it may directly or indirectly cause.
Please see the following video for details of installation and operation process.

Youtube / Vimeo

Another video showing some details from usage;

Youtube

I hope someone finds this macro useful,

Alper



WINDOWS downloads

  • ALT_Windows_(22mar2017)
    • “Next Image” button added. Sorry, no prev. button for the moment.
      • Attention! It does not save your modifications and directly skips to next image without saving anything. No “save” warning in this version, please be careful.
      • In this version, “next” button works for .jpg and .png files only. Means it will skip the images in other formats in the folder.
  • ALT_Windows_(22feb2017)
    • More functionality added. You can navigate back and forth between labels at 300% zoom level, for detailed arrangement of labels. Another button reverts zoom level to original scale.
  • ALT_Windows_(15feb2017)
    • Two new buttons. One button lets you rotate the image 90° clockwise. The other button lets you save the rotated images.
      And yes, labels rotate, too ! In case if you are unhappy with model’s data augmentation features.
  • ALT_Windows_(07feb2017)
    • A sticky side-bar added to opened image. First button allows you to read label of current selection. Second button asks for a name to the newly created selection and then adds it to the list (replaces Alt+Add[t] combo), or if selection already have a name, allows renaming the label of it. Third button closes the side bar (requires close/re-lauch of ALT plugin).
  • ALT_Windows_(01feb2017)
    • Now it can read label box datas from .txt files in the same directory. You can edit formerly created labels, .zip file is not necessary to start with, anymore.
  • ALT_Windows_(29jan2017)
    • Allows to create label data from stractch only, but you can continue pre-ALT edited labels, as long as you keep .zip file in same folder.

UBUNTU downloads

  • ALT_Ubuntu_(22mar2017)
    • “Next Image” button added. Sorry, no prev. button for the moment.
    • Attention! It does not save your modifications and directly skips to next image without saving anything. No “save” warning in this version, please be careful.
    • In this version, “next” button works for .jpg and .png files only. Means it will skip the images in other formats in the folder.
  • ALT_Ubuntu (10feb2017)
    • A sticky side-bar added to opened image. First button allows you to read label of current selection. Second button asks for a name to the newly created selection and then adds it to the list (replaces Alt+Add[t] combo), or if selection already have a name, allows renaming the label of it. Third button closes the side bar (requires close/re-lauch of ALT plugin).
  • ALT_Ubuntu (01feb2017)
    • Now it can read label box datas from .txt files in the same directory. You can edit formerly created labels, .zip file is not necessary to start with, anymore.
  • ALT_Ubuntu_(28jan2017)
    • Allows to create label data from stractch only, but you can continue pre-ALT edited labels, as long as you keep .zip file in same folder.

Comments / Discussions

Facebook

29 thoughts on “Alp’s Labeling Tool (ALT)

  1. Nice plugin! I have a question that I’m affraid I already know the answer. But consider I have a 60k+ images dataset. If I want to train it on DetectNet with DIGITS, shall I label EACH one of these 60 thousand images? Thank you so much.

    Like

    1. Hello. Thanks for nice words, I hope you find it easy to use, which is my major goal.
      For 60k images, depending on the object you are willing to train for, it will efficiently recognise much earlier than that. In general, if object has easy to distinguish visual properties (sharp unique edges etc) it starts to recognize after a few hundred images and you can achieve pretty good results with a few thousand. Also, if you want to further increase accuracy, you may want to check my “life is short to label manually” script.

      Like

      1. Thank you for your answer. My dataset is for indoor environments, so I get some objects that may confuse the classifier like refrigerator and stove, bed and sofa, backpack and handbag, etc. I have 20 classes and each class has 2k to 4k images to train, so you may understand my concern about have to manually label each image to train a DetectNet! I’m currently achieving 81 to 85% accuracy on my classification training. So let me try to understand your script. It uses the trained model of digits to label the images? Is it some kind of multiple sliding windows?
        Once again, thank you!

        Like

      2. Yes you have to consider image selection based on objects that needs to be trained. My script is nothing complicated. After achieving some good results with your current training dataset (around 90% accuracy with your test images), you can feed remaining images (the images that are not currently in train or label folders, but waiting to be hand-labeled) to DIGITS with this script. It tests (applies inference to) all images in the given folder and during inference, captures bounding box coordinates then writes them out to a folder, in detectnet format. Then you can collect this newly created labels, first examine them and correct/discard wrong detections, then add correctly labeled ones to training and/or validation set, and train the model once again, with addition of this new auto-labeled images. In short, its creating label text files during tests. You add these files to your dataset to train the model once again.

        Like

  2. Your comment is awaiting moderation.
    Hi I get an error like the one below. Where am I making the mistake.

    Invalid argument in line 54.
    textlist=Array. slice(textlist,c,textlist);

    Like

  3. Merhaba Alper Bey, detectnet’te kendi verisetimi eğitmekle ilgili bazı sorunlarım var, yardımcı olabilmeniz mümkün mü acaba?

    Like

      1. Geri dönüşünüz için teşekkür ederim Alper bey. Esasında Nvidia Digits’in github’ındaki kendimle alakalı pek çok soruyu inceledim. İngilizcem biraz zayıf, detection konusunda düşündüğümü yapamayacağım kanaati oluştu, ilgili soruları da tam manasıyla anlayabilmiş değilim ama anladığım kadarıyla bu şekilde. Rica etsem mail’iniz paylaşırsanız, size sorumu sorabilir miyim. (Bunu istememin nedeni dil kaynaklı)

        Liked by 1 person

  4. Hello, i want to use NVIDIA DIGITS with DetectNet to detect trees. Labeled using your tool and it was great, thank you but hope you can help me im geting ZERO acuracy and i think it might be something with the size of the pictures. Have you used DIGITS to detect objects? Hope you can help me Than you.

    Like

    1. Rise of accuracy depends on several factors. Image size, object size, Visual diversity of objects in same class, number of objects in database, model configuration are all points of concern.
      Please keep in mind that your object height and width should be around 50-400 pixels range and (as usually happened in many zero accuracy cases) it critical to supply enough number of images. Its better to start with 1000 images (like 800 in train and 200 in validation). For custom dataset, do not change original res. (1248×384) and class names, prepare your very first dataset with these characteristics. If it becomes successful, then start modifications on resolution and class names, etc.

      Like

  5. The “next” button on my Alp Labeling Tool is not working. it shows this “Macro Error. No return value in line 17. orderofFile = indexOfArray (imglist, myFilename ;

    What is wrong and how do i fix it?

    Like

    1. Hi, sorry for late reply, I was out (In fact I am still..:) ). The next button is limited to certain file types (check the main page of ALT). Are you sure you have at least two files of given filetype, in the current folder?

      Like

  6. when labelling for kitti dataset, am I limited to only using squares/rectangle? or can I use polygon tool to specify ground of truth ?

    Like

    1. Its all about how training software likes to read it. If its capable to read polygonal selections, then yes you can use. But currently Digits is formulated to read only the rectangular shapes.

      Like

  7. Hello Alper,

    First of all thank you for the great work. It is the best and easiest to use software for labeling of bounding boxes I have encountered so far. It works well on my machine with Ubuntu.
    However I was surprised to see, that my colleague, running a Windows 7 32-bit on the computer, faces the following problems:
    1) The menu placed on the right side of the processed image (with entries Name of selection, Add new selection and so on) disappears once in a while, meaning after processing several images (on average 5 or 6) the next one will load without the menu by its side.
    2) When using the next image button, the images do not load in the order sorted by name.

    I am not entirely sure if the operating system is the problem.

    Can you please share if you encountered or got reports of similar bugs? Maybe you know how to solve them in this case.

    Thanks,
    Alexei

    Liked by 1 person

  8. Hello Alexei,
    Happy to see the tool is helping to someone else too.
    For your questions,
    -I am experiencing the same menu disappearence problem time to time but I think theres not much I can do about it since it appears related to the ActionBar plugin I am using for the menu system. I hope a new version of ActionBar may fix such problems. The solution I apply in such cases is, if right-menu does not appear, I am moving the window a bit, from title bar. Then menu reappears. But if menu does not come back, means its somehow closed, re-opening the image might be necessary to make the side-menu available again.
    -The next button does not aim to load next file in alpabetical order. Its just loading the next filename the operating system gives it. So I am afraid theres no specific order arranged with it. On the other hand, in my tests, its already bringing the next file in alphabetical order. But Next button is currently working only for png and jpg files so it might be skipping the files under other formats.

    Like

  9. Hello! I have been using your script for some months and it worked pretty well until…the tool stopped working without any ado. When I click on the plugin name in Fiji, two black boxes with the right name appear but nothing else happens. I canno click on those or doing anything. Do you know what might cause this?

    Like

    1. Hi, couple of questions, first, which operating system is this? Second, have you updated anything related to Java, Fiji etc? In most cases, a fresh install to another folder solves the problems. Then you can continue from there.

      Like

  10. Hello Alper,
    I am exploring for tool for labeling each pixel of satellite image which is in tiff format to prepare training dataset for deep learning. I explored the tool and I liked it. My query is can I label each pixel of the satellite image to a class and prepare training dataset using the tool. Image is of dimension 4503x9052x3 uint16.
    Please guide.
    Thank you.

    Like

    1. Hello,
      I am not sure if this is the right tool for you, if you are looking to classify each (single) pixel, according to it’s color (or color range). This tool allows you to define rectangular areas containing similar shapes, for deep learning training. Of course, you can define single-pixel wide areas, and label them, but not automatically, since this tool let’s you annotate regions, only manually (one by one).

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s