"""
yolov8:目标检测推理代码 python
"""
import torch
import cv2
import numpy as np
import onnxruntime as ort
import os
import torch.nn.functional as F
def xywh2xyxy(x):
"""
Convert bounding box coordinates from (x, y, width, height) format to (x1, y1, x2, y2) format where (x1, y1) is the
top-left corner and (x2, y2) is the bottom-right corner.
Args:
x (np.ndarray | torch.Tensor): The input bounding box coordinates in (x, y, width, height) format.
Returns:
y (np.ndarray | torch.Tenso