passedArgs = {} extractArgs = {} if args.embedding_path is not None: passedArgs['embedding_path'] = args.embedding_path extractArgs['embedding_path'] = args.embedding_path if args.recognizer_path is not None: passedArgs['recognizer_path'] = args.recognizer_path if args.le_path is not None: passedArgs['le_path'] = args.le_path if args.train: trainer.train_model(**passedArgs) else: passedArgs['width'] = args.width passedArgs['min_conf'] = args.conf recognizer = Recognizer(**passedArgs) if args.training_images_path is not None: extractArgs['training_images_path'] = args.training_images_path if args.extract: recognizer.extractor.extract_and_write_embeddings( **extractArgs) else: if 'embedding_path' in extractArgs: del extractArgs['embedding_path'] recognizer.extract_and_train(**extractArgs)