def do_camelyon16(): """ camelyon16. The train/valid/test sets are already provided. :return: """ # =============== # Reproducibility # =============== # =========================== reproducibility.init_seed() # =========================== ds = constants.CAM16 announce_msg("Processing dataset: {}".format(ds)) args = { "baseurl": get_rootpath_2_dataset(Dict2Obj({'dataset': ds})), "dataset": ds, "fold_folder": "folds/{}".format(ds), "img_extension": "jpg", "path_encoding": "folds/{}/encoding-origine.yaml".format(ds) } # Convert masks into binary masks: already done. # create_bin_mask_Oxford_flowers_102(Dict2Obj(args)) reproducibility.init_seed() al_split_camelyon16(Dict2Obj(args))
def do_Oxford_flowers_102(): """ Oxford-flowers-102. The train/valid/test sets are already provided. :return: """ # =============== # Reproducibility # =============== # =========================== reproducibility.init_seed() # =========================== announce_msg("Processing dataset: {}".format(constants.OXF)) args = { "baseurl": get_rootpath_2_dataset(Dict2Obj({'dataset': constants.OXF})), "dataset": "Oxford-flowers-102", "fold_folder": "folds/Oxford-flowers-102", "img_extension": "jpg", "path_encoding": "folds/Oxford-flowers-102/encoding-origine.yaml" } # Convert masks into binary masks: already done. # create_bin_mask_Oxford_flowers_102(Dict2Obj(args)) reproducibility.init_seed() al_split_Oxford_flowers_102(Dict2Obj(args)) get_stats(Dict2Obj(args), split=0, fold=0, subset='train')
def do_glas(): """ GlaS. :return: """ # =============== # Reproducibility # =============== reproducibility.init_seed() announce_msg("Processing dataset: {}".format(constants.GLAS)) args = { "baseurl": get_rootpath_2_dataset(Dict2Obj({'dataset': constants.GLAS})), "folding": { "vl": 20 }, # 80 % for train, 20% for validation. "dataset": "glas", "fold_folder": "folds/glas", "img_extension": "bmp", # nbr_splits: how many times to perform the k-folds over # the available train samples. "nbr_splits": 1 } args["nbr_folds"] = math.ceil(100. / args["folding"]["vl"]) reproducibility.init_seed() al_split_glas(Dict2Obj(args)) get_stats(Dict2Obj(args), split=0, fold=0, subset='train')
def parse_input(): """ Parse the input. and initialize some modules for reproducibility. """ parser = argparse.ArgumentParser() # mandatory: --yaml basefilename parser.add_argument("--yaml", type=str, help="yaml configuration basefile.") input_args, _ = parser.parse_known_args() args, args_dict = get_yaml_args(input_args) # Reproducibility control: this will use the seed in `os.environ['MYSEED']`. reproducibility.init_seed() # todo: remove input_args. useless. can be accessed from args. return args, args_dict, input_args
def do_Caltech_UCSD_Birds_200_2011(): """ Caltech-UCSD-Birds-200-2011. :return: """ # =============== # Reproducibility # =============== # =========================== reproducibility.init_seed() # =========================== announce_msg("Processing dataset: {}".format(constants.CUB)) args = { "baseurl": get_rootpath_2_dataset(Dict2Obj({'dataset': constants.CUB})), "folding": { "vl": 20 }, # 80 % for train, 20% for validation. "dataset": "Caltech-UCSD-Birds-200-2011", "fold_folder": "folds/Caltech-UCSD-Birds-200-2011", "img_extension": "bmp", "nbr_splits": 1, # how many times to perform the k-folds over # the available train samples. "path_encoding": "folds/Caltech-UCSD-Birds-200-2011/encoding-origine.yaml", "nbr_classes": None # Keep only 5 random classes. If you want # to use the entire dataset, set this to None. } args["nbr_folds"] = math.ceil(100. / args["folding"]["vl"]) reproducibility.init_seed() al_split_Caltech_UCSD_Birds_200_2011(Dict2Obj(args)) get_stats(Dict2Obj(args), split=0, fold=0, subset='train')
# args.num_workers * this_factor. Useful when setting set_for_eval to False, # batch size =1. FACTOR_MUL_WORKERS = 2 # and we are in an evaluation mode (to go faster and coop with the lag # between the CPU and GPU). # Can be activated only for "Caltech-UCSD-Birds-200-2011" or # "Oxford-flowers-102" DEBUG_MODE = False # dataset to go fast. If True, we select only few samples for training # , validation, and test. PLOT_STATS = True # use the default seed. Copy the see into the os.environ("MYSEED") reproducibility.init_seed() NBRGPUS = torch.cuda.device_count() ALLOW_MULTIGPUS = check_if_allow_multgpu_mode() def _init_fn(worker_id): """ Init. function for the worker in dataloader. :param worker_id: :return: """ pass # no longer necessary since we override the process seed.