code: def directory_parsing_label_names(root, numerical_sort=False):
      """Get label names from the directories that are named by them.
  
      The label names are the names of the directories that locate a
      layer below the root directory.
  
      The label names can be used together with
      :class:`~chainercv.datasets.DirectoryParsingLabelDataset`.
      The index of a label name corresponds to the label id
      that is used by the dataset to refer the label.
  
      Args:
          root (string): The root directory.
          numerical_sort (bool): Label names are sorted numerically.
              This means that label :obj:`2` is before label :obj:`10`,
              which is not the case when string sort is used.
              The default value is :obj:`False`.
  
      Returns:
          list of strings:
          Sorted names of classes.
  
      """
      label_names = [
          d
          for d in os.listdir(root)
          if os.path.isdir(os.path.join(root, d))
      ]
  
      if not numerical_sort:
          label_names.sort()
      else:
          label_names = sorted(label_names, key=int)
      return label_names
  
file_path: chainercv/chainercv/datasets/directory_parsing_label_dataset.py
imports: import numpy
  import os
  from chainercv.chainer_experimental.datasets.sliceable import GetterDataset
  from chainercv.utils import read_image
label_desc: Use image node_id 1 for calling a global function with example usage: directory_parsing_label_names(root, numerical_sort) and returns: label_names