class_docstr: Open Images dataset for detection.
  
  Args:
      ann_file (str): Annotation file path.
      label_file (str): File path of the label description file that
          maps the classes names in MID format to their short
          descriptions.
      meta_file (str): File path to get image metas.
      hierarchy_file (str): The file path of the class hierarchy.
      image_level_ann_file (str): Human-verified image level annotation,
          which is used in evaluation.
      backend_args (dict, optional): Arguments to instantiate the
          corresponding backend. Defaults to None.
docstr: Get matrix of the corresponding relationship between the parent
  class and the child class.
  
  Args:
      hierarchy_map (dict): Including label name and corresponding
          subcategory. Keys of dicts are:
  
          - `LabeName` (str): Name of the label.
          - `Subcategory` (dict | list): Corresponding subcategory(ies).
      relation_matrix (ndarray): The matrix of the corresponding
          relationship between the parent class and the child class,
          of shape (class_num, class_num).
      parents (list): Corresponding parent class.
      get_all_parents (bool): Whether get all parent names.
          Default: True
  
  Returns:
      ndarray: The matrix of the corresponding relationship between
      the parent class and the child class, of shape
      (class_num, class_num).
docstr_tok: ["Get","matrix","of","the","corresponding","relationship","between","the","parent","class","and","the","child","class",".","Args",":","hierarchy_map","(","dict",")",":","Including","label","name","and","corresponding","subcategory",".","Keys","of","dicts","are",":","-","`","LabeName","`","(","str",")",":","Name","of","the","label",".","-","`","Subcategory","`","(","dict","|","list",")",":","Corresponding","subcategory","(","ies",")",".","relation_matrix","(","ndarray",")",":","The","matrix","of","the","corresponding","relationship","between","the","parent","class","and","the","child","class",",","of","shape","(","class_num",",","class_num",")",".","parents","(","list",")",":","Corresponding","parent","class",".","get_all_parents","(","bool",")",":","Whether","get","all","parent","names",".","Default",":","True","Returns",":","ndarray",":","The","matrix","of","the","corresponding","relationship","between","the","parent","class","and","the","child","class",",","of","shape","(","class_num",",","class_num",")","."]
code: def _convert_hierarchy_tree(
      self,
      hierarchy_map: dict,
      relation_matrix: np.ndarray,
      parents: list = [],
      get_all_parents: bool = True,
  ) -> np.ndarray:
      """Get matrix of the corresponding relationship between the parent
      class and the child class.
  
      Args:
          hierarchy_map (dict): Including label name and corresponding
              subcategory. Keys of dicts are:
  
              - `LabeName` (str): Name of the label.
              - `Subcategory` (dict | list): Corresponding subcategory(ies).
          relation_matrix (ndarray): The matrix of the corresponding
              relationship between the parent class and the child class,
              of shape (class_num, class_num).
          parents (list): Corresponding parent class.
          get_all_parents (bool): Whether get all parent names.
              Default: True
  
      Returns:
          ndarray: The matrix of the corresponding relationship between
          the parent class and the child class, of shape
          (class_num, class_num).
      """
  
      if "Subcategory" in hierarchy_map:
          for node in hierarchy_map["Subcategory"]:
              if "LabelName" in node:
                  children_name = node["LabelName"]
                  children_index = self.label_id_mapping[children_name]
                  children = [children_index]
              else:
                  continue
              if len(parents) > 0:
                  for parent_index in parents:
                      if get_all_parents:
                          children.append(parent_index)
                      relation_matrix[children_index, parent_index] = 1
              relation_matrix = self._convert_hierarchy_tree(
                  node, relation_matrix, parents=children
              )
      return relation_matrix
  
imports: import csv
  import os.path
  from collections import defaultdict
  from typing import Dict, List, Optional
  import numpy
  from mmengine.fileio import get_local_path, load
  from mmengine.utils import is_abs
  from mmdet.registry import DATASETS
  from .base_det_dataset import BaseDetDataset
label_desc: Use image node_id 6 for calling the OpenImagesDataset obj's underlying member method code with example usage: obj._convert_hierarchy_tree(hierarchy_map, relation_matrix, parents, get_all_parents) and returns: relation_matrix