code: def __getitem__(self, index: int) -> Tuple[Any, Any]:
      # Read image
      img, target = self._read_sample(index)
      # Pre-transforms (format conversion at run-time etc.)
      if self._pre_transforms is not None:
          img, target = self._pre_transforms(img, target)
  
      if self.img_transforms is not None:
          # typing issue cf. https://github.com/python/mypy/issues/5485
          img = self.img_transforms(img)
  
      if self.sample_transforms is not None:
          # Conditions to assess it is detection model with multiple classes and avoid confusion with other tasks.
          if (
              isinstance(target, dict)
              and all(
                  isinstance(item, np.ndarray)
                  for item in target.values()
              )
              and set(target.keys())
              != {
                  "boxes",
                  "labels",
              }  # avoid confusion with obj detection target
          ):
              img_transformed = _copy_tensor(img)
              for class_name, bboxes in target.items():
                  (
                      img_transformed,
                      target[class_name],
                  ) = self.sample_transforms(img, bboxes)
              img = img_transformed
          else:
              img, target = self.sample_transforms(img, target)
  
      return img, target
  
file_path: doctr/doctr/datasets/datasets/base.py
imports: import os
  import shutil
  from pathlib import Path
  from typing import Any, Callable, List, Optional, Tuple, Union
  import numpy
  from doctr.io.image import get_img_shape
  from doctr.utils.data import download_from_url
  from ...models.utils import _copy_tensor
label_desc: Use image node_id 4 for calling the _AbstractDataset obj's underlying member method code with example usage: obj.__getitem__(index) and returns: img,  target