deepdisc.model.loaders

Classes

DataMapper

Base class that will map data to the format necessary for the model

DictMapper

Class that will map COCO dictionary data to the format necessary for the model

Functions

trans_shape(instances, transforms)

return_train_loader(cfg, mapper)

Returns a train loader

return_test_loader(cfg, mapper)

Returns a test loader with configurable batch size

return_custom_train_loader(dataset[, batch_size, ...])

Module Contents

trans_shape(instances, transforms)[source]
class DataMapper(imreader=None, key_mapper=None, augmentations=None)[source]

Base class that will map data to the format necessary for the model

To implement a data mapper for a new class, the derived class needs to have an __init__() function that calls super().__init__(*args, **kwargs) and a custom version of map_data().

IR = None[source]
km = None[source]
augmentations = None[source]
map_data(data)[source]
class DictMapper(*args, keypoint_hflip_indices=None, **kwargs)[source]

Bases: DataMapper

Class that will map COCO dictionary data to the format necessary for the model

keypoint_hflip_indices = None[source]
map_data(dataset_dict)[source]

Map COCO dict data to the correct format

Parameters:

dataset_dict (dict) – a dictionary of COCO formatted metadata

Return type:

reformatted dictionary including image and instances

return_train_loader(cfg, mapper)[source]

Returns a train loader

Parameters:
  • cfg (LazyConfig) – The lazy config, which contains data loader config values

  • functionality (**kwargs for the read_image)

Return type:

a train loader

return_test_loader(cfg, mapper)[source]

Returns a test loader with configurable batch size

Parameters:
  • cfg (LazyConfig) – The lazy config, which contains data loader config values including batch size and num_workers

  • functionality (**kwargs for the read_image)

Return type:

a test loader

return_custom_train_loader(dataset, batch_size=4, distributed=False)[source]