Skip to content

Add class balanced training for semantic segmentation#4

Merged
anwai98 merged 3 commits intomainfrom
add-class-weighted-semantic-training
Apr 7, 2026
Merged

Add class balanced training for semantic segmentation#4
anwai98 merged 3 commits intomainfrom
add-class-weighted-semantic-training

Conversation

@anwai98
Copy link
Copy Markdown
Contributor

@anwai98 anwai98 commented Apr 2, 2026

Adding a new round of training to see if class weighting helps (the training logs look quite good, but overfits even faster haha - again, not surprising)

Will merge this later with the results!

@anwai98 anwai98 changed the title Add class-wise pixel balanced pixel frequency for semantic segmentation Add class balanced training for semantic segmentation Apr 2, 2026
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread pdac-segmentation/train_semantic.py Outdated
# Hyperparameters for training
num_classes = 3
class_weights = get_class_weights(label_key, num_classes=num_classes) # ca. [0.4, 6.5, 3.1]
name += "-class-weighted"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make it simpler? (eg. [1, 3, 2])

@anwai98
Copy link
Copy Markdown
Contributor Author

anwai98 commented Apr 7, 2026

This is sorted now. I'll go ahead and merge this!

@anwai98 anwai98 merged commit 7e0312d into main Apr 7, 2026
@anwai98 anwai98 deleted the add-class-weighted-semantic-training branch April 7, 2026 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant