code: def number_of_detections(labels) -> t.List[int]:
      """Return a list containing the number of detections per sample in batch."""
      return [masks_per_image.shape[0] for masks_per_image in labels]
  
imports: import contextlib
  import os
  import typing
  from pathlib import Path
  import albumentations
  import matplotlib.pyplot
  import numpy
  import torch
  import torchvision.transforms.functional
  from albumentations.pytorch.transforms import ToTensorV2
  from PIL import Image, ImageDraw
  from torch.utils.data import DataLoader
  from torchvision.datasets import VisionDataset
  from torchvision.datasets.utils import download_and_extract_archive
  from torchvision.utils import draw_segmentation_masks
  from deepchecks.vision import VisionData, BatchOutputFormat
  from deepchecks.vision.checks import ImagePropertyDrift
  from deepchecks.vision.checks import LabelDrift
label_desc: Use image node_id 2 for calling a global function with example usage: number_of_detections(labels) and returns: unknown