0

So, I am using a python file to run object detection on an image. I want to run this file inside a python script and save the output from a .py file.

python3 yolo_video.py --model='models.h5' --classes='_classes.txt' --image --input='pic1.jpeg' --output='obj_det

So, I need the output in a Python file. I put an exclamation mark because that is what happens in the jupyter notebook. How do I run it in the script? I don't want to change function in the yolo_video.py file.

python output = !python3 yolo_video.py --model='models.h5' --classes='_classes.txt' --image --input='pic1.jpeg' --output='obj_det
Prakhar Rathi
  • 905
  • 1
  • 11
  • 25
  • [Possible answer](https://stackoverflow.com/q/7974849/7665043) -- using Python to run Python. Also, shells can generally do `> file.ext` to redirect the output of a command to a file. – l3l_aze Aug 02 '20 at 18:42
  • 1
    The `subprocess` module lets you run external programs. Likely `subprocess.run` will work for you. – tdelaney Aug 02 '20 at 18:46

0 Answers0