data.datasets.multi_modal_img_text.zero_shot package

Submodules

data.datasets.multi_modal_img_text.zero_shot.base_zero_shot module

class data.datasets.multi_modal_img_text.zero_shot.base_zero_shot.BaseZeroShotDataset(opts: Namespace, *args, **kwargs)[source]

Bases: object

Base Dataset class for zero shot tasks.

Parameters:

opts – Command-line arguments.

__init__(opts: Namespace, *args, **kwargs) None[source]
classmethod add_arguments(parser: ArgumentParser) ArgumentParser[source]
classmethod class_names() List[str][source]

Return the name of the classes in the dataset. Label is index in the list.

The order of class names in the returned list determine the numerical class label.

static generate_text_prompts(class_name: str) List[str][source]

Return a list of prompts for the given class name.

data.datasets.multi_modal_img_text.zero_shot.imagenet module

class data.datasets.multi_modal_img_text.zero_shot.imagenet.ImageNetDatasetZeroShot(opts: Namespace, *args, **kwargs)[source]

Bases: BaseZeroShotDataset, ImageFolder

ImageNet Dataset for zero-shot evaluation of Image-text models.

Parameters:

opts – Command-line arguments

__init__(opts: Namespace, *args, **kwargs) None[source]
classmethod class_names() List[str][source]

Return the name of the classes present in the dataset.

static generate_text_prompts(class_name: str) List[str][source]

Return a list of prompts for the given class name.

data.datasets.multi_modal_img_text.zero_shot.imagenet_class_names module

data.datasets.multi_modal_img_text.zero_shot.templates module

data.datasets.multi_modal_img_text.zero_shot.templates.generate_text_prompts_clip(class_name) List[str][source]

Return a list of prompts for the given class name.

Module contents

data.datasets.multi_modal_img_text.zero_shot.arguments_zero_shot_dataset(parser: ArgumentParser) ArgumentParser[source]

Helper function to get zero-shot dataset arguments

data.datasets.multi_modal_img_text.zero_shot.build_zero_shot_dataset(opts, *args, **kwargs) BaseZeroShotDataset[source]

Helper function to build the zero shot datasets