Alp’s Labels to Images converter, for Detectnet/KITTI

(UPDATED FEBRUARY 8, 2018)

Hello,

Assuming you have already created label .txt files for each of your images, using ALT or any other similar labeling tool. This Fiji plugin is for people who wants to quickly verify if all the labelling data is in right place, and error free.

It reads images and their corresponding label text file from same directory, converts label rectangles to permanent drawings, writes label’s name to the top of topleft corner, then saves the output as jpeg file to another directory, with “th_” prefix. It checks for unique label types and assigns a different color for each unique label (up to 9 labels, the remaining label types will be drawn in black). ESC key is used to stop running macro anytime.

You can quickly view the output images to see if any labels are misaligned, or in wrong place, at wrong dimensions, etc..

It also creates a list of unique labels found in the input folder, and saves the list to output directory as “list_of_labels.txt”.

You can choose;

  • Which image format will be processed from input folder (jpeg, png..)
  • Final image dimension (100%, 50% or 25%)
  • Font size of label text

for the output images.

Installation

Download current: Alp’s Label to Image (Windows & Ubuntu) ; 07mar2017

The plugin has been successfully tested on Windows 10 and Ubuntu 14.04 environments.

See down below for whats new in the current and links to older versions, in case if current version fails for some reason.

Open the archive file, drag and drop the plugins folder in it onto Fiji.app folder (Your Fiji program folder). This version was not tested throughly, but appears working in Ubuntu, too.

Usage

Whole installation process (including Fiji) and basic usage is documented in the video below.

Alp’s Labels to Images Converter Video (Youtube)

Requirements

Please be sure that the input folder contains all the images and their text files, in the same folder (not in subfolders!). If there are image files without label files, program will stop with a warning.

Versions

  • Alps Label to Image (Windows&Ubuntu); 07mar2017
    • In this version, each label type have its own color, up to 9 different labels (remaining label rectangle and titles are drawn in black). Also asks for font size, for comfortable reading of printed labels.
    • Another feature is, it scans all label .txt files and creates a unique list of labels found in input folder. Then it saves the list as a text file to output directory as “list_of_labels.txt”. This way you can see if there are any problems with label names, like mispelled labels, etc.
  • Alps Label to Image (Windows); 02mar2017
    • Now rectangles have their label text on their topleft corners. Font size increases at different image scales so label’s name remains readable.
  • Alps Label to Image (Windows); 01mar2017

14 thoughts on “Alp’s Labels to Images converter, for Detectnet/KITTI

  1. Thanks for making these tools available I’m trying to verify some labels, but I’m getting the following error “java.lang.IllegalArgumentException: “Label” column not found”, even on images saved using the Alps labeling tool. Any ideas? The results window does show the correct bounding box area, but the labelled image is never output.

    An example that fails:
    dog 0.0 0 0.0 756 377 1176 1209 0.0 0.0 0.0 0.0 0.0 0.0 0.0

    Like

  2. I’m getting the same error. Here is the Stacktrace:

    (Fiji Is Just) ImageJ 2.0.0-rc-61/1.51s; Java 1.8.0_66 [64-bit]; Windows 10 10.0; 76MB of 12117MB (<1%)

    java.lang.IllegalArgumentException: "Label" column not found
    at ij.measure.ResultsTable.getStringValue(ResultsTable.java:404)
    at ij.macro.Functions.getResultLabel(Functions.java:1177)
    at ij.macro.Functions.getStringFunction(Functions.java:272)
    at ij.macro.Interpreter.getStringTerm(Interpreter.java:1316)
    at ij.macro.Interpreter.getString(Interpreter.java:1295)
    at ij.macro.Interpreter.doStringAssignment(Interpreter.java:953)
    at ij.macro.Interpreter.doAssignment(Interpreter.java:747)
    at ij.macro.Interpreter.doStatement(Interpreter.java:262)
    at ij.macro.Interpreter.doBlock(Interpreter.java:630)
    at ij.macro.Interpreter.doStatement(Interpreter.java:289)
    at ij.macro.Interpreter.doFor(Interpreter.java:552)
    at ij.macro.Interpreter.doStatement(Interpreter.java:271)
    at ij.macro.Interpreter.doBlock(Interpreter.java:630)
    at ij.macro.Interpreter.runUserFunction(Interpreter.java:328)
    at ij.macro.Interpreter.doStatement(Interpreter.java:250)
    at ij.macro.Interpreter.doBlock(Interpreter.java:630)
    at ij.macro.Interpreter.doStatement(Interpreter.java:289)
    at ij.macro.Interpreter.doIf(Interpreter.java:988)
    at ij.macro.Interpreter.doStatement(Interpreter.java:265)
    at ij.macro.Interpreter.doIf(Interpreter.java:1001)
    at ij.macro.Interpreter.doStatement(Interpreter.java:265)
    at ij.macro.Interpreter.doStatements(Interpreter.java:233)
    at ij.macro.Interpreter.run(Interpreter.java:116)
    at ij.macro.Interpreter.run(Interpreter.java:87)
    at ij.macro.MacroRunner.run(MacroRunner.java:139)
    at java.lang.Thread.run(Thread.java:745)

    Like

    1. Hi Robert, due to increased complaints about Labels to Images Converter, I made a clean install of Fiji, ActionBar plugin and the Labels to Images plugin, and all three were fresh downloaded from provided sources.
      My installed Java version is;
      Version 8 update 151 (build 1.8.0_151-b12)
      “Fiji about” says ImageJ 1.51s
      Result is, all working without any problems.

      I have no idea what else may cause such a problem, but as I said formerly, a couple of things to try, one is using one or a few images to make a test-run before executing it for a whole directory of images. Another thing is trying same test folder in another computer, by copying Fiji folder and test images folder from the problem computer to other one, to see if its system related issue.
      Regards,

      Like

  3. Running Windows 10. Watched the install video and everything is the same until I run the plugin. It’s asking me for a Input/Output directories which I don’t see in the video. So, I enter the directories and with a label font size of 40, click OK, choose ‘.jpg’ as the format, and then choose ‘100%’ on the output file dimension. Immediately get the following Macro Error:

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

    Like

    1. Hello Jeremy,

      I tried something to replicate the problem but all failed. CouldnT get the error message you mentioned. I advise you to make a test by creating two empty folders, input and output. Then put a single image into input folder along with label text file and run the software. If it works, general problem sources to look are; unusual file/folder names-extensions, broken image files, problems within label txt files.
      If single file fails too, just load it to ALT to see if labels are correctly placed and save it (overwrite), then make a test. If labels to images still fails, you may need to reinstall fiji and other necessary stuff into another new folder to test the situation with a fresh install.

      Like

      1. My use case is that I’m trying to create a set of KITTI annotations based upon a directory of images only. I didn’t realize there was a requirement that a corresponding .txt file for each image also be present. Once I add a .txt file it then gives me a warning, but now complains that the .txt file is empty. I would suggest that the error that is given when the .txt file is missing should be more user friendly.

        Your documentation does not list any prerequisite steps to prepare the input images directory and is assuming an existing .txt file. I have 100’s of images and now need to create a conforming .txt file for each image to use your plugin. Can you list out a process of what that requirement is and how to prepare them?

        Like

      2. Ok… I think I have solved my issues. There are two plugins, not one. That part was unclear to me initially as I started with the “Labels to Images” converter here. Both of the plugins are very similarly named so I was thinking it was a version difference. Thanks.

        Liked by 1 person

      3. Hi Jeremy, I have further modified the text to clarify this is not step.1 tool for labeling process, But for the makers, sometimes it can be quite easy to make assumptions about the way people read the info, thanks for the aid actually, and hope the toolset works well for you.

        Liked by 1 person

  4. ‘[‘ or ‘.’ expected in line 268:
    if ( xaa < 8 ) { run ( “Colors…” , “foreground=” + coloruniq [ xaa [ 0 ] ] + “” ) ;

    I am getting this error as I run the labels to images converter. no output is obtained.
    Please suggest what might be wrong

    Like

    1. Hello,
      Can you please provide a bit info about the data you use? The image format, rgb-greyscale, resolution, number of classes?

      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