code: def __init__(
      self,
      root: str,
      split: str,
      input_size,
      local_cache_path=None,
      shuffle=True,
      key="imgs",
      beit_transforms=False,
      target_transform=False,
      no_transform=False,
      compute_mask=False,
      patch_size: int = 16,
      mask_prob: float = 0.75,
      mask_prob_adjust: float = 0,
      mask_length: int = 1,
      inverse_mask: bool = False,
      expand_adjacent: bool = False,
      mask_dropout: float = 0,
      non_overlapping: bool = False,
      require_same_masks: bool = True,
      clone_batch: int = 1,
      dataset_type: str = "imagefolder",
  ):
      FairseqDataset.__init__(self)
  
      self.shuffle = shuffle
      self.key = key
  
      loader = caching_loader(
          local_cache_path, datasets.folder.default_loader
      )
  
      self.transform_source = None
      self.transform_target = None
  
      if target_transform:
          self.transform_source = transforms.ColorJitter(0.4, 0.4, 0.4)
          self.transform_target = transforms.ColorJitter(0.4, 0.4, 0.4)
  
      if no_transform:
          if input_size <= 224:
              crop_pct = 224 / 256
          else:
              crop_pct = 1.0
          size = int(input_size / crop_pct)
  
          self.transform_train = transforms.Compose(
              [
                  transforms.Resize(size, interpolation=3),
                  transforms.CenterCrop(input_size),
              ]
          )
  
          self.transform_train = transforms.Resize(
              (input_size, input_size)
          )
      elif beit_transforms:
          beit_transform_list = []
          if not target_transform:
              beit_transform_list.append(
                  transforms.ColorJitter(0.4, 0.4, 0.4)
              )
          beit_transform_list.extend(
              [
                  transforms.RandomHorizontalFlip(p=0.5),
                  RandomResizedCropAndInterpolationWithTwoPic(
                      size=input_size,
                      second_size=None,
                      interpolation="bicubic",
                      second_interpolation=None,
                  ),
              ]
          )
          self.transform_train = transforms.Compose(beit_transform_list)
      else:
          self.transform_train = transforms.Compose(
              [
                  transforms.RandomResizedCrop(
                      input_size, scale=(0.2, 1.0), interpolation=3
                  ),  # 3 is bicubic
                  transforms.RandomHorizontalFlip(),
              ]
          )
      self.final_transform = transforms.Compose(
          [
              transforms.ToTensor(),
              transforms.Normalize(
                  mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]
              ),
          ]
      )
  
      if dataset_type == "imagefolder":
          self.dataset = datasets.ImageFolder(
              os.path.join(root, split), loader=loader
          )
      elif dataset_type == "path":
          self.dataset = PathDataset(
              root,
              loader,
              None,
              None,
              mean=[0.485, 0.456, 0.406],
              std=[0.229, 0.224, 0.225],
          )
      else:
          raise Exception(f"invalid dataset type {dataset_type}")
  
      logger.info(
          f"initial transform: {self.transform_train}, "
          f"source transform: {self.transform_source}, "
          f"target transform: {self.transform_target}, "
          f"final transform: {self.final_transform}"
      )
      logger.info(f"loaded {len(self.dataset)} examples")
  
      self.is_compute_mask = compute_mask
      self.patches = (input_size // patch_size) ** 2
      self.mask_prob = mask_prob
      self.mask_prob_adjust = mask_prob_adjust
      self.mask_length = mask_length
      self.inverse_mask = inverse_mask
      self.expand_adjacent = expand_adjacent
      self.mask_dropout = mask_dropout
      self.non_overlapping = non_overlapping
      self.require_same_masks = require_same_masks
      self.clone_batch = clone_batch
  
imports: from functools import partial
  import logging
  import math
  import random
  import time
  import numpy
  import os
  import torch
  from torchvision import datasets, transforms
  from .path_dataset import PathDataset
  from fairseq.data import FairseqDataset
  from fairseq.data.data_utils import compute_block_mask_1d, compute_block_mask_2d
  from shutil import copyfile
label_desc: Use image node_id 1 to create a new MaeImageDataset object from inherited base classes: FairseqDataset with example: obj = MaeImageDataset(root, split, input_size, local_cache_path, shuffle, key, beit_transforms, target_transform, no_transform, compute_mask, patch_size, mask_prob, mask_prob_adjust, mask_length, inverse_mask, expand_adjacent, mask_dropout, non_overlapping, require_same_masks, clone_batch, dataset_type)