iirc package¶
Subpackages¶
Submodules¶
iirc.datasets_loader module¶
-
iirc.datasets_loader.
get_lifelong_datasets
(dataset_name: str, dataset_root: str = './data', setup: str = 'IIRC', framework: str = 'PyTorch', tasks_configuration_id: int = 0, essential_transforms_fn: Optional[Callable[[PIL.Image.Image], Any]] = None, augmentation_transforms_fn: Optional[Callable[[PIL.Image.Image], Any]] = None, cache_images: bool = False, joint: bool = False) → Tuple[Dict[str, iirc.lifelong_dataset.base_dataset.BaseDataset], List[List[str]], Dict[str, int]]¶ Get the incremental refinement learning , as well as the tasks (which contains the classes introduced at each task), and the index for each class corresponding to its order of appearance
- Parameters
dataset_name (str) – The name of the dataset, ex: iirc_cifar100
dataset_root (str) – The directory where the dataset is/will be downloaded (default: “./data”)
setup (str) – Class Incremental Learning setup (CIL) or Incremental Implicitly Refined Classification setup (IIRC) (default: IIRC_SETUP)
framework (str) – The framework to be used, whether PyTorch or Tensorflow. use Tensorflow for any numpy based dataloading (default: PYTORCH)
tasks_configuration_id (int) – The configuration id, where each configuration corresponds to a specific tasks and classes order for each dataset. This id starts from 0 for each dataset. Ignore when joint is set to True (default: 0)
essential_transforms_fn (Optional[Callable[[Image.Image], Any]]) – A function that contains the essential transforms (for example, converting a pillow image to a tensor) that should be applied to each image. This function is applied only when the augmentation_transforms_fn is set to None (as in the case of a test set) or inside the disable_augmentations context (default: None)
augmentation_transforms_fn – A function that contains the essential transforms (for example, converting a pillow image to a tensor) and augmentation transforms (for example, applying random cropping) that should be applied to each image. When this function is provided, essential_transforms_fn is not used except inside the disable_augmentations context (default: None)
cache_images (bool) – cache images that belong to the current task in the memory, only applicable when using the image path (default: False)
joint (bool) – provided all the classes in a single task for joint training (default: False)
- Returns
lifelong_datasets (Dict[str, BaseDataset]): a dictionary with the keys corresponding to the four splits (train, intask_validation, posttask_validation, test), and the values containing the dataset object inheriting from BaseDataset for that split.
tasks (List[List[str]]): a list of lists where each inner list contains the set of classes (class names) that will be introduced in that task (example: [[dog, cat, car], [tiger, truck, fish]]).
class_names_to_idx (Dict[str, int]): a dictionary with the class name as key, and the class index as value (example: {“dog”: 0, “cat”: 1, …}).
- Return type
Tuple[Dict[str, BaseDataset], List[List[str]], Dict[str, int]]