class_docstr: Stream-51 Pytorch Dataset
docstr: Args:
      index (int): Index
  
  Returns:
      tuple: (sample, target) where target is class_index of the target
      class.
docstr_tok: ["Args",":","index","(","int",")",":","Index","Returns",":","tuple",":","(","sample",",","target",")","where","target","is","class_index","of","the","target","class","."]
code: def __getitem__(self, index):
      """
      Args:
          index (int): Index
  
      Returns:
          tuple: (sample, target) where target is class_index of the target
          class.
      """
      fpath, target = self.samples[index][-1], self.targets[index]
      sample = self.loader(str(self.root / fpath))
      if self.bbox_crop:
          bbox = self.samples[index][-2]
          cw = bbox[0] - bbox[1]
          ch = bbox[2] - bbox[3]
          center = [int(bbox[1] + cw / 2), int(bbox[3] + ch / 2)]
          bbox = [
              min(
                  [
                      int(center[0] + (cw * self.ratio / 2)),
                      sample.size[0],
                  ]
              ),
              max([int(center[0] - (cw * self.ratio / 2)), 0]),
              min(
                  [
                      int(center[1] + (ch * self.ratio / 2)),
                      sample.size[1],
                  ]
              ),
              max([int(center[1] - (ch * self.ratio / 2)), 0]),
          ]
          sample = sample.crop((bbox[1], bbox[3], bbox[0], bbox[2]))
  
      if self.transform is not None:
          sample = self.transform(sample)
      if self.target_transform is not None:
          target = self.target_transform(target)
  
      return sample, target
  
imports: import os
  import shutil
  import json
  import random
  from pathlib import Path
  from typing import Any, List, Optional, Sequence, Tuple, TypeVar, Union
  from torchvision.datasets.folder import default_loader
  from zipfile import ZipFile
  from torchvision.transforms import ToTensor
  from avalanche.benchmarks.datasets import DownloadableDataset, default_dataset_location
  from avalanche.benchmarks.datasets.stream51 import stream51_data
label_desc: Use image node_id 8 for calling the Stream51 obj's underlying member method code with example usage: obj.__getitem__(index) and returns: sample,  target