lightly-ai / lightly-ai/lightly-train

[QUESTION] Handling Unlabeled and Background Classes in Mask2Former for Custom Dataset

Open
#403 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

medical imaging question segmentation
Dominant language
Python
Stars
1.7k
Forks
116
Avg merge
2d 21h
Merged PRs (30d)
6

Description

### 🤔 What’s your question?

I want to train a model on a dataset from https://arxiv.org/html/2507.16855v1, where the labels are defined as: class 0 for unlabeled pixels (due to uncertain categories), class 1 for background, and classes 2-16 for foreground. However, when I examined the Mask2Former loss code, it seems to treat the ignore_index and background as the same category. Does this mean all ignore_index pixels would be predicted as background? This appears incompatible with my dataset, where unlabeled (class 0) and background (class 1) are distinct. How should I handle these classes to ensure proper training with Mask2Former?

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

Read the Mask2Former loss code and the dataset label definitions described in the issue. Verify how ignore_index and background are represented, then document the supported handling for class 0 (unlabeled), class 1 (background), and classes 2–16; done when the training behavior and required configuration are clear.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
computer-vision, machine-learning
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.