ap = argparse.ArgumentParser()
      ap.add_argument("-f", "--face", type=str,
        default="face_detector",
        help="path to face detector model directory")
      ap.add_argument("-m", "--model", type=str,
        default="mask_detector.model",
        help="path to trained face mask detector model")
      ap.add_argument("-c", "--confidence", type=float, default=0.5,
        help="minimum probability to filter weak detections")
      args = vars(ap.parse_args())

      Python language logoargumentParser

      CodeSnippets

      ArgumentParser is used to create a custom argument parser.

      Adding the argument --face with a value of face_detector as the default and paths to the mask_detector.model and face_detector model directories as required.

      Adding the argument --model with a value of mask_detector.model as the default and paths to the trained mask detector model as required.

      Adding the argument --confidence with a value of 0.5 as the default and indicating that a minimum probability of filtering weak detections must be supplied.

      Shortcut: argparse.ArgumentParsere

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.