required=False, help='1 to show region_of_interest otherwise 0, default is 0') args = vars(ap.parse_args()) DEFAULT_PARAMS = { 'bounding_box': (True, bool), 'landmarks': (False, bool), 'delaunay_triangulation': (False, bool), 'region_of_interest': (False, bool), } for k in args: if not k in ["input", "skip_rate"]: args[k] = (DEFAULT_PARAMS[k][0] if args[k] is None else utils.arg2bool(args[k])) if k == "skip_rate": args["skip_rate"] = (1 if args["skip_rate"] is None else int( args["skip_rate"])) # Opencv Haar haar_detector = cv2.CascadeClassifier( "face_detectors/haarcascade_frontalface.xml") # Opencv LBP lbp_detector = cv2.CascadeClassifier( "face_detectors/lbpcascade_frontalface.xml") # DLIB HoG hog_detector = dlib.get_frontal_face_detector()
ap.add_argument( '-he', '--histogram_equalization', required=False, help='1 to apply histogram_equalization otherwise 0, default 0') ap.add_argument('-ws', '--window_size', required=False, help='Window size, comma separated values') args = vars(ap.parse_args()) if args["histogram_equalization"] is None: hist_eq = False else: hist_eq = utils.arg2bool(args["histogram_equalization"]) # DLIB HoG hog_detector = dlib.get_frontal_face_detector() # Opencv DNN modelFile = "face_detectors/dnn_tf.pb" configFile = "face_detectors/dnn_tf.pbtxt" net = cv2.dnn.readNetFromTensorflow(modelFile, configFile) conf_threshold = 0.7 shape_predictor = dlib.shape_predictor( "face_detectors/shape_predictor_68_face_landmarks.dat") def get_model_compatible_input(gray_frame, face):
args = vars(ap.parse_args()) DEFAULT_BOOLEAN_PARAMS = { 'shuffle': True, 'save_model': False, 'save_architecture': False, 'save_confusion_matrix': False, 'save_training_history': False, } for k in args: if k in DEFAULT_BOOLEAN_PARAMS: args[k] = ( DEFAULT_BOOLEAN_PARAMS[k] if args[k] is None else utils.arg2bool(args[k]) ) DEFAULT_NONBOOLEAN_PARAMS = { 'random_state': (42, int), 'train_ratio': (0.85, float), 'lr_scheduler': (None, str), 'early_stopping': (None, str), 'train_generator': (None, str), 'batch_size': (24, int), 'epochs': (50, int), 'optim': ("adam", str), 'learning_rate': (0.01, float), } for k in args: