class_docstr: ImageNet dataset.
class_docstr_tok: ["ImageNet","dataset","."]
docstr: Constructs the imdb.
docstr_tok: ["Constructs","the","imdb","."]
code: def _construct_imdb(self):
      """Constructs the imdb."""
      # Compile the split data path
      split_path = os.path.join(self.data_path, self.mode)
      logger.info("{} data path: {}".format(self.mode, split_path))
      # Images are stored per class in subdirs (format: n<number>)
      split_files = pathmgr.ls(split_path)
      self._class_ids = sorted(
          f for f in split_files if re.match(r"^n[0-9]+$", f)
      )
      # Map ImageNet class ids to contiguous ids
      self._class_id_cont_id = {
          v: i for i, v in enumerate(self._class_ids)
      }
      # Construct the image db
      self._imdb = []
      for class_id in self._class_ids:
          cont_id = self._class_id_cont_id[class_id]
          im_dir = os.path.join(split_path, class_id)
          for im_name in pathmgr.ls(im_dir):
              im_path = os.path.join(im_dir, im_name)
              self._imdb.append({"im_path": im_path, "class": cont_id})
      logger.info("Number of images: {}".format(len(self._imdb)))
      logger.info("Number of classes: {}".format(len(self._class_ids)))
  
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 3 for calling the Imagenet obj's underlying member method code with example usage: obj._construct_imdb() without return types