File size: 653 Bytes
f8596b7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import subprocess



# Define the path to the YOLOv5 directory
yolov5_dir = r'D:\pythonProject1\yolov5'
# Define the path to the weights file
weights_path = r'D:\pythonProject1\yolov5\runs\train\exp4\weights\best.pt'
# Set the confidence threshold
confidence = '0.25'
# Set the source to your ESP32-CAM stream URL
source = 'http://192.168.43.156:81/stream'  # Replace with your ESP32-CAM stream URL

# Build the command to run the detection
command = rf'python "{yolov5_dir}\detect.py" --weights "{weights_path}" --img 640 --conf {confidence} --source {source}'


# Execute the command
subprocess.run(command, shell=True, check=True)