|
| 1 | +# Object Detection 2D Datasets |
| 2 | + |
| 3 | +## Base Classes |
| 4 | + |
| 5 | +### DetectionDataset base class |
| 6 | + |
| 7 | +Bases: `engine.datasets.DatasetIterator` |
| 8 | + |
| 9 | +The *DetectionDataset* class inherits from the *DatasetIterator* class and extends it with functions and properties aimed at 2d Object Detection datasets. Each *DetectionDataset* object must be initialized with the following parameters: |
| 10 | + |
| 11 | +- **classes**: *list*\ |
| 12 | + List of class names of the training dataset. |
| 13 | +- **dataset_type**: *str*\ |
| 14 | + Dataset type, i`.e., an assigned name. |
| 15 | +- **root**: *str*\ |
| 16 | + Path to dataset root directory. |
| 17 | +- **image_paths**: *list, default=None*\ |
| 18 | + List of image data paths. |
| 19 | +- **splits**: *str, default=''*\ |
| 20 | + List of dataset splits to load (e.g., train/val). |
| 21 | +- **image_transform**: *callable object, default=None*\ |
| 22 | + Transformation to apply to images. Intended for image format transformations. |
| 23 | +- **target_transform**: *callable object, default=None*\ |
| 24 | + Transformation to apply to bounding boxes. Intended for formatting the bounding boxes for each detector. |
| 25 | +- **transform**: *callable object, default=None*\ |
| 26 | + Transformation to apply to both images and bounding boxes. Intended for data augmentation purposes. |
| 27 | + |
| 28 | +Methods: |
| 29 | + |
| 30 | +#### `DetectionDataset.set_transform` |
| 31 | +Setter for the internal **transform** object/function. |
| 32 | + |
| 33 | +#### `DetectionDataset.set_image_transform` |
| 34 | +Setter for the internal **image_transform** object/function. |
| 35 | + |
| 36 | +#### `DetectionDataset.set_target_transform` |
| 37 | +Setter for the internal **target_transform** object/function. |
| 38 | + |
| 39 | +#### `DetectionDataset.transform` |
| 40 | +Returns the `DetectionDataset` wrapped as a `MappedDetectionDataset`, where the data is transformed according to the argument callable object/function. This function ensures fit/eval compatibility between `DetectionDataset` and `ExternalDataset` for [GluonCV](https://github.com/dmlc/gluon-cv) based detectors. |
| 41 | + |
| 42 | +#### `DetectionDataset.get_image` |
| 43 | +Returns an image from the dataset. Intended for test sets without annotations. |
| 44 | + |
| 45 | +#### `DetectionDataset.get_bboxes` |
| 46 | +Returns the bounding boxes for a given sample. |
| 47 | + |
| 48 | + |
| 49 | +### MappedDetectionDataset class |
| 50 | + |
| 51 | +Bases: `engine.datasets.DatasetIterator` |
| 52 | + |
| 53 | +This class wraps any `DetectionDataset` and applies `map_function` to the data. |
| 54 | + |
| 55 | +### ConcatDataset class |
| 56 | + |
| 57 | +Bases: `perception.object_detection_2d.datasets.DetetionDataset` |
| 58 | + |
| 59 | +Returns a new `DetectionDataset` which is a concatenation of the `datasets` param. The datasets are assumed to have the same classes. |
| 60 | + |
| 61 | +### XMLBasedDataset class |
| 62 | + |
| 63 | +Bases: `perception.object_detection_2d.datasets.DetetionDataset` |
| 64 | + |
| 65 | +This class is intended for any dataset in PASCAL VOC .xml format, making it compatible with datasets annotated using the [labelImg](https://github.com/tzutalin/labelImg) tool. Each *XMLBasedDataset* object must be initialized with the following parameters: |
| 66 | + |
| 67 | +- **dataset_type**: *str*\ |
| 68 | + Dataset type, i.e., assigned name. |
| 69 | +- **root**: *str*\ |
| 70 | + Path to dataset root directory. |
| 71 | +- **classes**: *list, default=None*\ |
| 72 | + Class names. If None, they will be inferred from the annotations. |
| 73 | +- **splits**: *str, default=''*\ |
| 74 | + List of dataset splits to load (e.g., train/val). |
| 75 | +- **image_transform**: *callable object, default=None*\ |
| 76 | + Transformation to apply to images. Intended for image format transformations. |
| 77 | +- **target_transform**: *callable object, default=None*\ |
| 78 | + Transformation to apply to bounding boxes. Intended for formatting the bounding boxes for each detector. |
| 79 | +- **transform**: *callable object, default=None*\ |
| 80 | + Transformation to apply to both images and bounding boxes. Intended for data augmentation purposes. |
| 81 | +- **images_dir**: *str, default='images'*\ |
| 82 | + Name of subdirectory containing dataset images. |
| 83 | +- **annotations_dir**: *str, default='annotations'*\ |
| 84 | + Name of subdirectory containing dataset annotations. |
| 85 | +- **preload_anno**: *bool, default=False*\ |
| 86 | + Whether to preload annotations, for datasets that fit in memory. |
| 87 | + |
0 commit comments