Segmentation

class adelecv.api.data.segmentations.SegmentationDataset(dataset_dir, dataset_type, img_size, split=(0.7, 0.2, 0.1), batch_size=16)[source]

A class for storing a dataset, its parameters, fiftyone sessions and partitioning for training.

Parameters:
  • dataset_dir (str) – Path to dataset

  • dataset_type (DatasetType) – DatasetType inheritor class, which implements a method for converting the output of the dataset format into an internal one

  • img_size (tuple[int, int]) – image size for resize (height, width)

  • split (tuple[float, float, float]) – percentage of splitting the dataset into train val test

  • batch_size (int) – batch size for pytorch dataloader

adelecv.api.data.segmentations.get_segmentations_dataset_types()[source]

Get formats of datasets

Returns:

List of available dataset formats.

Return type:

list[str]

class adelecv.api.data.segmentations.types.DatasetType[source]

Base class for the dataset conversion class to an internal format.

Each class must implement method create_dataset, in which the fiftyone dataset is created.

There should be a field for each sample:

  • semantic - mask with normalized values (mask / 255).

  • default_mask_targets - mappings for classes (0 - background, 1 - cat, e.g.).

class adelecv.api.data.segmentations.types.COCOSegmentation[source]

Convert from COCO dataset

static create_dataset(dataset_dir)[source]

Create fiftyone segmentation dataset from Coco

Parameters:

dataset_dir (str) – Path to dataset

Returns:

fo.Dataset with sample semantic (mask / 255) and class mapping

Return type:

fiftyone.Dataset

class adelecv.api.data.segmentations.types.ImageMask[source]

Convert from Image and Mask folder.

Example dataset.

.

|– image

|—– 0.jpg

|—– 1.jpg

|– mask

|—– 0.jpg

|—– 1.jpg

static create_dataset(dataset_dir)[source]

Create fiftyone segmentation dataset from custom format

Parameters:

dataset_dir (str) – Path to dataset

Returns:

fo.Dataset with sample semantic (mask / 255) and class mapping

Return type:

fiftyone.Dataset