custom dataset
soans1994 opened this issue · comments
hello author,
how to build voc like data from custom dataset of raw images and seg masks png.
thank you
The following explains how to create the custom dataset class, inheriting libs.datasets.base._BaseDataset
. The class has no content in _set_files()
and _load_data()
, where you need to instantiate them for your case.
deeplab-pytorch/libs/datasets/base.py
Lines 48 to 58 in 4219467
- Assuming a pair of image and label files is named with a unique ID, we then store all the IDs to a list
self.files
in_set_files()
. For instance,CocoStuff164k
extracts the IDs from image paths as follows.
deeplab-pytorch/libs/datasets/cocostuff.py
Lines 64 to 74 in 4219467
- Next, we implement
_load_data()
, which reads and returns a pair of image and label data from the givenindex
of the IDs. Again,CocoStuff164k
may help you.
deeplab-pytorch/libs/datasets/cocostuff.py
Lines 76 to 84 in 4219467
That's all. The custom dataset class can fetch and preprocess the data, as implemented in the super class.
deeplab-pytorch/libs/datasets/base.py
Lines 105 to 113 in 4219467
thank you very much for the detailed explaination.