def process_convert(arguments): from mainscripts import Converter Converter.main(input_dir=arguments.input_dir, output_dir=arguments.output_dir, aligned_dir=arguments.aligned_dir, model_dir=arguments.model_dir, model_name=arguments.model_name, debug=arguments.debug, force_gpu_idx=arguments.force_gpu_idx, cpu_only=arguments.cpu_only)
def process_convert(arguments): from mainscripts import Converter Converter.main(input_dir=arguments.input_dir, output_dir=arguments.output_dir, aligned_dir=arguments.aligned_dir, model_dir=arguments.model_dir, model_name=arguments.model_name, debug=arguments.debug, mode=arguments.mode, mask_type=arguments.mask_type)
def process_convert(arguments): args = {'input_dir' : arguments.input_dir, 'output_dir' : arguments.output_dir, 'aligned_dir' : arguments.aligned_dir, 'model_dir' : arguments.model_dir, 'model_name' : arguments.model_name, 'debug' : arguments.debug, } device_args = {'cpu_only' : arguments.cpu_only, 'force_gpu_idx' : arguments.force_gpu_idx, } from mainscripts import Converter Converter.main (args, device_args)
def process_convert(arguments): os_utils.set_process_lowest_prio() args = {'training_data_src_dir' : arguments.training_data_src_dir, 'input_dir' : arguments.input_dir, 'output_dir' : arguments.output_dir, 'aligned_dir' : arguments.aligned_dir, 'model_dir' : arguments.model_dir, 'model_name' : arguments.model_name, } device_args = {'cpu_only' : arguments.cpu_only, 'force_gpu_idx' : arguments.force_gpu_idx, } from mainscripts import Converter Converter.main (args, device_args)
def SPConvertLab(context): args = context.args convert_args = { "input_dir": args.inputData, "output_dir": args.outputData, "aligned_dir": args.alignedDir, "model_dir": args.modelDir, "model_name": args.modelName, } device_args = { "cpu_only": args.cpuOnly, "force_gpu_idx": args.forceGpuIdx, } if not args.__edit: os.environ["SP_FaceLab_Edit"] = "False" from mainscripts import Converter Converter.main(convert_args, device_args) return args.outputData
def process_convert(arguments): if arguments.ask_for_params: try: mode = int ( input ("Choose mode: (1) hist match, (2) hist match bw, (3) seamless (default), (4) seamless hist match : ") ) except: mode = 3 if mode == 1: arguments.mode = 'hist-match' elif mode == 2: arguments.mode = 'hist-match-bw' elif mode == 3: arguments.mode = 'seamless' elif mode == 4: arguments.mode = 'seamless-hist-match' if arguments.mode == 'hist-match' or arguments.mode == 'hist-match-bw': try: arguments.masked_hist_match = bool ( {"1":True,"0":False}[input("Masked hist match? [0 or 1] (default 1) : ").lower()] ) except: arguments.masked_hist_match = True if arguments.mode == 'hist-match' or arguments.mode == 'hist-match-bw' or arguments.mode == 'seamless-hist-match': try: hist_match_threshold = int ( input ("Hist match threshold. [0..255] (default - 255) : ") ) arguments.hist_match_threshold = hist_match_threshold except: arguments.hist_match_threshold = 255 try: arguments.use_predicted_mask = bool ( {"1":True,"0":False}[input("Use predicted mask? [0 or 1] (default 1) : ").lower()] ) except: arguments.use_predicted_mask = False try: arguments.erode_mask_modifier = int ( input ("Choose erode mask modifier [-200..200] (default 0) : ") ) except: arguments.erode_mask_modifier = 0 try: arguments.blur_mask_modifier = int ( input ("Choose blur mask modifier [-200..200] (default 0) : ") ) except: arguments.blur_mask_modifier = 0 if arguments.mode == 'seamless' or arguments.mode == 'seamless-hist-match': try: arguments.seamless_erode_mask_modifier = int ( input ("Choose seamless erode mask modifier [-100..100] (default 0) : ") ) except: arguments.seamless_erode_mask_modifier = 0 try: arguments.output_face_scale_modifier = int ( input ("Choose output face scale modifier [-50..50] (default 0) : ") ) except: arguments.output_face_scale_modifier = 0 try: arguments.transfercolor = bool ( {"1":True,"0":False}[input("Transfer color from dst face to converted final face? [0 or 1] (default 0) : ").lower()] ) except: arguments.transfercolor = False try: arguments.final_image_color_degrade_power = int ( input ("Degrade color power of final image [0..100] (default 0) : ") ) except: arguments.final_image_color_degrade_power = 0 try: arguments.alpha = bool ( {"1":True,"0":False}[input("Export png with alpha channel? [0..1] (default 0) : ").lower()] ) except: arguments.alpha = False arguments.erode_mask_modifier = np.clip ( int(arguments.erode_mask_modifier), -200, 200) arguments.blur_mask_modifier = np.clip ( int(arguments.blur_mask_modifier), -200, 200) arguments.seamless_erode_mask_modifier = np.clip ( int(arguments.seamless_erode_mask_modifier), -100, 100) arguments.output_face_scale_modifier = np.clip ( int(arguments.output_face_scale_modifier), -50, 50) from mainscripts import Converter Converter.main ( input_dir=arguments.input_dir, output_dir=arguments.output_dir, aligned_dir=arguments.aligned_dir, model_dir=arguments.model_dir, model_name=arguments.model_name, debug = arguments.debug, mode = arguments.mode, masked_hist_match = arguments.masked_hist_match, hist_match_threshold = arguments.hist_match_threshold, use_predicted_mask = arguments.use_predicted_mask, erode_mask_modifier = arguments.erode_mask_modifier, blur_mask_modifier = arguments.blur_mask_modifier, seamless_erode_mask_modifier = arguments.seamless_erode_mask_modifier, output_face_scale_modifier = arguments.output_face_scale_modifier, final_image_color_degrade_power = arguments.final_image_color_degrade_power, transfercolor = arguments.transfercolor, alpha = arguments.alpha, force_best_gpu_idx = arguments.force_best_gpu_idx, cpu_only = arguments.cpu_only )
def process_convert(arguments): if arguments.ask_for_params: try: mode = int( input( "Choose mode: (1) hist match, (2) hist match bw, (3) seamless (default), (4) seamless hist match : " )) except: mode = 3 if mode == 1: arguments.mode = 'hist-match' elif mode == 2: arguments.mode = 'hist-match-bw' elif mode == 3: arguments.mode = 'seamless' elif mode == 4: arguments.mode = 'seamless-hist-match' if arguments.mode == 'hist-match' or arguments.mode == 'hist-match-bw': try: choice = int( input( "Masked hist match? [0..1] (default - model choice) : " )) arguments.masked_hist_match = (choice != 0) except: arguments.masked_hist_match = None try: arguments.erode_mask_modifier = int( input( "Choose erode mask modifier [-100..100] (default 0) : " )) except: arguments.erode_mask_modifier = 0 try: arguments.blur_mask_modifier = int( input( "Choose blur mask modifier [-100..200] (default 0) : ") ) except: arguments.blur_mask_modifier = 0 arguments.erode_mask_modifier = np.clip( int(arguments.erode_mask_modifier), -100, 100) arguments.blur_mask_modifier = np.clip( int(arguments.blur_mask_modifier), -100, 200) from mainscripts import Converter Converter.main(input_dir=arguments.input_dir, output_dir=arguments.output_dir, aligned_dir=arguments.aligned_dir, model_dir=arguments.model_dir, model_name=arguments.model_name, debug=arguments.debug, mode=arguments.mode, masked_hist_match=arguments.masked_hist_match, erode_mask_modifier=arguments.erode_mask_modifier, blur_mask_modifier=arguments.blur_mask_modifier, force_best_gpu_idx=arguments.force_best_gpu_idx)
def process_convert(arguments): if arguments.ask_for_params: try: mode = int( input( "Choose mode: (1) hist match, (2) hist match bw, (3) seamless (default), (4) seamless hist match : " )) except: mode = 3 if mode == 1: arguments.mode = 'hist-match' elif mode == 2: arguments.mode = 'hist-match-bw' elif mode == 3: arguments.mode = 'seamless' elif mode == 4: arguments.mode = 'seamless-hist-match' if arguments.mode == 'hist-match' or arguments.mode == 'hist-match-bw': try: choice = int( input( "Masked hist match? [0..1] (default - model choice) : " )) arguments.masked_hist_match = (choice != 0) except: arguments.masked_hist_match = None try: arguments.erode_mask_modifier = int( input( "Choose erode mask modifier [-100..100] (default 0) : " )) except: arguments.erode_mask_modifier = 0 try: arguments.blur_mask_modifier = int( input( "Choose blur mask modifier [-100..200] (default 0) : ") ) except: arguments.blur_mask_modifier = 0 try: arguments.output_face_scale_modifier = int( input( "Choose output face scale modifier [-50..50] (default 0) : " )) except: arguments.output_face_scale_modifier = 0 try: arguments.transfercolor = bool({ "1": True, "0": False }[input( "Transfer color from original DST image? [0..1] (default 0) : " ).lower()]) except: arguments.transfercolor = False try: arguments.final_image_color_degrade_power = int( input( "Degrade color power of final image [0..100] (default 0) : " )) except: arguments.final_image_color_degrade_power = 0 try: arguments.alpha = bool({ "1": True, "0": False }[input("Export png with alpha channel? [0..1] (default 0) : " ).lower()]) except: arguments.alpha = False arguments.erode_mask_modifier = np.clip( int(arguments.erode_mask_modifier), -100, 100) arguments.blur_mask_modifier = np.clip( int(arguments.blur_mask_modifier), -100, 200) arguments.output_face_scale_modifier = np.clip( int(arguments.output_face_scale_modifier), -50, 50) from mainscripts import Converter Converter.main( input_dir=arguments.input_dir, output_dir=arguments.output_dir, aligned_dir=arguments.aligned_dir, model_dir=arguments.model_dir, model_name=arguments.model_name, debug=arguments.debug, mode=arguments.mode, masked_hist_match=arguments.masked_hist_match, erode_mask_modifier=arguments.erode_mask_modifier, blur_mask_modifier=arguments.blur_mask_modifier, output_face_scale_modifier=arguments.output_face_scale_modifier, final_image_color_degrade_power=arguments. final_image_color_degrade_power, transfercolor=arguments.transfercolor, alpha=arguments.alpha, force_best_gpu_idx=arguments.force_best_gpu_idx)