Meaning of class 0

#2
by nicolas-sapay - opened

When I run flair-detect on images from the test set, many pixels are assigned to class 0. However, the class index ranges from 1 to 15, according to the dataset doc. Does class 0 correspond to 'unknown'? The model specifies it can predict up to 15 classes, but the dataset indicates that 19 classes are available? The model configuration file requires to set the parameter n_classes to 19, not 15, actually.

What it is the meaning of class 0? What is the class index range of this model?

My configuration file:

output_path: /tmp/test
output_name: test

input_img_path: /tmp/dataset/IMG_063487.tif
channels: [1, 2, 3, 4, 5]

img_pixels_detection: 512
margin: 128
output_type: "argmax"
n_classes: 19


model_weights: /tmp/hugging-face/FLAIR-INC_rgbie_15cl_resnet34-unet_weights.pth  
model_framework: 
    model_provider: SegmentationModelsPytorch
    HuggingFace:
        org_model: openmmlab/upernet-swin-small
    SegmentationModelsPytorch:
        encoder_decoder: resnet34_unet


batch_size: 4
use_gpu: false
num_worker: 0

write_dataframe: False

norma_task: 
  - norm_type: custom
    norm_means: [105.08, 110.87, 101.82, 106.38, 53.26]
    norm_stds: [52.17, 45.38, 44, 39.69, 79.3]
Institut national de l'information géographique et forestière org
edited 3 days ago

Hi Nicolas,

The labels of the dataset can take 19 different values ranging from 1 to 19. However 4 classes were desactivated during the training (class weight = 0). See section "Uses"/"Land Cover classes of prediction" and "Training Hyperparameters"/"Class Weights" of the Model Card. We call the model "15 classes" as classes n° 15, 16, 17 and 19 should appear at 0 in the logits and therefore never be present in the final prediction.

However, I realise that there is some information missing in the documentation. In the training code labels ranging from 1 to 19, are re-arranged to 0 to 18 (N-1); so as to begin at 0 (such as the argmax function). When you run the flair-detect, the images obtained are written with this label convention 0 to 18 (N-1).

So class 0 in the detection images represent the "building class". Similarly, max value obtained shoud be 17-greenhouse and the ignored classes because of class weight=0 : n° 14, 15, 16 and 18.

Sébastien

This is crystal clear.

Thanks a lot!

Sign up or log in to comment