class_docstr: Implements an abstract dataset
  
  Args:
  ----
      url: URL of the dataset
      file_name: name of the file once downloaded
      file_hash: expected SHA256 of the file
      extract_archive: whether the downloaded file is an archive to be extracted
      download: whether the dataset should be downloaded if not present on disk
      overwrite: whether the archive should be re-extracted
      cache_dir: cache directory
      cache_subdir: subfolder to use in the cache
class_docstr_tok: ["Implements","an","abstract","dataset","Args",":","--","--","url",":","URL","of","the","dataset","file_name",":","name","of","the","file","once","downloaded","file_hash",":","expected","SHA256","of","the","file","extract_archive",":","whether","the","downloaded","file","is","an","archive","to","be","extracted","download",":","whether","the","dataset","should","be","downloaded","if","not","present","on","disk","overwrite",":","whether","the","archive","should","be","re-extracted","cache_dir",":","cache","directory","cache_subdir",":","subfolder","to","use","in","the","cache"]
code: def __init__(
      self,
      url: str,
      file_name: Optional[str] = None,
      file_hash: Optional[str] = None,
      extract_archive: bool = False,
      download: bool = False,
      overwrite: bool = False,
      cache_dir: Optional[str] = None,
      cache_subdir: Optional[str] = None,
      **kwargs: Any,
  ) -> None:
      cache_dir = (
          str(
              os.environ.get(
                  "DOCTR_CACHE_DIR",
                  os.path.join(
                      os.path.expanduser("~"), ".cache", "doctr"
                  ),
              )
          )
          if cache_dir is None
          else cache_dir
      )
  
      cache_subdir = (
          "datasets" if cache_subdir is None else cache_subdir
      )
  
      file_name = (
          file_name
          if isinstance(file_name, str)
          else os.path.basename(url)
      )
      # Download the file if not present
      archive_path: Union[str, Path] = os.path.join(
          cache_dir, cache_subdir, file_name
      )
  
      if not os.path.exists(archive_path) and not download:
          raise ValueError(
              "the dataset needs to be downloaded first with download=True"
          )
  
      archive_path = download_from_url(
          url,
          file_name,
          file_hash,
          cache_dir=cache_dir,
          cache_subdir=cache_subdir,
      )
  
      # Extract the archive
      if extract_archive:
          archive_path = Path(archive_path)
          dataset_path = archive_path.parent.joinpath(archive_path.stem)
          if not dataset_path.is_dir() or overwrite:
              shutil.unpack_archive(archive_path, dataset_path)
  
      super().__init__(
          dataset_path if extract_archive else archive_path, **kwargs
      )
  
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 1 to create a new _VisionDataset object from inherited base classes: _AbstractDataset with example: obj = _VisionDataset(url, file_name, file_hash, extract_archive, download, overwrite, cache_dir, cache_subdir)