Add early stopping with warmup. Remove mandatory background label in semantic segmentation task
Summary
Motivation:
-
Early stopping from lightning doesn't have a warmup parameter and it leads to underfitting when training on small Geti target datasets. I added two thresholds to have invariant for small datasets that can fit in one batch and for larger data
-
Inserting a background label actually can lead to class mismatches for the Segmentation head, sometimes datasets don't have background classes at all. I tried to divide the Geti case with polygons and ordinary training from file masks. When dm_dataset represents annotations with Polygons -> we insert a background label and create a head with num_classes + 1. For other cases, dataset_meta.json should explicitly reflect all classes for training. So, the number of indices in masks == num categories in dataset_meta.json. Before these changes, if we add a background class to dataset_meta.json, the training will fail, because OTX deletes the background class during prefiltering. Now, the background class must be presented in a metadata file when needed.
How to test
Checklist
- [ ] I have added unit tests to cover my changes.
- [ ] I have added integration tests to cover my changes.
- [ ] I have ran e2e tests and there is no issues.
- [ ] I have added the description of my changes into CHANGELOG in my target branch (e.g., CHANGELOG in develop).
- [ ] I have updated the documentation in my target branch accordingly (e.g., documentation in develop).
- [ ] I have linked related issues.
License
- [ ] I submit my code changes under the same Apache License that covers the project. Feel free to contact the maintainers if that's a concern.
- [ ] I have updated the license header for each file (see an example below).
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0