domainlab.dsets package¶
Submodules¶
domainlab.dsets.a_dset_mnist_color_rgb_solo module¶
Color MNIST with single color
- class domainlab.dsets.a_dset_mnist_color_rgb_solo.ADsetMNISTColorRGBSolo(ind_color, path='zoutput', subset_step=100, color_scheme='both', label_transform=<function mk_fun_label2onehot.<locals>.fun_label2onehot>, list_transforms=None, raw_split='train', flag_rand_color=False)[source]¶
Bases:
Dataset
Color MNIST with single color 1. nominal domains: color palettes/range/spectrum 2. subdomains: color(foreground, background) 3. structure: each subdomain contains a combination of foreground+background color
domainlab.dsets.dset_img_path_list module¶
domainlab.dsets.dset_mnist_color_solo_default module¶
- class domainlab.dsets.dset_mnist_color_solo_default.DsetMNISTColorSoloDefault(ind_color, path='zoutput', subset_step=100, color_scheme='both', label_transform=<function mk_fun_label2onehot.<locals>.fun_label2onehot>, list_transforms=None, raw_split='train', flag_rand_color=False)[source]¶
Bases:
ADsetMNISTColorRGBSolo
- property palette¶
domainlab.dsets.dset_poly_domains_mnist_color_default module¶
merge several solo-color mnist to form a mixed dataset
- class domainlab.dsets.dset_poly_domains_mnist_color_default.DsetMNISTColorMix(n_domains, path, color_scheme='both')[source]¶
Bases:
Dataset
merge several solo-color mnist to form a mixed dataset
- class domainlab.dsets.dset_poly_domains_mnist_color_default.DsetMNISTColorMixNoDomainLabel(n_domains, path, color_scheme='both')[source]¶
Bases:
DsetMNISTColorMix
domainlab.dsets.dset_subfolder module¶
https://github.com/pytorch/vision/blob/bb5af1d77658133af8be8c9b1a13139722315c3a/torchvision/datasets/folder.py#L93 https://pytorch.org/vision/stable/_modules/torchvision/datasets/folder.html#DatasetFolder.fetch_img_paths
- class domainlab.dsets.dset_subfolder.DsetSubFolder(root, loader, list_class_dir, extensions=None, transform=None, target_transform=None, is_valid_file=None)[source]¶
Bases:
DatasetFolder
Only use user provided class names, ignore the other subfolders :param list_class_dir: list of class directories to use as classes
- domainlab.dsets.dset_subfolder.fetch_img_paths(path_dir, class_to_idx, extensions=None, is_valid_file=None)[source]¶
- Parameters:
path_dir – path to fetch images in string format
class_to_idx – given list of strings as class names
{classes[i]: i for i in range(len(classes))} :param extensions: file extensions in fstring format :param is_valid_file: user provided function to check if the file is valid or not :return : list_tuple_path_cls_ind: list of tuple, (path of file, class index)
- domainlab.dsets.dset_subfolder.has_file_allowed_extension(filename: str, extensions: Tuple[str, ...]) bool [source]¶
Checks if a file is an allowed extension. Args: filename (string): path to a file extensions (tuple of strings): extensions to consider (lowercase) Returns: bool: True if the filename ends with one of given extensions
domainlab.dsets.utils_color_palette module¶
domainlab.dsets.utils_data module¶
Utilities for dataset
- class domainlab.dsets.utils_data.DsetInMemDecorator(dset, name=None)[source]¶
Bases:
Dataset
fetch all items of a dataset into memory
domainlab.dsets.utils_wrapdset_patches module¶
upon a task, if Jigen is chosen as the model, then task’s dataset has to be decorated with image tile permutation note that task’s dataset already include standard image transformations like random croped resized, or flip, and normalization. See also the JiGen paper’s implementation here: https://github.com/fmcarlucci/JigenDG/blob/master/data/JigsawLoader.py