-
Notifications
You must be signed in to change notification settings - Fork 1
ECVL Dataset Generator
Michele Cancilla edited this page Apr 3, 2020
·
1 revision
The ECVL Dataset Generator generates a Dataset object from a directory tree. The Dataset can then be dumped into a YAML file following the DeepHealth Toolkit Dataset Format.
For classification tasks, the generator expects a directory structure where the top-level dataset directory can have:
- subdirectories named training, validation and test (possibly not all present), each of which has in turn one subdirectory for each class, containing the images for that class.
- dataset_name
- training
- class_0
- tr_0_0.png
- tr_0_1.png
- class_1
- tr_1_0.png
- tr_1_1.png
- validation
- class_0
- val_0_0.png
- val_0_1.png
- class_1
- val_1_0.png
- val_1_1.png
- one subdirectory for each class, containing the images for that class. In this case, no splits will be added to the dataset.
- dataset_name
- class_0
- tr_0_0.png
- tr_0_1.png
- class_1
- tr_1_0.png
- tr_1_1.png
#include "ecvl/dataset_generator.h"
using namespace ecvl;
int main()
{
GenerateClassificationDataset class_dataset("/path/to/dataset_root");
Dataset d = class_dataset.GetDataset();
d.Dump("/path/to/dataset.yml");
return 0;
}For segmentation tasks, the generator expects a directory structure where the top-level dataset directory can have:
- subdirectories named training, validation and test (possibly not all present), each of which has subdirectories named images containing the images of that split and ground_truth containing ground truth images with the same name and extension of corresponding images.
- dataset_name
- training
- images
- tr_0_0.png
- tr_0_1.png
- ground_truth
- tr_0_0.png
- tr_0_1.png
- validation
- images
- val_0_0.png
- val_0_1.png
- ground_truth
- val_0_0.png
- val_0_1.png
- subdirectories named training, validation and test (possibly not all present), each of which has subdirectories named images containing the images of that split and ground_truth containing ground truth images with the same name of corresponding images but with an additional suffix or with a different extension.
- dataset_name
- training
- images
- tr_0_0.png
- tr_0_1.png
- ground_truth
- tr_0_0_segmentation.png
- tr_0_1_segmentation.png
- validation
- images
- val_0_0.png
- val_0_1.png
- ground_truth
- val_0_0_segmentation.png
- val_0_1_segmentation.png
- subdirectories named training, validation and test (possibly not all present), containing images and ground truth images with the same name of corresponding images but with an additional suffix or with a different extension.
- dataset_name
- training
- tr_0_0.png
- tr_0_1.png
- tr_0_0_segmentation.png
- tr_0_1_segmentation.png
- validation
- val_0_0.png
- val_0_1.png
- val_0_0_segmentation.png
- val_0_1_segmentation.png
- subdirectories named images containing the images and ground_truth containing ground truth images with the same name and extension of corresponding images.
- dataset_name
- images
- tr_0_0.png
- tr_0_1.png
- ground_truth
- tr_0_0.png
- tr_0_1.png
- subdirectories named images containing the images and ground_truth containing ground truth images with the same name of corresponding images but with an additional suffix or with a different extension.
- dataset_name
- images
- tr_0_0.png
- tr_0_1.png
- ground_truth
- tr_0_0_segmentation.png
- tr_0_1_segmentation.png
- images and ground truth images with the same name of corresponding images but with an additional suffix or with a different extension.
- dataset_name
- img_0_0.png
- img_0_1.png
- img_0_0_segmentation.png
- img_0_1_segmentation.png
- In all the previous cases, an additional ground truth image can be used by all images which don't have their own ground truth. The name of this image must be specified in the constructor.
- dataset_name
- training
- images
- tr_0_0.png
- tr_0_1.png
- tr_0_2.png
- tr_0_3.png
- ground_truth
- tr_0_0.png
- tr_0_1.png
- generic.png
- validation
- images
- val_0_0.png
- val_0_1.png
- val_0_2.png
- val_0_3.png
- ground_truth
- val_0_0.png
- val_0_1.png
- generic.png
- dataset_name
- img_0_0.png
- img_0_1.png
- img_0_2.png
- img_0_3.png
- img_0_0_segmentation.png
- img_0_1_segmentation.png
- generic.png
In 2, 3, 5, 6, suffix or extension must be specified when calling the constructor (see Example). In 4, 5, 6, no splits will be added to the dataset.
#include "ecvl/dataset_generator.h"
using namespace ecvl;
int main()
{
// Images and ground truth with same name and extension
GenerateSegmentationDataset segm_dataset("/path/to/dataset_root");
// Images and ground truth with same name but with a suffix
GenerateSegmentationDataset segm_dataset_2("/path/to/dataset_root", "_segmentation.png");
// Images and ground truth with different extension
GenerateSegmentationDataset segm_dataset_3("/path/to/dataset_root", ".png");
// Images and ground truth with different extension; several images share the same ground truth (generic.png).
GenerateSegmentationDataset segm_dataset_4("/path/to/dataset_root", ".png", "generic.png");
// Images and ground truth with same extension; several images share the same ground truth (generic.png).
GenerateSegmentationDataset segm_dataset_5("/path/to/dataset_root", "", "generic.png");
Dataset d = segm_dataset.GetDataset();
d.Dump("/path/to/dataset.yml");
return 0;
}