code: def get_dataset_path(path, annotation, image_dir):
      """
      If path exists, return path.
      Otherwise, get dataset path from DATASET_HOME, if not exists,
      download it.
      """
      if _dataset_exists(path, annotation, image_dir):
          return path
  
      data_name = os.path.split(path.strip().lower())[-1]
      if data_name not in DOWNLOAD_DATASETS_LIST:
          raise ValueError(
              "Dataset {} is not valid for reason above, please check again.".format(
                  osp.realpath(path)
              )
          )
      else:
          logger.warning(
              "Dataset {} is not valid for reason above, try searching {} or "
              "downloading dataset...".format(
                  osp.realpath(path), DATASET_HOME
              )
          )
  
      for name, dataset in DATASETS.items():
          if data_name == name:
              logger.debug(
                  "Parse dataset_dir {} as dataset "
                  "{}".format(path, name)
              )
              data_dir = osp.join(DATASET_HOME, name)
  
              if name == "spine_coco":
                  if _dataset_exists(data_dir, annotation, image_dir):
                      return data_dir
  
              # For voc, only check dir VOCdevkit/VOC2012, VOCdevkit/VOC2007
              if name in ["voc", "fruit", "roadsign_voc"]:
                  exists = True
                  for sub_dir in dataset[1]:
                      check_dir = osp.join(data_dir, sub_dir)
                      if osp.exists(check_dir):
                          logger.info("Found {}".format(check_dir))
                      else:
                          exists = False
                  if exists:
                      return data_dir
  
              # voc exist is checked above, voc is not exist here
              check_exist = (
                  name != "voc"
                  and name != "fruit"
                  and name != "roadsign_voc"
              )
              for url, md5sum in dataset[0]:
                  get_path(url, data_dir, md5sum, check_exist)
  
              # voc should create list after download
              if name == "voc":
                  create_voc_list(data_dir)
              return data_dir
  
      raise ValueError("Dataset automaticly downloading Error.")
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  import os.path
  import sys
  import yaml
  import time
  import shutil
  import requests
  import tqdm
  import hashlib
  import base64
  import binascii
  import tarfile
  import zipfile
  import errno
  from paddle.utils.download import _get_unique_endpoints
  from ppdet.core.workspace import BASE_KEY
  from .logger import setup_logger
  from .voc_utils import create_list
label_desc: Use image node_id 5 for calling a global function with example usage: get_dataset_path(path, annotation, image_dir) and returns: path, data_dir, data_dir, data_dir