class_docstr: `iNaturalist <https://github.com/visipedia/inat_comp>`_ Dataset.
  
  Args:
      root (string): Root directory of dataset where the image files are stored.
          This class does not require/use annotation files.
      version (string, optional): Which version of the dataset to download/use. One of
          '2017', '2018', '2019', '2021_train', '2021_train_mini', '2021_valid'.
          Default: `2021_train`.
      target_type (string or list, optional): Type of target to use, for 2021 versions, one of:
  
          - ``full``: the full category (species)
          - ``kingdom``: e.g. "Animalia"
          - ``phylum``: e.g. "Arthropoda"
          - ``class``: e.g. "Insecta"
          - ``order``: e.g. "Coleoptera"
          - ``family``: e.g. "Cleridae"
          - ``genus``: e.g. "Trichodes"
  
          for 2017-2019 versions, one of:
  
          - ``full``: the full (numeric) category
          - ``super``: the super category, e.g. "Amphibians"
  
          Can also be a list to output a tuple with all specified target types.
          Defaults to ``full``.
      transform (callable, optional): A function/transform that takes in a PIL image
          and returns a transformed version. E.g, ``transforms.RandomCrop``
      target_transform (callable, optional): A function/transform that takes in the
          target and transforms it.
      download (bool, optional): If true, downloads the dataset from the internet and
          puts it in root directory. If dataset is already downloaded, it is not
          downloaded again.
code: def __init__(
      self,
      root: str,
      version: str = "2021_train",
      target_type: Union[List[str], str] = "full",
      transform: Optional[Callable] = None,
      target_transform: Optional[Callable] = None,
      download: bool = False,
  ) -> None:
      self.version = verify_str_arg(
          version, "version", DATASET_URLS.keys()
      )
  
      super().__init__(
          os.path.join(root, version),
          transform=transform,
          target_transform=target_transform,
      )
  
      os.makedirs(root, exist_ok=True)
      if download:
          self.download()
  
      if not self._check_integrity():
          raise RuntimeError(
              "Dataset not found or corrupted. You can use download=True to download it"
          )
  
      self.all_categories: List[str] = []
  
      # map: category type -> name of category -> index
      self.categories_index: Dict[str, Dict[str, int]] = {}
  
      # list indexed by category id, containing mapping from category type -> index
      self.categories_map: List[Dict[str, int]] = []
  
      if not isinstance(target_type, list):
          target_type = [target_type]
      if self.version[:4] == "2021":
          self.target_type = [
              verify_str_arg(
                  t, "target_type", ("full", *CATEGORIES_2021)
              )
              for t in target_type
          ]
          self._init_2021()
      else:
          self.target_type = [
              verify_str_arg(t, "target_type", ("full", "super"))
              for t in target_type
          ]
          self._init_pre2021()
  
      # index of all files: (full category id, filename)
      self.index: List[Tuple[int, str]] = []
  
      for dir_index, dir_name in enumerate(self.all_categories):
          files = os.listdir(os.path.join(self.root, dir_name))
          for fname in files:
              self.index.append((dir_index, fname))
  
file_path: vision/torchvision/datasets/inaturalist.py
imports: import os
  import os.path
  from typing import Any, Callable, Dict, List, Optional, Tuple, Union
  from PIL import Image
  from .utils import download_and_extract_archive, verify_str_arg
  from .vision import VisionDataset
label_desc: Use image node_id 1 to create a new INaturalist object from inherited base classes: VisionDataset with example: obj = INaturalist(root, version, target_type, transform, target_transform, download)