class_docstr: ImageNet dataset.
class_docstr_tok: ["ImageNet","dataset","."]
code: def __init__(self, cfg, mode, num_retries=10):
      self.num_retries = num_retries
      self.cfg = cfg
      self.mode = mode
      self.data_path = cfg.DATA.PATH_TO_DATA_DIR
      assert mode in [
          "train",
          "val",
          "test",
      ], "Split '{}' not supported for ImageNet".format(mode)
      logger.info("Constructing ImageNet {}...".format(mode))
      if cfg.DATA.PATH_TO_PRELOAD_IMDB == "":
          self._construct_imdb()
      else:
          self._load_imdb()
      self.num_videos = len(self._imdb)
      self.feat_size, self.feat_stride = calc_mvit_feature_geometry(cfg)
      self.dummy_output = None
  
imports: import json
  import numpy
  import os
  import random
  import re
  import torch
  import torch.utils.data
  from PIL import Image
  from torchvision import transforms
  import slowfast.datasets.transform
  import slowfast.utils.logging
  from slowfast.models.utils import calc_mvit_feature_geometry
  from slowfast.utils.env import pathmgr
  from .build import DATASET_REGISTRY
  from .transform import MaskingGenerator, transforms_imagenet_train
label_desc: Use image node_id 1 to create a new Imagenet object from inherited base classes: torch.utils.data with example: obj = Imagenet(cfg, mode, num_retries)