super_gradients.training.datasets.detection_datasets package

Submodules

super_gradients.training.datasets.detection_datasets.coco_detection module

class super_gradients.training.datasets.detection_datasets.coco_detection.COCODetectionDataSet(*args, **kwargs)[source]

Bases: Generic[torch.utils.data.dataset.T_co]

COCODetectionDataSet - Detection Data Set Class COCO Data Set

super_gradients.training.datasets.detection_datasets.detection_dataset module

class super_gradients.training.datasets.detection_datasets.detection_dataset.DetectionDataSet(root: str, list_file: str, img_size: int = 416, batch_size: int = 16, augment: bool = False, dataset_hyper_params: Optional[dict] = None, cache_labels: bool = False, cache_images: bool = False, sample_loading_method: str = 'default', collate_fn: Optional[Callable] = None, target_extension: str = '.txt', labels_offset: int = 0, class_inclusion_list=None, all_classes_list=None)[source]

Bases: Generic[torch.utils.data.dataset.T_co]

static mixup(im, labels, im2, labels2)[source]
static sample_post_process(image)[source]
sample_post_process - Normalizes and orders the image to be 3 x img_size x img_size
param image

return

static sample_loader(sample_path: str)[source]
sample_loader - Loads a coco dataset image from path
param sample_path

return

sample_transform(image)[source]
Parameters

image

Returns

static target_loader(target_path: str, class_inclusion_list=None, all_classes_list=None)[source]
coco_target_loader

@param target_path: str, path to target. @param all_classes_list: list(str) containing all the class names or None when subclassing is disabled. @param class_inclusion_list: list(str) containing the subclass names or None when subclassing is disabled.

static target_transform(target, ratio, w, h, pad=None)[source]
Parameters
  • target

  • ratio

  • w

  • h

  • pad

Returns

static exif_size(img)[source]
Parameters

img

Returns

static augment_hsv(img, hgain=0.5, sgain=0.5, vgain=0.5)[source]
Parameters

img

param hgain

param sgain

param vgain

Returns

static letterbox(img, new_shape=(416, 416), color=(128, 128, 128), auto=True, scaleFill=False, scaleup=True, interp=3)tuple[source]

letterbox - Resizes image to a 32-pixel-multiple rectangle :param img: :param new_shape: :param color: :param auto: :param scaleFill: :param scaleup: :param interp: :return:

random_perspective(img, targets=(), degrees=10, translate=0.1, scale=0.1, shear=10, border=0, perspective=0)[source]

random images and labels using a perspective transform

static box_candidates(box1, box2, wh_thr=2, ar_thr=20, area_thr=0.1)[source]
compute candidate boxes
param box1

before augment

param box2

after augment

param wh_thr

wh_thr (pixels)

param ar_thr

aspect_ratio_thr

param area_thr

area_ratio

Returns

load_mosaic(index)[source]
load_mosaic - Load images in mosaic format to improve noise handling while training
param index

return

super_gradients.training.datasets.detection_datasets.pascal_voc_detection module

class super_gradients.training.datasets.detection_datasets.pascal_voc_detection.PascalVOCDetectionDataSet(samples_sub_directory, targets_sub_directory, *args, **kwargs)[source]

Bases: Generic[torch.utils.data.dataset.T_co]

PascalVOC2012DtectionDataSet - Detection Data Set Class pascal_voc Data Set

Module contents

class super_gradients.training.datasets.detection_datasets.DetectionDataSet(root: str, list_file: str, img_size: int = 416, batch_size: int = 16, augment: bool = False, dataset_hyper_params: Optional[dict] = None, cache_labels: bool = False, cache_images: bool = False, sample_loading_method: str = 'default', collate_fn: Optional[Callable] = None, target_extension: str = '.txt', labels_offset: int = 0, class_inclusion_list=None, all_classes_list=None)[source]

Bases: Generic[torch.utils.data.dataset.T_co]

static mixup(im, labels, im2, labels2)[source]
static sample_post_process(image)[source]
sample_post_process - Normalizes and orders the image to be 3 x img_size x img_size
param image

return

static sample_loader(sample_path: str)[source]
sample_loader - Loads a coco dataset image from path
param sample_path

return

sample_transform(image)[source]
Parameters

image

Returns

static target_loader(target_path: str, class_inclusion_list=None, all_classes_list=None)[source]
coco_target_loader

@param target_path: str, path to target. @param all_classes_list: list(str) containing all the class names or None when subclassing is disabled. @param class_inclusion_list: list(str) containing the subclass names or None when subclassing is disabled.

static target_transform(target, ratio, w, h, pad=None)[source]
Parameters
  • target

  • ratio

  • w

  • h

  • pad

Returns

static exif_size(img)[source]
Parameters

img

Returns

static augment_hsv(img, hgain=0.5, sgain=0.5, vgain=0.5)[source]
Parameters

img

param hgain

param sgain

param vgain

Returns

static letterbox(img, new_shape=(416, 416), color=(128, 128, 128), auto=True, scaleFill=False, scaleup=True, interp=3)tuple[source]

letterbox - Resizes image to a 32-pixel-multiple rectangle :param img: :param new_shape: :param color: :param auto: :param scaleFill: :param scaleup: :param interp: :return:

random_perspective(img, targets=(), degrees=10, translate=0.1, scale=0.1, shear=10, border=0, perspective=0)[source]

random images and labels using a perspective transform

static box_candidates(box1, box2, wh_thr=2, ar_thr=20, area_thr=0.1)[source]
compute candidate boxes
param box1

before augment

param box2

after augment

param wh_thr

wh_thr (pixels)

param ar_thr

aspect_ratio_thr

param area_thr

area_ratio

Returns

load_mosaic(index)[source]
load_mosaic - Load images in mosaic format to improve noise handling while training
param index

return

class super_gradients.training.datasets.detection_datasets.COCODetectionDataSet(*args, **kwargs)[source]

Bases: Generic[torch.utils.data.dataset.T_co]

COCODetectionDataSet - Detection Data Set Class COCO Data Set

class super_gradients.training.datasets.detection_datasets.PascalVOCDetectionDataSet(samples_sub_directory, targets_sub_directory, *args, **kwargs)[source]

Bases: Generic[torch.utils.data.dataset.T_co]

PascalVOC2012DtectionDataSet - Detection Data Set Class pascal_voc Data Set