Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
P

ProPainter

> 开发工具
Open source

[ICCV 2023] ProPainter: Improving Propagation and Transformer for Video Inpainting

6.8K stars0 likes0 views
WebsiteGitHub

About

[ICCV 2023] ProPainter: Improving Propagation and Transformer for Video Inpainting

ProPainter: Improving Propagation and Transformer for Video Inpainting

⭐ If ProPainter is helpful to your projects, please help star this repo. Thanks!

:open_book: For more visual results, go checkout our project page


Update

  • 2023.11.09: Integrated to :man_artist: OpenXLab. Try out online demo!
  • 2023.11.09: Integrated to :hugs: Hugging Face. Try out online demo!
  • 2023.09.24: We remove the watermark removal demos officially to prevent the misuse of our work for unethical purposes.
  • 2023.09.21: Add features for memory-efficient inference. Check our GPU memory requirements.
  • 2023.09.07: Our code and model are publicly available.
  • 2023.09.01: This repo is created.

TODO

  • Make a Colab demo.
  • Make a interactive Gradio demo.
  • Update features for memory-efficient inference.

Results

‍ Object Removal

Video Completion

Overview

Dependencies and Installation

  1. Clone Repo

    bash
    git clone https://github.com/sczhou/ProPainter.git
  2. Create Conda Environment and Install Dependencies

    bash
    # create new anaconda env
    conda create -n propainter python=3.8 -y
    conda activate propainter
    
    # install python dependencies
    pip3 install -r requirements.txt
    • CUDA >= 9.2
    • PyTorch >= 1.7.1
    • Torchvision >= 0.8.2
    • Other required packages in requirements.txt

Get Started

Prepare pretrained models

Download our pretrained models from Releases V0.1.0 to the weights folder. (All pretrained models can also be automatically downloaded during the first inference.)

The directory structure will be arranged as:

weights
   |- ProPainter.pth
   |- recurrent_flow_completion.pth
   |- raft-things.pth
   |- i3d_rgb_imagenet.pt (for evaluating VFID metric)
   |- README.md

Quick test

We provide some examples in the inputs folder. Run the following commands to try it out:

bash
# The first example (object removal)
python inference_propainter.py --video inputs/object_removal/bmx-trees --mask inputs/object_removal/bmx-trees_mask 
# The second example (video completion)
python inference_propainter.py --video inputs/video_completion/running_car.mp4 --mask inputs/video_completion/mask_square.png --height 240 --width 432

The results will be saved in the results folder. To test your own videos, please prepare the input mp4 video (or split frames) and frame-wise mask(s).

If you want to specify the video resolution for processing or avoid running out of memory, you can set the video size of --width and --height:

bash
# process a 576x320 video; set --fp16 to use fp16 (half precision) during inference.
python inference_propainter.py --video inputs/video_completion/running_car.mp4 --mask inputs/video_completion/mask_square.png --height 320 --width 576 --fp16

Interactive Demo

We also provide an interactive demo for object removal, allowing users to select any object they wish to remove from a video. You can try the demo on Hugging Face or run it locally.

Please note that the demo's interface and usage may differ from the GIF animation above. For detailed instructions, refer to the user guide.

Memory-efficient inference

Video inpainting typically requires a significant amount of GPU memory. Here, we offer various features that facilitate memory-efficient inference, effectively avoiding the Out-Of-Memory (OOM) error. You can use the following options to reduce memory usage further:

  • Reduce the number of local neighbors through decreasing the --neighbor_length (default 10).
  • Reduce the number of global references by increasing the --ref_stride (default 10).
  • Set the --resize_ratio (default 1.0) to resize the processing video.
  • Set a smaller video size via specifying the --width and --height.
  • Set --fp16 to use fp16 (half precision) during inference.
  • Reduce the frames of sub-videos --subvideo_length (default 80), which effectively decouples GPU memory costs and video length.

Blow shows the estimated GPU memory requirements for different sub-video lengths with fp32/fp16 precision:

Resolution 50 frames 80 frames
1280 x 720 28G / 19G OOM / 25G
720 x 480 11G / 7G 13G / 8G
640 x 480 10G / 6G 12G / 7G
320 x 240 3G / 2G 4G / 3G

Dataset preparation

Dataset YouTube-VOS DAVIS
Description For training (3,471) and evaluation (508) For evaluation (50 in 90)
Images [Official Link] (Download train and test all frames) [Official Link] (2017, 480p, TrainVal)
Masks [Google Drive] [Baidu Disk] (For reproducing paper results; provided in ProPainter paper)

The training and test split files are provided in datasets/<dataset_name>. For each dataset, you should place JPEGImages to datasets/<dataset_name>. Resize all video frames to size 432x240 for training. Unzip downloaded mask files to datasets.

The datasets directory structure will be arranged as: (Note: please check it carefully)

