这算是一个简单的demo吧,后续详细更新
import subprocess
import cv2
import os
def run_python_script(script_path, arguments):
# Build the command
command = ["python", script_path] + arguments
# Run the subprocess
subprocess.run(command)
def main():
# First script execution
target_script_path_1 = "detect.py"
arguments_1 = ["--weights", "D:/code/LPR/local_best.pt"] # "--source", ""
run_python_script(target_script_path_1, arguments_1)
# Second script execution
target_script_path_2 = "detect.py"
arguments_2 = [
"--weights", "D:/code/LPR/best.pt",
"--source", "D:/yolov5-6.1/runs/detect/exp2/crops/0"
]
run_python_script(target_script_path_2, arguments_2)
def extract_frames(video_path, num_frames= 11):
frames_list = []
# 打开视频文件
cap = cv2.VideoCapture(video_path)
if not cap.i