juliendenize / torchaug

Library to perform efficient vision data augmentations for CPU/GPU per-sample/batched data.
https://torchaug.readthedocs.io/en/latest/
Other
24 stars 2 forks source link

[Bug] Chunks are not correctly formed #25

Closed juliendenize closed 7 months ago

juliendenize commented 7 months ago

Issue

Chunks are not correctly formed for BatchLabels, BatchBoundingBoxes and BatchMasks.

Example for BatchMasks:

def get_chunk(self, chunk_indices: torch.Tensor) -> BatchMasks:
        chunk_idx_sample = torch.tensor(
            [0] + [self.idx_sample[chunk_indice + 1] - self.idx_sample[chunk_indice] for chunk_indice in chunk_indices]
        )

        chunk_idx_sample = chunk_idx_sample.cumsum(0).tolist()

        return BatchMasks(
            self[chunk_indices], # wrong select
            idx_sample=chunk_idx_sample,
            device=self.device,
            requires_grad=self.requires_grad,
        )

Suggestions

  1. Create a _BatchConcatenatedTATensor private class to inherit from
  2. Fix the select for each classes
  3. Make tests for such classes
juliendenize commented 7 months ago

Still buggy when there are different chunks selected because of samples_ranges lost during the process.

Suggestions: