def post_update_opt(opt): """ Post update the configurations based on the results of preprocessing. Args: opt: Returns: """ meta_src_proc = opt.meta_data["meta_src"] valid_meta_src_proc = [] cur_num_source = 1 for meta_proc in meta_src_proc: process_info = ProcessInfo(meta_proc) process_info.deserialize() # check it has been processed successfully if process_info.check_has_been_processed(process_info.vid_infos, verbose=False): valid_meta_src_proc.append(meta_proc) num_source = process_info.num_sources() cur_num_source = max(cur_num_source, num_source) else: # otherwise, clean this inputs process_info.declare() meta_ref_proc = opt.meta_data["meta_ref"] valid_meta_ref_proc = [] for meta_proc in meta_ref_proc: if meta_proc.check_has_been_processed(verbose=False): valid_meta_ref_proc.append(meta_proc) ## 3.1 update the personalization.txt checkpoints_dir = opt.meta_data["checkpoints_dir"] with open(os.path.join(checkpoints_dir, "personalization.txt"), "w") as writer: for meta_src in valid_meta_src_proc: writer.write(meta_src.primitives_dir + "\n") # update the number sources print(f"the current number of sources are {cur_num_source}, " f"while the pre-defined number of sources are {opt.num_source}. ") opt.num_source = min(cur_num_source, opt.num_source) # update the source information opt.meta_data["meta_src"] = valid_meta_src_proc # update the reference information opt.meta_data["meta_ref"] = valid_meta_ref_proc return opt
def process_data(): global args, iPER_train_txt, iPER_val_txt # 1. dumps videos to frames # 1. prepreocess vid_names = get_video_dirs(iPER_train_txt) + get_video_dirs(iPER_val_txt) src_paths = prepare_src_path(vid_names) args.src_path = "|".join(src_paths) # print(args.src_path) # set this as empty when preprocessing the training dataset. args.ref_path = "" cfg = setup(args) # 1. human estimation, including 2D pose, tracking, 3D pose, parsing, and front estimation. human_estimate(opt=cfg) # 2. digital deformation. digital_deform(opt=cfg) # 3. check meta_src_proc = cfg.meta_data["meta_src"] invalid_meta_process = [] print(f"Check all videos have been processed...") for meta_proc in tqdm(meta_src_proc): process_info = ProcessInfo(meta_proc) process_info.deserialize() # check it has been processed successfully if not process_info.check_has_been_processed(process_info.vid_infos, verbose=False): invalid_meta_process.append(meta_proc) num_invalid = len(invalid_meta_process) if num_invalid > 0: for meta_proc in invalid_meta_process: print(f"invalid meta proc {meta_proc}") else: print(f"process successfully.")
def process_data(): # 1. preprocess src_paths = prepare_src_path() args.src_path = "|".join(src_paths) print(args.src_path) # set this as empty when preprocessing the training dataset. args.ref_path = "" cfg = setup(args) # 1. human estimation, including 2D pose, tracking, 3D pose, parsing, and front estimation. human_estimate(opt=cfg) # 2. digital deformation. digital_deform(opt=cfg) # 3. check meta_src_proc = cfg.meta_data["meta_src"] invalid_meta_process = [] for meta_proc in meta_src_proc: process_info = ProcessInfo(meta_proc) process_info.deserialize() # check it has been processed successfully if not process_info.check_has_been_processed(process_info.vid_infos, verbose=False): invalid_meta_process.append(meta_proc) num_invalid = len(invalid_meta_process) if num_invalid > 0: for meta_proc in invalid_meta_process: print(f"invalid meta proc {meta_proc}") else: print(f"process successfully.")