Skip to content

Load data repeatedly in class CSVIterableDataset from monai/data/iterable_dataset.py #7869

Open

Description

@Colwzq

Describe the bug
In iterable_dataset.py

def __iter__(self):
    if self.shuffle:
        self.seed += 1
        buffer = ShuffleBuffer(
            data=self._flattened(), transform=self.transform, buffer_size=self.buffer_size, seed=self.seed
        )
        yield from buffer
    yield from IterableDataset(data=self._flattened(), transform=self.transform)

This may cause loading data repeatedly, and maybe the code should be

def __iter__(self):
    if self.shuffle:
        self.seed += 1
        buffer = ShuffleBuffer(
            data=self._flattened(), transform=self.transform, buffer_size=self.buffer_size, seed=self.seed
        )
        yield from buffer
   else:
        yield from IterableDataset(data=self._flattened(), transform=self.transform)

If I understand the logic in the code incorrectly, please point it out directly, thanks a lot.
To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Install '....'
  3. Run commands '....'

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment

Ensuring you use the relevant python executable, please paste the output of:

python -c "import monai; monai.config.print_debug_info()"

Additional context
Add any other context about the problem here.

Activity

  1. reopened this on Jun 24, 2024
  2. changed the title [-]Repeat load data in[/-] [+]Repeat load data in class CSVIterableDataset from monai/data/iterable_dataset.py[/+] on Jun 24, 2024
  3. changed the title [-]Repeat load data in class CSVIterableDataset from monai/data/iterable_dataset.py[/-] [+]Load data repeatedly in class CSVIterableDataset from monai/data/iterable_dataset.py[/+] on Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions