FIX7.9.02 min read

Next and Previous are faster on large images

Next and Previous waited for Labelme to decode the Image, about 90 ms for a 12-megapixel JPEG.

In Labelme v7.9.0, Labelme decodes the next and previous Images in the background while you look at the current one (#2769). When you press Next, the decode is usually done already. The Image you just left stays decoded for Previous, within a size limit.

Recorded on Labelme v7.11.1 on twelve video frames of horses trotting across a meadow, each with horse Shapes drawn as red masks. The pointer clicks Next eleven times, about three times a second. The horses trot from the first frame to the twelfth, the masks move with them, and the highlight moves down the Image List. The pointer then clicks Previous eleven times back to the first frame, and Next eleven times again at about five a second. The clip is put together from rendered frames at the script's pace, so it does not show how fast the app is. The frames are from a video by Field of Dreams on Wikimedia Commons, CC BY 3.0.

The times

We timed both versions for this post. From Next to the Image being loaded took 93 ms in v7.8.1 and 12 ms in v7.9.0. Previous took 93 ms and 11 ms.

Each time is the median of 20 steps through a folder of 4000×3000 JPEGs, with a pause of 0.3 s on each Image, on an M5 MacBook Pro with the window rendered offscreen.

Where it still waits

Labelme decodes one Image ahead in each direction. If you step faster than Labelme can decode, for example by holding the key down, a step waits while its Image is still decoding, as before. With no pause between steps, the same folder took about 47 ms an Image in both versions.

Decoding ahead covers JPEG and PNG files. It skips other formats, Images that EXIF rotates or mirrors, and Images estimated to need more than 128 MB once decoded. The Image you left is not kept either when its decoded size is over that limit (#2769).

Opening the folder

A folder of 5,000 Images with no Annotation Files opens in about 170 ms instead of 350 on the same MacBook. Labelme sorts the Image List by each path below the opened folder instead of by the full path (#2768).

When every one of those Images has an Annotation File, the first open is not faster. It took 430 ms in v7.9.0 and 370 ms in v7.8.1. v7.9.0 reads each Annotation File to decide its check mark, where v7.8.1 only looked for the file.

Labelme is an offline-first annotation tool with local AI support.

Try Labelme Free