open-mmlab / mmsegmentation

OpenMMLab Semantic Segmentation Toolbox and Benchmark.
https://mmsegmentation.readthedocs.io/en/main/
Apache License 2.0
7.68k stars 2.53k forks source link

Make custom datasets by writing __getitem__ method #3713

Open CauchyComplete opened 1 week ago

CauchyComplete commented 1 week ago

Hi,

I'm new to mmsegmentation but quite familiar with PyTorch. I would like to create a dataset class that can be used in mmsegmentation without modifying the dataset file structure. From what I've found, it seems necessary to change the file structure and ensure all images have the same suffix. However, I prefer not to do that. Instead, I want to write my own getitem method in a class inheriting from torch.utils.data.Dataset to easily customize the loading process.

Could you please provide guidance on how to achieve this or refer me to any relevant documentation?

Thank you.