How to dump Custom Dataset into ImageFolder readable format?

I have a CustomDataset that subclasses
Due to some third-party library specs, I have an unusual situation where I need the data in CustomDataset to be stored in a directory in an ImageFolder readable format.

What’s the easiest/cleanest way to achieve this?
Many thanks

If you need to store the data in the “folder layout” expected by ImageFolder, you could either move the data to the root and subfolders or create symbolic links instead.

Can you explain what do you mean by move the data to the root and subfolders? The CustomDataset contains custom data that I did not load from a folder but created from scratch

In that case I don’t understand the question correctly.
Could you explain this part a bit more:

If you are creating the data from scratch, then you might want to save it to the expected folder structure.

Yes, I am creating the data from scratch and have it in the form of a pytorch Dataset and I was wondering if there’s a simple way to “export” it into an ImageFolder compatible format.
I imagine I can do this “manually” myself, but I wanted to know if there’s some existing functionality that can easily dump a Dataset into the desired format, as the ImageFolder format is common.

Thanks for clarifying. No, I don’t think there is an automatic way to export the images.

1 Like