code: def _block_reduce_dominant_label(x: np.ndarray, axis):
      try:
          # minlength is +1 to num classes because we must account for IGNORE_LABEL
          minlength = np.max(x) + 1
          bincount_fn = partial(np.bincount, minlength=minlength)
          counts = np.apply_along_axis(
              bincount_fn, -1, x.reshape((x.shape[0], x.shape[1], -1))
          )
          reduced = np.argmax(counts, axis=-1)
          return reduced
      except Exception as e:
          print(e)
          print("shape", x.shape, "axis", axis)
  
file_path: pytorch-toolbelt/pytorch_toolbelt/datasets/segmentation.py
imports: from functools import partial
  from typing import Optional, List, Callable
  import albumentations
  import cv2
  import numpy
  from skimage.measure import block_reduce
  from torch.utils.data import Dataset
  from .common import read_image_rgb, INPUT_IMAGE_KEY, INPUT_IMAGE_ID_KEY, INPUT_INDEX_KEY, TARGET_MASK_WEIGHT_KEY, TARGET_MASK_KEY, name_for_stride
  from ..utils import fs, image_to_tensor
label_desc: Use image node_id 4 for calling a global function with example usage: _block_reduce_dominant_label(x, axis) and returns: reduced