utils.dataset_prophesee.PropheseeDataModule#
- class PropheseeDataModule(root: str = './data', batch_size: int = 4, num_workers: int = 1, num_steps: int = 42, time_step_us: int = 4000, resize: List[int] | int | None = None)[source]#
Bases:
LightningDataModuleModule for working with GEN1 dataset
- Parameters:
root (str) – Root directory where the dataset is stored.
batch_size (int) – Number of samples per batch to load.
num_workers (int) – Number of subprocesses to use for data loading.
num_steps (int) – Number of time steps (frames) in each event tensor.
time_step_us (int) – Duration of each time step in microseconds.
resize (Optional[Union[List[int], int]]) – Target size for resizing input data (height, width) or None for no resizing.
Methods
Returns a list of class names
An iterable or collection of iterables specifying prediction samples.
Called at the beginning of fit (train + validate), validate, test, or predict.
An iterable or collection of iterables specifying test samples.
An iterable or collection of iterables specifying training samples.
An iterable or collection of iterables specifying validation samples.
Attributes
- predict_dataloader()[source]#
An iterable or collection of iterables specifying prediction samples.
For more information about multiple dataloaders, see this section.
It’s recommended that all data downloads and preparation happen in
prepare_data().predict()prepare_data()
- Note:
Lightning tries to add the correct sampler for distributed and arbitrary hardware There is no need to set it yourself.
- Return:
A
torch.utils.data.DataLoaderor a sequence of them specifying prediction samples.
- setup(stage: str) None[source]#
Called at the beginning of fit (train + validate), validate, test, or predict. This is a good hook when you need to build models dynamically or adjust something about them. This hook is called on every process when using DDP.
- Args:
stage: either
'fit','validate','test', or'predict'
Example:
class LitModel(...): def __init__(self): self.l1 = None def prepare_data(self): download_data() tokenize() # don't do this self.something = else def setup(self, stage): data = load_data(...) self.l1 = nn.Linear(28, data.num_classes)
- test_dataloader()[source]#
An iterable or collection of iterables specifying test samples.
For more information about multiple dataloaders, see this section.
For data processing use the following pattern:
download in
prepare_data()process and split in
setup()
However, the above are only necessary for distributed processing.
Warning
do not assign state in prepare_data
test()prepare_data()
- Note:
Lightning tries to add the correct sampler for distributed and arbitrary hardware. There is no need to set it yourself.
- Note:
If you don’t need a test dataset and a
test_step(), you don’t need to implement this method.
- train_dataloader()[source]#
An iterable or collection of iterables specifying training samples.
For more information about multiple dataloaders, see this section.
The dataloader you return will not be reloaded unless you set :paramref:`~lightning.pytorch.trainer.trainer.Trainer.reload_dataloaders_every_n_epochs` to a positive integer.
For data processing use the following pattern:
download in
prepare_data()process and split in
setup()
However, the above are only necessary for distributed processing.
Warning
do not assign state in prepare_data
fit()prepare_data()
- Note:
Lightning tries to add the correct sampler for distributed and arbitrary hardware. There is no need to set it yourself.
- val_dataloader()[source]#
An iterable or collection of iterables specifying validation samples.
For more information about multiple dataloaders, see this section.
The dataloader you return will not be reloaded unless you set :paramref:`~lightning.pytorch.trainer.trainer.Trainer.reload_dataloaders_every_n_epochs` to a positive integer.
It’s recommended that all data downloads and preparation happen in
prepare_data().fit()validate()prepare_data()
- Note:
Lightning tries to add the correct sampler for distributed and arbitrary hardware There is no need to set it yourself.
- Note:
If you don’t need a validation dataset and a
validation_step(), you don’t need to implement this method.