def give_inaturalist_datasets(opt):
    """
    This function generates a training, testing and evaluation dataloader for Metric Learning on the Inaturalist 2018 dataset.
    For Metric Learning, training and test sets are provided by given json files. Will define a train and test split
    So no random shuffling of classes.

    Args:
        opt: argparse.Namespace, contains all traininig-specific parameters.
    Returns:
        dict of PyTorch datasets for training, testing and evaluation.
    """
    # Load text-files containing classes and imagepaths.
    # Generate image_dicts of shape {class_idx:[list of paths to images belong to this class] ...}
    train_image_dict, val_image_dict, test_image_dict = {}, {}, {}
    with open(os.path.join(opt.source_path, opt.trainset)) as f:
        FileLines = f.readlines()
        FileLines = [x.strip() for x in FileLines]

        for entry in FileLines:
            info = entry.split("/")
            if "/".join([info[-3], info[-2]]) not in train_image_dict:
                train_image_dict["/".join([info[-3], info[-2]])] = []
            train_image_dict["/".join([info[-3], info[-2]])].append(
                os.path.join(opt.source_path, entry)
            )

    with open(os.path.join(opt.source_path, opt.testset)) as f:
        FileLines = f.readlines()
        FileLines = [x.strip() for x in FileLines]

        for entry in FileLines:
            info = entry.split("/")
            if "/".join([info[-3], info[-2]]) not in val_image_dict:
                val_image_dict["/".join([info[-3], info[-2]])] = []
            val_image_dict["/".join([info[-3], info[-2]])].append(
                os.path.join(opt.source_path, entry)
            )

    with open(os.path.join(opt.source_path, opt.testset)) as f:
        FileLines = f.readlines()
        FileLines = [x.strip() for x in FileLines]

        for entry in FileLines:
            info = entry.split("/")
            if "/".join([info[-3], info[-2]]) not in test_image_dict:
                test_image_dict["/".join([info[-3], info[-2]])] = []
            test_image_dict["/".join([info[-3], info[-2]])].append(
                os.path.join(opt.source_path, entry)
            )

    new_train_dict = {}
    class_ind_ind = 0
    for cate in train_image_dict:
        new_train_dict["te/%d" % class_ind_ind] = train_image_dict[cate]
        class_ind_ind += 1
    train_image_dict = new_train_dict

    train_dataset = TrainDatasetsmoothap(train_image_dict, opt)

    val_dataset = BaseTripletDataset(val_image_dict, opt, is_validation=True)
    eval_dataset = BaseTripletDataset(test_image_dict, opt, is_validation=True)

    # train_dataset.conversion       = conversion
    # val_dataset.conversion         = conversion
    # eval_dataset.conversion        = conversion

    return {
        "training": train_dataset,
        "testing": val_dataset,
        "evaluation": eval_dataset,
    }

    This function generates a training, testing and evaluation dataloader for Metric Learning on the Inaturalist 2018 dataset.
    For Metric Learning, training and test sets are provided by given json files. Will define a train and test split
    So no random shuffling of classes.

    Args:
        opt: argparse.Namespace, contains all traininig-specific parameters.
    Returns:
        dict of PyTorch datasets for training, testing and evaluation.
    
examples/pytorch/hilander/PSS/Smooth_AP/src/datasets.py