吉祥猴378 2024-08-01 14:52 采纳率: 95.8%
浏览 10
已结题

哪位大姥,知道为什么我的yolov5没办法识别识别模型,出现边框

scr = mss.mss(
monitor = {
    "left": 0,
    "top": 0,
    "width": 2560,
    "height": 1440 }
cv2.getWindowProperty('SF_TRT', cv2.WND_PROP_VISIBLE
img = scr.grab(monitor)  
img = np.array(img)  
img = cv2.cvtColor(img, cv2.COLOR_BGRA2BGR)  
img = cv2.resize(img,(640,640))
model = model.to(device)
results =model(img)
xmins = results.pandas().xyxy[0]['xmin']
ymins = results.pandas().xyxy[0]['ymin']
xmaxs = results.pandas().xyxy[0]['xmax']
ymaxs = results.pandas().xyxy[0]['ymax']

for xmin, ymin, xmax, ymax in zip(xmins, ymins, xmaxs, ymaxs):
    cv2.rectangle(img, (xmin[0], ymin[1]), (xmax[2], ymax[3]), (0, 255, 0), 2)

cv2.namedWindow('SF_TRT', cv2.WINDOW_NORMAL)  
cv2.getWindowProperty('SF_TRT', cv2.WND_PROP_VISIBLE)
cv2.imshow('SF_TRT', img)
k = cv2.waitKey(1)
  • 写回答

0条回答 默认 最新

    报告相同问题?

    问题事件

    • 系统已结题 8月9日
    • 创建了问题 8月1日