code: def make_dataset(
      dir,
      mode,
      sample_info,
      class_to_idx,
      class_to_idx_comp,
      extensions,
  ):
      images = []
      allowed_labels = set(class_to_idx.keys())
      Nclasses = len(set(class_to_idx.values()))
  
      for k, v in sample_info.items():
          img_path = os.path.join(dir, "images", mode, k + ".jpg")
  
          pos_labels = set(
              [l for l in v.keys() if v[l]["conf"][0] == "1"]
          )
          neg_labels = set(
              [l for l in v.keys() if v[l]["conf"][0] == "0"]
          )
  
          pos_labels = pos_labels.intersection(allowed_labels)
          neg_labels = neg_labels.intersection(allowed_labels)
          if Nclasses == 601 or len(pos_labels) != 0:
              label = [0] * Nclasses
              all_labels = [0] * 601
              for p in pos_labels:
                  label[class_to_idx[p]] = 1
                  all_labels[class_to_idx_comp[p]] = 1
              for n in neg_labels:
                  if label[class_to_idx[n]] == 0:
                      label[class_to_idx[n]] = -1
                  all_labels[class_to_idx_comp[n]] = -1
              item = (img_path, label, all_labels)
              images.append(item)
  
      return images
  
file_path: robustness/robustness/tools/openimgs_helpers.py
imports: import os
  import csv
  import numpy
  import torch
  import torch.utils.data
  import robustness.data_augmentation
  from robustness import imagenet_models
  from .folder import default_loader, IMG_EXTENSIONS
label_desc: Use image node_id 3 for calling a global function with example usage: make_dataset(dir, mode, sample_info, class_to_idx, class_to_idx_comp, extensions) and returns: images