MCPcopy Create free account
hub / github.com/ModelTC/LightX2V / get_preprocess_parser

Function get_preprocess_parser

tools/preprocess/preprocess_data.py:8–56  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6
7
8def get_preprocess_parser():
9 parser = argparse.ArgumentParser(description="The preprocessing pipeline for Wan-animate.")
10
11 parser.add_argument("--ckpt_path", type=str, default=None, help="The path to the preprocessing model's checkpoint directory. ")
12
13 parser.add_argument("--video_path", type=str, default=None, help="The path to the driving video.")
14 parser.add_argument("--refer_path", type=str, default=None, help="The path to the refererence image.")
15 parser.add_argument("--save_path", type=str, default=None, help="The path to save the processed results.")
16
17 parser.add_argument(
18 "--resolution_area",
19 type=int,
20 nargs=2,
21 default=[1280, 720],
22 help="The target resolution for processing, specified as [width, height]. To handle different aspect ratios, the video is resized to have a total area equivalent to width * height, while preserving the original aspect ratio.",
23 )
24 parser.add_argument("--fps", type=int, default=30, help="The target FPS for processing the driving video. Set to -1 to use the video's original FPS.")
25
26 parser.add_argument("--replace_flag", action="store_true", default=False, help="Whether to use replacement mode.")
27 parser.add_argument("--retarget_flag", action="store_true", default=False, help="Whether to use pose retargeting. Currently only supported in animation mode")
28 parser.add_argument(
29 "--drop_tail_invalid_frames",
30 action="store_true",
31 default=False,
32 help="Drop continuous invalid frames at the end of the driving video when body keypoints cannot be detected.",
33 )
34 parser.add_argument(
35 "--use_flux",
36 action="store_true",
37 default=False,
38 help="Whether to use image editing in pose retargeting. Recommended if the character in the reference image or the first frame of the driving video is not in a standard, front-facing pose",
39 )
40
41 # Parameters for the mask strategy in replacement mode. These control the mask's size and shape. Refer to https://arxiv.org/pdf/2502.06145
42 parser.add_argument("--iterations", type=int, default=3, help="Number of iterations for mask dilation.")
43 parser.add_argument("--k", type=int, default=7, help="Number of kernel size for mask dilation.")
44 parser.add_argument(
45 "--w_len",
46 type=int,
47 default=1,
48 help="The number of subdivisions for the grid along the 'w' dimension. A higher value results in a more detailed contour. A value of 1 means no subdivision is performed.",
49 )
50 parser.add_argument(
51 "--h_len",
52 type=int,
53 default=1,
54 help="The number of subdivisions for the grid along the 'h' dimension. A higher value results in a more detailed contour. A value of 1 means no subdivision is performed.",
55 )
56 return parser
57
58
59def process_input_video(args):

Callers 1

preprocess_data.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected