NaturalIntelligence / NaturalIntelligence/imglab

Append 0 to default label names for single digit labels.

Open
#191 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
1k
Forks
613
PR merge metrics
No merged PRs in 30d

Description

The default label names for the first 10 labels are (1-9). However, they should be (00, 01, ... 09). Otherwise, when dlib reads the XML files and reorders the labels in ascending order the labels get messed up. For instance, 13 labels from (0-12) are mapped like the following by dlib before training. The right column is the original label and order of the landmarks in the .XML files. The left column is how the dlib training code perceives as their order. For example, the original 10th point is mapped to the 2nd point, the original 11th to 3rd etc. This results due to the missing 0 in front of 0-9 labels.

image

I used 10 images as both training and testing dataset. I achieved zero MAE on both testings and training. However, the order of the landmarks was all messed up. As I was getting 0 MAE that means the problem was happening with the XML reader of the dlib training functions.

I manually added the 0s to the labels and then the training was correct.
I know I can just manually add the 0s when labelling images using the tool. However, when going for thousands of images, this is a very unnecessary waste of time. I might for now write an XML parser script that will append the zeros.

To Reproduce
Steps to reproduce the behavior:

  1. Label a few images with the default labels. Use around 15 labels. Use the same images for training and testing.
  2. Train a shape predictor using http://dlib.net/train_shape_predictor.py.html
  3. Get zero MAE on both training and testing as we are just testing an overfitted model.
  4. See that the correct key points were detected but the ordering of the landmarks are messed up.

Screenshots
Ground truth:
image

Predicted Landmarks:
image

But MAE was zero. So that means DLIB is reordering the landmarks after reading. And then using that sorted list as the new ground truth order of the landmarks.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in the image-labeling tool's default-label generation and reproduce the issue with around 15 labels, then inspect the XML consumed by train_shape_predictor.py. Done means single-digit default labels are written as 00 through 09 and landmark ordering remains correct when the XML is read for training.

Written by the indexing model from the issue text.

Assessment

Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.