Iterative Pixel Stratification (IPS)
- IPS is a segmentation-specific method that replaces binary label balancing with pixel count balancing to ensure more representative train/validation/test splits.
- It employs a greedy assignment mechanism that prioritizes rare classes by tracking residual pixel quotas, thereby addressing imbalances in dense image segmentation.
- Empirical studies show IPS improves pixel-level proportionality compared to random splits, though it can suffer from sample-count imbalances and lacks global optimization.
Iterative Pixel Stratification (IPS) is a segmentation-specific adaptation of iterative stratification for multilabel data, introduced to construct train/validation/test splits or -fold partitions whose label composition is more representative than what one typically obtains from naive random splitting in image segmentation (Jami et al., 25 Sep 2025). Its defining move is to replace label-occurrence balancing with pixel-count balancing: instead of treating a class as merely present or absent in an image, IPS tracks how many pixels of each semantic class are assigned to each fold. The method is therefore tailored to dense prediction settings in which an image can contain multiple classes simultaneously and the relevant distributional quantity is class-wise pixel proportion rather than binary label incidence.
1. Conceptual basis and motivation
The motivation for IPS begins from a practical difficulty in segmentation evaluation. Random splitting of segmentation datasets often produces folds whose class distributions differ noticeably from the overall dataset, especially when the dataset is small, imbalanced, or contains rare classes (Jami et al., 25 Sep 2025). This is consequential because segmentation performance is usually evaluated per class or with metrics such as F1 and IoU; if a class is underrepresented or absent in a fold, evaluation becomes unstable or even undefined for that class. The effect is particularly acute for test folds, because they are smaller and therefore more sensitive to sampling noise.
Classical stratification is comparatively straightforward in classification problems because each sample usually belongs to exactly one class, or at least to a finite label set without proportions. Segmentation does not satisfy that structure. An image may contain several classes at once, and what matters is not only whether a class occurs, but how many pixels it occupies. Two images may both contain “road” and “car,” while one is dominated by road pixels and the other contains only a very small road region. IPS is designed for precisely this setting: a split should ideally preserve pixel-level class proportions rather than merely class occurrence.
This design makes IPS segmentation-specific in a strong sense. Prior multilabel stratification methods such as Iterative Stratification (IS), PMBSRS, and SOIS treat labels as binary present/absent events. IPS extends the iterative stratification idea by reformulating demand in terms of class pixel counts. A fold in which a rare class appears in several images can still be unrepresentative if nearly all of that class’s pixels concentrate in one fold or if one fold receives only tiny regions while another receives all large regions. IPS addresses that failure mode by operating directly on mask-derived pixel statistics (Jami et al., 25 Sep 2025).
2. Formal problem statement
The paper formalizes the segmentation splitting problem on a dataset
where is an image and is its segmentation mask (Jami et al., 25 Sep 2025). There are semantic classes and desired folds with target proportions
The goal is to produce disjoint subsets
whose sizes approximately follow , while preserving the label composition of the full dataset.
The key statistics are pixel counts. The paper defines as the total number of pixels in sample 0, 1 as the number of pixels of class 2 in sample 3, 4 as the total number of pixels of class 5 in the whole dataset, 6 as the desired or accumulated number of pixels of class 7 in fold 8, 9 as the number of samples that contain class 0, and 1 as the desired number of such samples in fold 2 (Jami et al., 25 Sep 2025).
IPS tries to match per-fold class pixel quotas
3
for every class 4, while also tracking desired fold sizes
5
This is the core formal distinction from multilabel iterative stratification in classification: “number of positive instances of a label” is replaced by “number of pixels of that label.” When a sample is placed in a fold, the residual demand for every class is reduced by the number of pixels of that class present in that sample (Jami et al., 25 Sep 2025).
3. Greedy assignment mechanism
IPS is a greedy sequential assignment method rather than a global optimization procedure. Its rule is simple: repeatedly select the rarest remaining class and assign samples containing that class to the fold that currently has the largest unmet demand for that class’s pixels (Jami et al., 25 Sep 2025). The appendix pseudocode specifies the procedure.
First, the algorithm computes the desired number of samples in each fold, 6. For each class 7, it computes the total class-pixel count 8 and the desired number of pixels of class 9 in each fold, 0. While unassigned samples remain, it finds the rarest class among the remaining data,
1
and iterates over the subset 2 of unassigned samples containing class 3.
For each sample 4, IPS identifies the fold or folds with the largest remaining desire for class 5,
6
If the maximizer is unique, the sample is assigned there. If several folds tie, IPS prefers the one with smallest remaining desired sample count,
7
If a tie remains, it chooses a random element of 8. After selecting fold 9, the sample is assigned to 0, removed from the unassigned dataset, the remaining sample demand is decremented as 1, and for every class 2 the fold’s remaining pixel demand is reduced by the number of class-3 pixels in that sample,
4
The process continues until all samples are assigned (Jami et al., 25 Sep 2025).
In plain terms, IPS treats rare classes as highest priority because allocation mistakes on rare classes are hardest to repair later. It is deterministic up to tie-breaking and the iteration order over samples in the currently selected rare-class subset. The paper does not provide a formal asymptotic complexity expression. It states only that IPS is a straightforward greedy iterative procedure; the appendix runtime comparison indicates that IPS is slower than random splitting and faster than WDES, but no exact complexity formula is given (Jami et al., 25 Sep 2025).
4. Representativeness criteria and relation to WDES
The paper introduces three heterogeneity or similarity measures that clarify what IPS is intended to preserve (Jami et al., 25 Sep 2025). Sample count balance is measured by Sample Distribution (SD):
5
Pixel-level class proportion matching is measured by Pixel Label Distribution (PLD):
6
Overall distributional similarity can also be summarized with the Label Wasserstein Distance (LWD). Defining cumulative class distributions by
7
the paper gives
8
IPS does not directly minimize PLD or LWD. Rather, it greedily tries to satisfy per-class pixel quotas fold by fold, which is intended to improve representativeness indirectly. This point is central to its contrast with Wasserstein-Driven Evolutionary Stratification (WDES). IPS is a greedy single-pass heuristic; once a sample is assigned, that choice is never revisited. WDES instead is a population-based genetic algorithm whose individuals encode complete assignments and whose fitness is defined by a Wasserstein-based score over full splits (Jami et al., 25 Sep 2025).
The paper identifies three major differences between IPS and WDES: objective, search strategy, and guarantees. IPS does not optimize an explicit global objective over complete stratifications, whereas WDES evaluates complete candidate splits in parallel and explores a broader combinatorial space. No analogous convergence guarantee is given for IPS. This difference underlies the paper’s later failure analysis: IPS was designed to be a label-aware stratification method, but its single-pass, greedy allocation strategy reduces label demands immediately after each assignment and cannot reconsider earlier decisions (Jami et al., 25 Sep 2025).
5. Empirical behavior, strengths, and limitations
IPS was evaluated on five segmentation datasets spanning several domains: PascalVOC 2012, CamVid, EndoVis2018, LoveDA, and Cityscapes (Jami et al., 25 Sep 2025). The baselines were random splitting using scikit-learn KFold, IPS, and WDES. Evaluation proceeded in two stages. First, the paper computed SD, PLD, and LWD on generated folds. Second, it assessed downstream impact using 10-fold cross-validation with a UNet (ResNet34 encoder), reporting mean and standard deviation of Accuracy, F1 score, and IoU.
The fold-quality results are mixed and generally unfavorable to IPS relative to WDES. IPS often has substantially worse SD than both random splitting and WDES because it prioritizes pixel balance over exact sample-count proportionality. Reported examples are PascalVOC: IPS SD 9 versus random 0 and WDES 1; CamVid: IPS SD 2 versus random 3 and WDES 4; EndoVis: IPS SD 5 versus random 6 and WDES 7; LoveDA: IPS SD 8 versus random 9 and WDES 0; Cityscapes: IPS SD 1 versus random 2 and WDES 3 (Jami et al., 25 Sep 2025).
On PLD and LWD, IPS sometimes improves over random splitting but is never better than WDES in the reported means. PascalVOC is a representative case where IPS helps relative to random—PLD drops from 4 to 5, and LWD from 6 to 7—yet WDES still performs better with PLD 8 and LWD 9. Other datasets show weaker behavior: on CamVid, IPS is worse than random in both PLD and LWD; on EndoVis, IPS is again worse than random; on LoveDA, IPS is roughly similar to random in PLD and slightly worse in LWD; and on Cityscapes, IPS trails random on both metrics (Jami et al., 25 Sep 2025).
The downstream segmentation results follow the same pattern. On PascalVOC, IPS reduces fold-to-fold variance relative to random splitting: Accuracy standard deviation decreases from 20.6 to 14.5, F1 standard deviation from 32.5 to 30.3, and IoU standard deviation from 34.3 to 31.6. WDES improves further, to 11.0, 24.0, and 24.2 respectively. On EndoVis, IPS improves accuracy variance but worsens F1 and IoU variance: Accuracy standard deviation falls from 19.4 to 14.1, while F1 rises from 27.0 to 29.3 and IoU from 28.1 to 30.7. CamVid is described as very close to random and generally slightly worse, while LoveDA and Cityscapes are often worse than random and worse than WDES (Jami et al., 25 Sep 2025).
The paper’s limitations analysis is explicit. It identifies five weaknesses: single-pass greedy assignment, path dependence, local rather than global reasoning, weak handling of label co-occurrence and contextual diversity, and sample-count imbalance (Jami et al., 25 Sep 2025). IPS may fail to preserve co-occurring label groups, scene composition, or interdependencies between frequent and infrequent classes. Because it focuses on pixel quotas, it can also violate fold-size targets substantially, which is reflected in poor SD.
6. Practical status, usage guidance, and terminological disambiguation
The implementation is described as a straightforward baseline: IPS is “implemented by adapting Iterative Stratification without additional optimizations,” and the paper presents it as “a straightforward baseline” rather than a final recommendation (Jami et al., 25 Sep 2025). Its practical role is therefore specific. It is useful when a practitioner wants a simple segmentation-aware alternative to random splitting that directly exploits class pixel counts. The evidence suggests that it may help on some datasets, particularly where rare classes need better pixel-level balancing than random splitting provides, but it does not emerge as the preferred method under any broad regime.
The paper’s guidance is correspondingly narrow. For very large datasets, random splitting may already be adequate; the appendix gives an asymptotic representativeness result for random splits in multilabel data using the law of large numbers, and the authors state that computational efficiency and simplicity make random splitting practical in that regime (Jami et al., 25 Sep 2025). For smaller datasets, especially imbalanced or low-entropy ones, the recommendation is WDES rather than IPS, because WDES consistently gives better PLD and LWD and lower variance in downstream model evaluation.
A frequent misconception is terminological rather than methodological. In other recent work, the acronym “IPS” refers to different methods. “Iterative Patch Selection” in high-resolution image recognition is patch-based rather than pixel-based, and it does not present Iterative Pixel Stratification (Bergner et al., 2022). The same acronym is used in a later generalization study of that patch-selection framework, again with no pixel-level stratification procedure (Riffi-Aslett et al., 2024). A different line of work in single-pixel imaging presents an iterative region-based refinement method driven by image maps and mean values over overlapping partitions; that method is conceptually adjacent in its selective refinement of non-empty regions, but it is not an IPS method in the segmentation sense and does not explicitly stratify pixels into hierarchical strata (Pastuszczak et al., 1 Sep 2025).
In its canonical meaning, Iterative Pixel Stratification denotes the greedy segmentation-data splitting algorithm that replaces label-occurrence balancing with pixel-count balancing. Its historical significance lies less in empirical dominance than in formalizing a segmentation-aware extension of multilabel iterative stratification. Within the paper that introduced it, IPS functions as a natural baseline: label-aware, straightforward to implement from class pixel counts, and conceptually well matched to dense prediction, but limited by irreversible local decisions and generally outperformed by the Wasserstein-based evolutionary alternative (Jami et al., 25 Sep 2025).