0
ap = argparse.ArgumentParser()
ap.add_argument("-i", "--image", required=True,
help="path to input image")
ap.add_argument("-d", "--dataset", required=True,
help="path to dataset")
ap.add_argument("-m", "--model", required=True,
help="path to Caffe pre-trained model")
ap.add_argument("-l", "--labels", required=True,
help="path to ImageNet labels (i.e., syn-sets)")
args = vars(ap.parse_args())

and I'm getting the output as

usage: train.py [-h] -i IMAGE -d DATASET -m MODEL -l LABELS
    ipykernel_launcher.py: error: the following arguments are required: -i/--image, -p/--prototxt, -m/--model, -l/--labels.
 An exception has occurred, use %tb to see the full traceback.
 System Exit: 2
Reti43
  • 9,656
  • 3
  • 28
  • 44
  • The error says that `-p/--prototxt` is a required argument, but it doesn't appear in your code. Are you sure you're running the updated version of your script? – Reti43 Nov 25 '21 at 13:00
  • Based on the error message, [this question](https://stackoverflow.com/questions/48796169/how-to-fix-ipykernel-launcher-py-error-unrecognized-arguments-in-jupyter) seems related. – Reti43 Nov 25 '21 at 13:02
  • The error message tells us that you are running this in a jupyter notebook. It's not easy to provide commandline arguments to a script in that environment, even if you know what that means. Scripts like this are meant to be run from a OS shell. – hpaulj Nov 25 '21 at 16:18

1 Answers1

-1

You have this error because you are running your script without passing the required parameters you defined. You will not have the error if you run the script like this:

script_name.py -i image_path -d data_path -m model_path -l label_path
S.B
  • 13,077
  • 10
  • 22
  • 49