Problem
Profiling inspect() with py-spy reveals that torch.unique() at line 243 consumes ~37% of total execution time. For 3D medical images like BRaTS (240x240x155), this operation scans the entire label volume for each sample.
The ids field is rarely used in practice - only referenced in documentation examples. Most training pipelines (ROIDataset, RandomROIDataset) never access this field, making the 37% overhead unnecessary.
Proposed Solution
Add compute_ids: bool = True parameter to inspect(), allowing users to skip the expensive unique() call. When False, set ids to None (requires changing type to tuple[int, ...] | None).
Problem
Profiling
inspect()with py-spy reveals thattorch.unique()at line 243 consumes ~37% of total execution time. For 3D medical images like BRaTS (240x240x155), this operation scans the entire label volume for each sample.The
idsfield is rarely used in practice - only referenced in documentation examples. Most training pipelines (ROIDataset, RandomROIDataset) never access this field, making the 37% overhead unnecessary.Proposed Solution
Add
compute_ids: bool = Trueparameter toinspect(), allowing users to skip the expensiveunique()call. WhenFalse, setidstoNone(requires changing type totuple[int, ...] | None).