Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can DALI read from HDF5 file? #1252

Open
jiankang1991 opened this issue Sep 12, 2019 · 3 comments
Open

Can DALI read from HDF5 file? #1252

jiankang1991 opened this issue Sep 12, 2019 · 3 comments
Labels
enhancement New feature or request external contribution welcome A good place to start contributing to the project

Comments

@jiankang1991
Copy link

Hi,
I would like to read images from pre-saved HDF5 file? With pytorch dataloader, e.g. I create the following data class and put it in dataloader.

class H5Dataset(Dataset):
    def __init__(self, h5_path):
        self.h5_path = h5_path
        self.h5_file = h5py.File(h5_path, 'r')
        self.length = len(h5py.File(h5_path, 'r'))
    
    def __getitem__(self, index):
        record = self.h5_file[str(index)]
        return (
            record['data'].value,
            record['target'].value,
        )
        
    def __len__(self):
        return self.length

Is it possible to use DALI to read HDF5, will it be faster than pytorch dataloader?

Thank you.

@awolant
Copy link
Contributor

awolant commented Sep 12, 2019

Hi, thanks for the question.
Currently there is no native support for HDF5 in DALI.
You can use ExternalSource to read your file using Python and feed it to DALI pipeline.
For better performance, you can try to implement your own reader using our plugin system.
If you are willing to contribute to DALI, we would be happy to accept PR with new op to read HDF5.

@awolant awolant added enhancement New feature or request external contribution welcome A good place to start contributing to the project labels Sep 12, 2019
@zw0610
Copy link

zw0610 commented Sep 17, 2021

any progress in this issue?

@JanuszL
Copy link
Contributor

JanuszL commented Sep 17, 2021

Hi, @zw0610,

We haven't got into it yet, nor has anyone from the community decided to contribute to this functionality.
You can read more about our 2021 plans here. We can consider this as an item for 2022.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request external contribution welcome A good place to start contributing to the project
Projects
None yet
Development

No branches or pull requests

4 participants