(args)
| 57 | |
| 58 | |
| 59 | def process_input_video(args): |
| 60 | args_dict = vars(args) |
| 61 | print(args_dict) |
| 62 | |
| 63 | assert len(args.resolution_area) == 2, "resolution_area should be a list of two integers [width, height]" |
| 64 | assert not args.use_flux or args.retarget_flag, "Image editing with FLUX can only be used when pose retargeting is enabled." |
| 65 | |
| 66 | pose2d_checkpoint_path = os.path.join(args.ckpt_path, "pose2d/vitpose_h_wholebody.onnx") |
| 67 | det_checkpoint_path = os.path.join(args.ckpt_path, "det/yolov10m.onnx") |
| 68 | |
| 69 | sam2_checkpoint_path = os.path.join(args.ckpt_path, "sam2/sam2_hiera_large.pt") if args.replace_flag else None |
| 70 | flux_kontext_path = os.path.join(args.ckpt_path, "FLUX.1-Kontext-dev") if args.use_flux else None |
| 71 | process_pipeline = ProcessPipeline( |
| 72 | det_checkpoint_path=det_checkpoint_path, pose2d_checkpoint_path=pose2d_checkpoint_path, sam_checkpoint_path=sam2_checkpoint_path, flux_kontext_path=flux_kontext_path |
| 73 | ) |
| 74 | os.makedirs(args.save_path, exist_ok=True) |
| 75 | process_pipeline( |
| 76 | video_path=args.video_path, |
| 77 | refer_image_path=args.refer_path, |
| 78 | output_path=args.save_path, |
| 79 | resolution_area=args.resolution_area, |
| 80 | fps=args.fps, |
| 81 | iterations=args.iterations, |
| 82 | k=args.k, |
| 83 | w_len=args.w_len, |
| 84 | h_len=args.h_len, |
| 85 | retarget_flag=args.retarget_flag, |
| 86 | use_flux=args.use_flux, |
| 87 | replace_flag=args.replace_flag, |
| 88 | drop_tail_invalid_frames=args.drop_tail_invalid_frames, |
| 89 | ) |
| 90 | |
| 91 | |
| 92 | if __name__ == "__main__": |
no test coverage detected