To execute the command python3 detect_wrong.py --source overpass.mp4 --weights ./my_coco.pt --data ./data/my_coco.yaml
using the subprocess
module in Python, you can modify the previous example code as follows:
import subprocess
command = ['python3', 'detect_wrong.py', '--source', 'overpass.mp4', '--weights', './my_coco.pt', '--data', './data/my_coco.yaml']
subprocess.run(command)
In this code, the command is specified as a list where each element represents a part of the command and its arguments. The first element is 'python3'
to specify the Python interpreter, followed by 'detect_wrong.py'
to indicate the script name, and then the command-line arguments --source
, overpass.mp4
, --weights
, ./my_coco.pt
, --data
, and ./data/my_coco.yaml
.
Make sure to adjust the command and arguments based on your specific use case, including the correct path to the files used.