class_docstr: Class for representing ImageNet/WordNet hierarchy. 
class_docstr_tok: ["Class","for","representing","ImageNet\/WordNet","hierarchy","."]
docstr: Get information about mapping between ImageNet wnids/class numbers/class names.
  
  Args:
      ds_path (str) : Path to ImageNet dataset
      ds_info_path (str) : Path to supplementary files for the ImageNet dataset 
                           ('wordnet.is_a.txt', 'words.txt', 'imagenet_class_index.json')
                           which can be obtained from http://image-net.org/download-API.
docstr_tok: ["Get","information","about","mapping","between","ImageNet","wnids\/class","numbers\/class","names",".","Args",":","ds_path","(","str",")",":","Path","to","ImageNet","dataset","ds_info_path","(","str",")",":","Path","to","supplementary","files","for","the","ImageNet","dataset","(","'wordnet.is_a.txt","'",",","'words.txt","'",",","'imagenet_class_index.json","'",")","which","can","be","obtained","from","http",":","\/\/image-net.org\/download-API","."]
code: def load_imagenet_info(ds_path, ds_info_path):
      """
      Get information about mapping between ImageNet wnids/class numbers/class names.
  
      Args:
          ds_path (str) : Path to ImageNet dataset
          ds_info_path (str) : Path to supplementary files for the ImageNet dataset
                               ('wordnet.is_a.txt', 'words.txt', 'imagenet_class_index.json')
                               which can be obtained from http://image-net.org/download-API.
  
      """
      files = os.listdir(os.path.join(ds_path, "train"))
      in_wnids = [f for f in files if f[0] == "n"]
  
      f = open(os.path.join(ds_info_path, "words.txt"))
      wnid_to_name = [l.strip() for l in f.readlines()]
      wnid_to_name = {
          l.split("\t")[0]: l.split("\t")[1] for l in wnid_to_name
      }
  
      with open(
          os.path.join(ds_info_path, "imagenet_class_index.json"), "r"
      ) as f:
          base_map = json.load(f)
          wnid_to_num = {v[0]: int(k) for k, v in base_map.items()}
          num_to_name = {int(k): v[1] for k, v in base_map.items()}
  
      return in_wnids, wnid_to_name, wnid_to_num, num_to_name
  
file_path: robustness/robustness/tools/imagenet_helpers.py
imports: import os
  import numpy
  import json
  from itertools import product
label_desc: Use image node_id 2 for calling the ImageNetHierarchy obj's underlying member method code with example usage: obj.load_imagenet_info(ds_path, ds_info_path) and returns: in_wnids,  wnid_to_name,  wnid_to_num,  num_to_name