目录
json-toc" name="tableOfContents" style="margin-left:40px">yolov11 推理保存json
推理图片目录:
json" name="yolov11%20%E6%8E%A8%E7%90%86%E4%BF%9D%E5%AD%98json">yolov11 推理保存json
import glob
import json
import os
import shutilimport cv2
import timeimport numpy as np
import torch# import torch
from ultralytics import YOLOmodel = YOLO(r"yolo11x.pt")dir_path = r"C:\Users\Administrator\Videos\遮挡\bad"
import random
import timedir_path_1=r'dir_path_1'
prev_time = 0
fps = 0fiels = glob.glob(dir_path + '/*.mp4')
if len(fiels) == 0:exit('len(fiels) is 0')
lou_len = 0
for dir_i, mp4_path in enumerate(fiels):videocapture = cv2.VideoCapture