()
| 172 | |
| 173 | |
| 174 | def parse_args(): |
| 175 | parser = argparse.ArgumentParser() |
| 176 | parser.add_argument("input", help="Input video.") |
| 177 | parser.add_argument("--ckpt", type=str, default="./pretrained_models/amt-g.pth", help="The pretrained model.") |
| 178 | parser.add_argument( |
| 179 | "--niters", |
| 180 | type=int, |
| 181 | default=1, |
| 182 | help="Iter of Interpolation. The number of frames will be double after per iter.", |
| 183 | ) |
| 184 | parser.add_argument("--output_path", type=str, default="samples", help="Output path.") |
| 185 | parser.add_argument("--fps", type=int, default=8, help="Frames rate of the output video.") |
| 186 | parser.add_argument("--folder", action="store_true", help="If the input is a folder, set this flag.") |
| 187 | args = parser.parse_args() |
| 188 | |
| 189 | times_frame = 2**args.niters |
| 190 | old_fps = args.fps |
| 191 | args.fps = args.fps * times_frame |
| 192 | print(f"Interpolation will turn {old_fps}fps video to {args.fps}fps video.") |
| 193 | args.input = os.path.expanduser(args.input) |
| 194 | args.ckpt = os.path.expanduser(args.ckpt) |
| 195 | args.folder = osp.splitext(args.input)[-1].lower() not in VID_EXT |
| 196 | args.ckpt = download_model(local_path=args.ckpt, url=hf_endpoint + "/lalala125/AMT/resolve/main/amt-g.pth") |
| 197 | return args |
| 198 | |
| 199 | |
| 200 | if __name__ == "__main__": |
no test coverage detected