code: def load_data_realistic_ssl(dataset_name, data_path, label_map_path):
      """Loads data from the `ealistic Evaluation of Deep SSL Algorithms`."""
      logging.info("Loading data from pickle at %s.", data_path)
      train_set, validation_set, test_set = pickle.load(
          open(data_path, "rb")
      )
      train_inputs = train_set["images"]
      train_labels = train_set["labels"]
      val_inputs = validation_set["images"]
      val_labels = validation_set["labels"]
      test_inputs = test_set["images"]
      test_labels = test_set["labels"]
      # Load label map that specifies which trainining labeles are available.
      train_indices = json.load(open(label_map_path, "r"))
      train_indices = [
          int(key.encode("ascii", "ignore"))
          for key in train_indices["values"]
      ]
      train_indices = np.asarray(train_indices)
  
      # Select the loaded train indices, and make the rest unlabeled.
      unlabeled_mask = np.ones((train_inputs.shape[0],), dtype=bool)
      unlabeled_mask[train_indices] = False
      unlabeled_inputs = train_inputs[unlabeled_mask]
      unlabeled_labels = train_labels[unlabeled_mask]
      train_inputs = train_inputs[train_indices]
      train_labels = train_labels[train_indices]
  
      # Select a feature preprocessing function, depending on the dataset.
      feature_preproc_fn = (
          (lambda image: image)
          if dataset_name == "cifar10"
          else convert_image
      )
  
      data = Dataset.build_from_splits(
          name=dataset_name,
          inputs_train=train_inputs,
          labels_train=train_labels,
          inputs_val=val_inputs,
          labels_val=val_labels,
          inputs_test=test_inputs,
          labels_test=test_labels,
          inputs_unlabeled=unlabeled_inputs,
          labels_unlabeled=unlabeled_labels,
          feature_preproc_fn=feature_preproc_fn,
      )
      return data
  
file_path: neural-structured-learning/research/gam/gam/data/loaders.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import json
  import logging
  import os
  import pickle
  import sys
  from .dataset import Dataset
  from .dataset import PlanetoidDataset
  import networkx
  import numpy
  from .preprocessing import convert_image
  from .preprocessing import split_train_val_unlabeled
  from scipy import sparse
  import tensorflow_datasets
label_desc: Use image node_id 2 for calling a global function with example usage: load_data_realistic_ssl(dataset_name, data_path, label_map_path) and returns: data