code: def get_sample_class(anno_file):
      sample_class_stats = {}
      anno = cv2.imread(anno_file, -1)
      class_list = np.unique(anno)
      sample_class_stats[anno_file] = defaultdict(int)
      for classid in class_list:
          sample_class_stats[anno_file][classid] += (
              anno == classid
          ).sum()
      return sample_class_stats
  
file_path: PaddleSeg/contrib/QualityInspector/tools/dataset/cal_class_weights.py
imports: import argparse
  import os
  import sys
  from collections import defaultdict
  from multiprocessing import Pool, cpu_count
  import cv2
  import numpy
  import prettytable
  import paddle
  import paddle.nn.functional
  from qinspector.utils.logger import setup_logger
label_desc: Use image node_id 3 for calling a global function with example usage: get_sample_class(anno_file) and returns: sample_class_stats