code: def compute_pseudo_bbox_with_keypoint_annotation(dataset_dicts):
      """
      :param dataset_dicts:
      :return: remove person annotations without keypoints in it
      """
      for dic in dataset_dicts:
          annotation_with_pseudo_bbox = []
          for ann in dic["annotations"]:
              if (
                  "keypoints" in ann
                  and (np.array(ann["keypoints"][2::3]) > 0).sum() > 0
              ):
                  kpt = np.array(ann["keypoints"]).reshape(17, 3)
                  valid_k = kpt[kpt[:, 2] > 0]
                  min_xy = valid_k.min(axis=0)
                  max_xy = valid_k.max(axis=0)
                  ann["bbox"] = [
                      max(min_xy[0] - 1, 0),
                      max(min_xy[1] - 1, 0),
                      min(max_xy[0] + 1, dic["width"])
                      - max(min_xy[0] - 1, 0)
                      + 1,
                      min(max_xy[1] + 1, dic["height"])
                      - max(min_xy[1] - 1, 0)
                      + 1,
                  ]
                  annotation_with_pseudo_bbox.append(ann)
          dic["annotations"] = annotation_with_pseudo_bbox
          assert len(dic["annotations"]) > 0
  
      num_after = len(dataset_dicts)
      logger = logging.getLogger(__name__)
      logger.info(
          "Compute pseudo bbox annotations with keypoints. {} images left".format(
              num_after
          )
      )
      return dataset_dicts
  
imports: import itertools
  import copy
  import logging
  import numpy
  import torch
  from ..registry.catalog import DatasetCatalog, MetadataCatalog
  from ..detection.detection_dataset import load_proposals_into_dataset, filter_images_with_few_keypoints, filter_images_with_only_crowd_annotations, get_detection_dataset_dicts
  from ..detection.detection_dataset import print_instances_class_histogram, build_batch_data_loader, trivial_batch_collator
  from ..detection.detection_utils import check_metadata_consistency, read_image, filter_empty_instances, annotations_to_instances
  from ..detection.detection_utils import check_image_size, build_augmentation_ranged_clip, transform_instance_annotations
  from ..detection.detection_dataset import DatasetFromList, MapDataset, DatasetMapper
  from ..detection.samplers import RepeatFactorTrainingSampler, TrainingSampler, InferenceSampler
  from ..transforms import instance_transforms
  from ..transforms.instance_transforms import RandomCropWithInstance
  from ..structures import BoxMode
label_desc: Use image node_id 1 for calling a global function with example usage: compute_pseudo_bbox_with_keypoint_annotation(dataset_dicts) and returns: dataset_dicts