class_docstr: LVIS PyTorch Object Detection Dataset
class_docstr_tok: ["LVIS","PyTorch","Object","Detection","Dataset"]
docstr: Creates an instance of the LVIS dataset.
  
  :param root: The directory where the dataset can be found or downloaded.
      Defaults to None, which means that the default location for
      "lvis" will be used.
  :param train: If True, the training set will be returned. If False,
      the test set will be returned.
  :param transform: The transformation to apply to (img, annotations)
      values.
  :param loader: The image loader to use.
  :param download: If True, the dataset will be downloaded if needed.
  :param lvis_api: An instance of the LVIS class (from the lvis-api) to
      use. Defaults to None, which means that annotations will be loaded
      from the annotation json found in the root directory.
  :param img_ids: A list representing a subset of images to use. Defaults
      to None, which means that the dataset will contain all images
      in the LVIS dataset.
docstr_tok: ["Creates","an","instance","of","the","LVIS","dataset",".",":","param","root",":","The","directory","where","the","dataset","can","be","found","or","downloaded",".","Defaults","to","None",",","which","means","that","the","default","location","for","``","lvis","''","will","be","used",".",":","param","train",":","If","True",",","the","training","set","will","be","returned",".","If","False",",","the","test","set","will","be","returned",".",":","param","transform",":","The","transformation","to","apply","to","(","img",",","annotations",")","values",".",":","param","loader",":","The","image","loader","to","use",".",":","param","download",":","If","True",",","the","dataset","will","be","downloaded","if","needed",".",":","param","lvis_api",":","An","instance","of","the","LVIS","class","(","from","the","lvis-api",")","to","use",".","Defaults","to","None",",","which","means","that","annotations","will","be","loaded","from","the","annotation","json","found","in","the","root","directory",".",":","param","img_ids",":","A","list","representing","a","subset","of","images","to","use",".","Defaults","to","None",",","which","means","that","the","dataset","will","contain","all","images","in","the","LVIS","dataset","."]
code: def __init__(
      self,
      root: Optional[Union[str, Path]] = None,
      *,
      train=True,
      transform=None,
      loader=default_loader,
      download=True,
      lvis_api: Optional[LVIS] = None,
      img_ids: Optional[List[int]] = None,
  ):
      """
      Creates an instance of the LVIS dataset.
  
      :param root: The directory where the dataset can be found or downloaded.
          Defaults to None, which means that the default location for
          "lvis" will be used.
      :param train: If True, the training set will be returned. If False,
          the test set will be returned.
      :param transform: The transformation to apply to (img, annotations)
          values.
      :param loader: The image loader to use.
      :param download: If True, the dataset will be downloaded if needed.
      :param lvis_api: An instance of the LVIS class (from the lvis-api) to
          use. Defaults to None, which means that annotations will be loaded
          from the annotation json found in the root directory.
      :param img_ids: A list representing a subset of images to use. Defaults
          to None, which means that the dataset will contain all images
          in the LVIS dataset.
      """
  
      if root is None:
          root = default_dataset_location("lvis")
  
      self.train = train  # training set or test set
      self.transform = transform
      self.loader = loader
      self.bbox_crop = True
      self.img_ids: List[int] = img_ids  # type: ignore
  
      self.targets: LVISDetectionTargets = None  # type: ignore
      self.lvis_api: LVIS = lvis_api  # type: ignore
  
      super(LvisDataset, self).__init__(
          root, download=download, verbose=True
      )
  
      self._load_dataset()
  
imports: from pathlib import Path
  from typing import Optional, Union, List, Sequence
  import torch
  from PIL import Image
  from torchvision.datasets.folder import default_loader
  from torchvision.transforms import ToTensor
  from typing_extensions import TypedDict
  from avalanche.benchmarks.datasets import DownloadableDataset, default_dataset_location
  from avalanche.benchmarks.datasets.lvis_dataset.lvis_data import lvis_archives
label_desc: Use image node_id 1 to create a new LvisDataset object from inherited base classes: DownloadableDataset with example: obj = LvisDataset(root)