code: def plot_data_loader_image(data_loader):
      batch_size = data_loader.batch_size
      plot_num = min(batch_size, 4)
  
      json_path = "./class_indices.json"
      assert os.path.exists(json_path), json_path + " does not exist."
      json_file = open(json_path, "r")
      class_indices = json.load(json_file)
  
      for data in data_loader:
          images, labels = data
          for i in range(plot_num):
              # [C, H, W] -> [H, W, C]
              img = images[i].numpy().transpose(1, 2, 0)
              # 反Normalize操作
              img = (
                  img * [0.229, 0.224, 0.225] + [0.485, 0.456, 0.406]
              ) * 255
              label = labels[i].item()
              plt.subplot(1, plot_num, i + 1)
              plt.xlabel(class_indices[str(label)])
              plt.xticks([])  # 去掉x轴的刻度
              plt.yticks([])  # 去掉y轴的刻度
              plt.imshow(img.astype("uint8"))
          plt.show()
  
file_path: deep-learning-for-image-processing/pytorch_classification/swin_transformer/utils.py
imports: import os
  import sys
  import json
  import pickle
  import random
  import torch
  from tqdm import tqdm
  import matplotlib.pyplot
label_desc: Use image node_id 2 for calling a global function with example usage: plot_data_loader_image(data_loader) without return types