code: def plot_class_distribution(labels, predictions, class_names=None):
      """
      Plots the distribution of class labels associated with all annotated bounding boxes and predicted bounding boxes in the dataset.
  
      This plot can help you understand which classes are rare or over/under-predicted by the model overall.
  
      Parameters
      ----------
      labels:
          Annotated boxes and class labels in the original dataset, which may contain some errors.
          Refer to documentation for this argument in :py:func:`object_counts_per_image <cleanlab.object_detection.summary.object_counts_per_image>` for further details.
  
      predictions:
          Predictions output by a trained object detection model.
          Refer to documentation for this argument in :py:func:`object_counts_per_image <cleanlab.object_detection.summary.object_counts_per_image>` for further details.
  
      class_names: optional
          Optional dictionary mapping one-hot-encoded class labels back to their original class names in the format ``{"integer-label": "original-class-name"}``.
      """
      try:
          import matplotlib.pyplot as plt
      except ImportError as e:
          raise ImportError(
              "This functionality requires matplotlib. Install it via: `pip install matplotlib`"
          )
  
      lab_dist, pred_dist = class_label_distribution(
          labels, predictions, class_names=class_names
      )
      fig, axs = plt.subplots(1, 2, figsize=(10, 5))
      fig.suptitle(f"Distribution of classes in the dataset")
      for i, d in enumerate([lab_dist, pred_dist]):
          axs[i].pie(d.values(), labels=d.keys(), autopct="%1.1f%%")
          axs[i].set_title("Annotated" if i == 0 else "Predicted")
  
      plt.show()
  
imports: from multiprocessing import Pool
  from typing import Optional, Any, Dict, Tuple, Union, List, TYPE_CHECKING, TypeVar, DefaultDict
  import numpy
  import collections
  from cleanlab.internal.constants import MAX_CLASS_TO_SHOW, ALPHA, EPSILON, TINY_VALUE
  from cleanlab.object_detection.filter import _filter_by_class, _calculate_true_positives_false_positives
  from cleanlab.object_detection.rank import _get_valid_inputs_for_compute_scores, _separate_prediction, _separate_label, _get_prediction_type
  from cleanlab.internal.object_detection_utils import bbox_xyxy_to_xywh
label_desc: Use image node_id 6 for calling a global function with example usage: plot_class_distribution(labels, predictions, class_names) without return types