0
votes
    # construct the argument parser and parse the arguments
ap = argparse.ArgumentParser()
ap.add_argument("-d", "--dataset", required=True,
    help="path to input dataset")
ap.add_argument("-p", "--plot", type=str, default="plot.png",
    help="path to output loss/accuracy plot")
ap.add_argument("-m", "--model", type=str,
    default="mask_detector.model",
    help="path to output face mask detector model")
args = vars(ap.parse_args())

I am getting an error usage: ipykernel_launcher.py [-h] -d DATASET [-p PLOT] [-m MODEL] ipykernel_launcher.py: error: the following arguments are required: -d/--dataset An exception has occurred, use %tb to see the full traceback.

SystemExit: 2 /usr/local/lib/python3.6/dist-packages/IPython/core/interactiveshell.py:2890: UserWarning: To exit: use 'exit', 'quit', or Ctrl-D. warn("To exit: use 'exit', 'quit', or Ctrl-D.", stacklevel=1)

1

1 Answers

1
votes

The declaration of the dataset argument includes required=True. If you run this script from IPython make sure to include a value for that argument. Example, assuming the script name is myscript.py and your data set is named DEFAULT_DATASET.dat:

run myscript.py -d DEFAULT_DATASET.dat

or replace the required=True argument with default="DEFAULT_DATASET.dat":

ap.add_argument("-d", "--dataset", default="DEFAULT_DATASET.dat",
    help="path to input dataset")