code: def translate_predictions_xcycwh_to_x1y1x2y2(
      y_pred_xcycwh: "torch.Tensor", height: int, width: int
  ) -> List[Dict[str, "torch.Tensor"]]:
      """
      Convert object detection predictions from xcycwh (YOLO) to x1y1x2y2 (torchvision).
  
      :param y_pred_xcycwh: Object detection labels in format xcycwh (YOLO).
      :param height: Height of images in pixels.
      :param width: Width if images in pixels.
      :return: Object detection labels in format x1y1x2y2 (torchvision).
      """
      import torch
  
      y_pred_x1y1x2y2 = []
      device = y_pred_xcycwh.device
  
      for y_pred in y_pred_xcycwh:
          boxes = torch.vstack(
              [
                  torch.maximum(
                      (y_pred[:, 0] - y_pred[:, 2] / 2),
                      torch.tensor(0, device=device),
                  ),
                  torch.maximum(
                      (y_pred[:, 1] - y_pred[:, 3] / 2),
                      torch.tensor(0, device=device),
                  ),
                  torch.minimum(
                      (y_pred[:, 0] + y_pred[:, 2] / 2),
                      torch.tensor(height, device=device),
                  ),
                  torch.minimum(
                      (y_pred[:, 1] + y_pred[:, 3] / 2),
                      torch.tensor(width, device=device),
                  ),
              ]
          ).permute((1, 0))
          labels = torch.argmax(y_pred[:, 5:], dim=1, keepdim=False)
          scores = y_pred[:, 4]
  
          y_i = {
              "boxes": boxes,
              "labels": labels,
              "scores": scores,
          }
  
          y_pred_x1y1x2y2.append(y_i)
  
      return y_pred_x1y1x2y2
  
imports: import logging
  from typing import List, Dict, Optional, Tuple, Union, TYPE_CHECKING
  import numpy
  from art.estimators.object_detection.object_detector import ObjectDetectorMixin
  from art.estimators.object_detection.utils import cast_inputs_to_pt
  from art.estimators.pytorch import PyTorchEstimator
label_desc: Use image node_id 1 for calling a global function with example usage: translate_predictions_xcycwh_to_x1y1x2y2(y_pred_xcycwh, height, width) and returns: y_pred_x1y1x2y2