datasets
   |- davis
      |- JPEGImages_432_240
         |- <video_name>
            |- 00000.jpg
            |- 00001.jpg
      |- test_masks
         |- <video_name>
            |- 00000.png
            |- 00001.png   
      |- train.json
      |- test.json
   |- youtube-vos
      |- JPEGImages_432_240
         |- <video_name>
            |- 00000.jpg
            |- 00001.jpg
      |- test_masks
         |- <video_name>
            |- 00000.png
            |- 00001.png
      |- train.json
      |- test.json   

Training

Our training configures are provided in train_flowcomp.json (for Recurrent Flow Completion Network) and train_propainter.json (for ProPainter).

Run one of the following commands for training:

bash
 # For training Recurrent Flow Completion Network
 python train.py -c configs/train_flowcomp.json
 # For training ProPainter
 python train.py -c configs/train_propainter.json

You can run the same command to resume your training.

To speed up the training process, you can precompute optical flow for the training dataset using the following command:

bash
 # Compute optical flow for training dataset
 python scripts/compute_flow.py --root_path <dataset_root> --save_path <save_flow_root> --height 240 --width 432

Evaluation

Run one of the following commands for evaluation:

bash
 # For evaluating flow completion model
 python scripts/evaluate_flow_completion.py --dataset <dataset_name> --video_root <video_root> --mask_root <mask_root> --save_results
 # For evaluating ProPainter model
 python scripts/evaluate_propainter.py --dataset <dataset_name> --video_root <video_root> --mask_root <mask_root> --save_results

The scores and results will also be saved in the results_eval folder. Please --save_results for further evaluating temporal warping error.

Citation

If you find our repo useful for your research, please consider citing our paper:

bibtex
@inproceedings{zhou2023propainter,
   title={{ProPainter}: Improving Propagation and Transformer for Video Inpainting},
   author={Zhou, Shangchen and Li, Chongyi and Chan, Kelvin C.K and Loy, Chen Change},
   booktitle={Proceedings of IEEE International Conference on Computer Vision (ICCV)},
   year={2023}
}

License

Non-Commercial Use Only Declaration

The ProPainter is made available for use, reproduction, and distribution strictly for non-commercial purposes. The code and models are licensed under NTU S-Lab License 1.0. Redistribution and use should follow this license.

For inquiries or to obtain permission for commercial use, please consult Dr. Shangchen Zhou ([email protected]).

Projects that use ProPainter

If you develop or use ProPainter in your projects, feel free to let me know. Also, please include this ProPainter repo link, authorship information, and our S-Lab license (with link).

Projects/Applications from the Community

  • Streaming ProPainter: https://github.com/osmr/propainter
  • Faster ProPainter: https://github.com/halfzm/faster-propainter
  • ProPainter WebUI: https://github.com/halfzm/ProPainter-Webui
  • ProPainter ComfyUI: https://github.com/daniabib/ComfyUI_ProPainter_Nodes
  • Cutie (video segmentation): https://github.com/hkchengrex/Cutie
  • Cinetransfer (character transfer): https://virtualfilmstudio.github.io/projects/cinetransfer
  • Motionshop (character transfer): https://aigc3d.github.io/motionshop

PyPI

  • propainter: https://pypi.org/project/propainter
  • pytorchcv: https://pypi.org/project/pytorchcv

Contact

If you have any questions, please feel free to reach me out at [email protected].

Acknowledgement

This code is based on E2FGVI and STTN. Some code are brought from BasicVSR++. Thanks for their awesome works.

Special thanks to Yihang Luo for his valuable contributions to build and maintain the Gradio demos for ProPainter.

Issues· 79 open

View all issuesOpen on GitHub
  • #122

    Should I train Flow Completion from scratch or fine-tune the released recurrent_flow_completion.pth on my own dataset?

    Updated Jul 14, 2026
  • #120

    Green frame output on modern PyTorch / CUDA — imageio.mimwrite RGB→YUV conversion bug

    Updated Apr 14, 2026
  • #103

    propainter inference speed up

    Updated Apr 4, 2026
  • #82

    pretrained Discriminator

    Updated Mar 29, 2026
  • #119

    The discriminator weights

    Updated Mar 26, 2026
  • #118

    cxv

    Updated Mar 26, 2026
  • #116

    tt saus. bs

    Updated Mar 11, 2026
  • #113

    How to run it?

    Updated Dec 7, 2025
  • #92

    AMD Ryzen 5 5600 + RX5700 8G not available

    Updated Dec 5, 2025
  • #88

    Demo not working

    Updated Nov 17, 2025

> Tags

Pythonobject-removalvideo-completionvideo-inpaintingvideo-outpainting

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 23, 2026
Category开发工具
PricingOpen source

> Related tools

V
VS Code
流行的开源代码编辑器
G
Git
分布式版本控制系统
V
Vite
下一代前端构建工具