code: def parse_image_classification_dir_tree(dataset_dir):
      """Parses the contents of the given image classification dataset directory
      tree, which should have the following format::
  
          <dataset_dir>/
              <classA>/
                  <image1>.<ext>
                  <image2>.<ext>
                  ...
              <classB>/
                  <image1>.<ext>
                  <image2>.<ext>
                  ...
  
      Args:
          dataset_dir: the dataset directory
  
      Returns:
          samples: a list of ``(image_path, target)`` pairs
          classes: a list of class label strings
      """
      samples = []
      for filepath in etau.list_files(dataset_dir, recursive=True):
          chunks = pathlib.PurePath(filepath).parts
  
          if any(c.startswith(".") for c in chunks):
              continue
  
          samples.append((filepath, chunks[0]))
  
      classes = sorted(set(s[1] for s in samples))
      labels_map_rev = {c: i for i, c in enumerate(classes)}
  
      samples = [
          (os.path.join(dataset_dir, f), labels_map_rev[c])
          for f, c in samples
      ]
  
      return samples, classes
  
imports: import logging
  import multiprocessing.dummy
  import requests
  import os
  import pathlib
  import urllib
  import eta.core.image
  import eta.core.serial
  import eta.core.utils
  import eta.core.video
  import fiftyone.core.fields
  import fiftyone.core.labels
  import fiftyone.core.utils
label_desc: Use image node_id 3 for calling a global function with example usage: parse_image_classification_dir_tree(dataset_dir) and returns: samples,  classes