Skip to content

Labelling training data

James Durrant edited this page Apr 26, 2018 · 1 revision

The process of labelling training data is described here, with the following slide image used as an example:

Labelling classes

To create a map of classes per-pixel, it is first necessary to define which RGB values correspond to which class label. This is done with a simple label_colors.txt file where each row is one class, and the columns are red, green, blue and the label name (separated by whitespace).

For example:

  0   0   0 Background
255 255 255 Barcode
255   0   0 Label
255 255   0 Specimen
  0   0 255 TypeLabel

It is important to ensure that every pixel's RGB value is one of the colours in the given list. If the image is not saved losslessly or is resized without due care then this can easily happen. The results in this case will be unpredictable.

A class map image using the colours from the example above will look something like:

Labelling instances

This is done in much the same way as for classes, however there is no need to predefine colours (in fact we do not know the number of instances in advance and so it's not possible to do this anyway). Instead, any unique colour is treated as representing its own instance. Note that it is just as important in this case to not introduce any new or in-between colours by way of compression or anything else: in this case there could then be many more (small) instances than expected. This will result in slow running time and worse results.

Colours for instances can be any RGB colour, however for debugging purposes it is helpful to have them visually distinct. An instance map image using the example above will look something like:

Clone this wiki locally