timm documentation

Data

Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

Data

timm.data.create_dataset

< >

( name: str root: Optional = None split: str = 'validation' search_split: bool = True class_map: dict = None load_bytes: bool = False is_training: bool = False download: bool = False batch_size: int = 1 num_samples: Optional = None seed: int = 42 repeats: int = 0 input_img_mode: str = 'RGB' **kwargs )

Dataset factory method

In parentheses after each arg are the type of dataset supported for each arg, one of:

  • folder - default, timm folder (or tar) based ImageDataset
  • torch - torchvision based datasets
  • HFDS - Hugging Face Datasets
  • TFDS - Tensorflow-datasets wrapper in IterabeDataset interface via IterableImageDataset
  • WDS - Webdataset
  • all - any of the above

timm.data.create_loader

< >

( dataset: Union input_size: Union batch_size: int is_training: bool = False no_aug: bool = False re_prob: float = 0.0 re_mode: str = 'const' re_count: int = 1 re_split: bool = False train_crop_mode: Optional = None scale: Optional = None ratio: Optional = None hflip: float = 0.5 vflip: float = 0.0 color_jitter: float = 0.4 color_jitter_prob: Optional = None grayscale_prob: float = 0.0 gaussian_blur_prob: float = 0.0 auto_augment: Optional = None num_aug_repeats: int = 0 num_aug_splits: int = 0 interpolation: str = 'bilinear' mean: Tuple = (0.485, 0.456, 0.406) std: Tuple = (0.229, 0.224, 0.225) num_workers: int = 1 distributed: bool = False crop_pct: Optional = None crop_mode: Optional = None crop_border_pixels: Optional = None collate_fn: Optional = None pin_memory: bool = False fp16: bool = False img_dtype: dtype = torch.float32 device: device = device(type='cuda') use_prefetcher: bool = True use_multi_epochs_loader: bool = False persistent_workers: bool = True worker_seeding: str = 'all' tf_preprocessing: bool = False )

timm.data.create_transform

< >

( input_size: Union = 224 is_training: bool = False no_aug: bool = False train_crop_mode: Optional = None scale: Optional = None ratio: Optional = None hflip: float = 0.5 vflip: float = 0.0 color_jitter: Union = 0.4 color_jitter_prob: Optional = None grayscale_prob: float = 0.0 gaussian_blur_prob: float = 0.0 auto_augment: Optional = None interpolation: str = 'bilinear' mean: Tuple = (0.485, 0.456, 0.406) std: Tuple = (0.229, 0.224, 0.225) re_prob: float = 0.0 re_mode: str = 'const' re_count: int = 1 re_num_splits: int = 0 crop_pct: Optional = None crop_mode: Optional = None crop_border_pixels: Optional = None tf_preprocessing: bool = False use_prefetcher: bool = False separate: bool = False )

timm.data.resolve_data_config

< >

( args = None pretrained_cfg = None model = None use_test_size = False verbose = False )