0
ap = argparse.ArgumentParser() "\n"

ap.add_argument("-i", "--image", required = True, help = "path to input image.")

ap.add_argument("-y", "--yolo", required = True, help = "base path to YOLO directory")

ap.add_argument("-c", "--confidence", type = float, default=0.5, help = "minimum probability to filter weak detections")

ap.add_argument("-t", "--threshold", type = float, default=0.3, help = "threshold when applying non-maxima suppression")

args = vars(ap.parse_args())

But every time I run this I get an error saying: -

usage: ipykernel_launcher.py [-h] -i IMAGE -y YOLO [-c CONFIDENCE]
                             [-t THRESHOLD]

ipykernel_launcher.py: error: the following arguments are required: -i/--image, -y/--yolo
An exception has occurred, use %tb to see the full traceback.
Axe319
  • 4,255
  • 3
  • 15
  • 31
  • How are you running it? If you aren't giving it the `-i IMAGE` and `-y YOLO` arguments, then of course it'll throw an error because you've set up `argparse` to require those arguments. – Pranav Hosangadi Oct 06 '20 at 15:11
  • Please take the [tour], read [what's on-topic here](/help/on-topic) and [ask], and provide a complete [mre] that people can use to reproduce your problem. From [ask], your title should describe your question in one sentence. Welcome to Stack Overflow! – Pranav Hosangadi Oct 06 '20 at 15:13
  • You can't use command line arguments (`argparse` or alternatives) in a Jupyter-notebook. The values you provide when launching `jupyter` are for the server only. How are you trying to provide these values (image, yolo, etc)? – hpaulj Oct 06 '20 at 15:46

0 Answers0