code
import os
import cv2
import argparse
import time
import torch
import numpy as np
from models.common import DetectMultiBackend
from utils.torch_utils import select_device, smart_inference_mode
from utils.augmentations import (Albumentations, augment_hsv, classify_albumentations, classify_transforms, copy_paste,
letterbox, mixup, random_perspective)
from utils.general import (LOGGER, Profile, check_file, check_img_size, check_imshow, check_requirements, colorstr, cv2,
increment_path, non_max_suppression, print_args, scale_boxes, strip_optimizer, xyxy2xywh)
from ultralytics.utils.plotting import Annotator, colors, save_one_box
class Yolov5:
def __init__(self, model_path, img_size, conf_thres, iou_thres):
self.img_size=img_size
self.conf_thres=conf_thres
self.iou_thres=iou_thres
self.device = torch.device("cuda" if torch.cuda.