Inpaint Anything: Segment Anything Meets Image Inpainting Inpaint Anything can inpaint anything in images, videos and 3D scenes! Authors: Tao Yu, Runseng Feng, Ruoyu Feng, Jinming Liu, Xin Jin, Wenjun Zeng and Zhibo Chen. Institutes: University of Science and Technology of China; Eastern Institute for Advanced Study. [Paper] [Website] [Hugging Face Homepage] TL; DR: Users can select any object in an image by…
TL; DR: Users can select any object in an image by clicking on it. With powerful vision models, e.g., SAM, LaMa and Stable Diffusion (SD), Inpaint Anything is able to remove the object smoothly (i.e., Remove Anything). Further, prompted by user input text, Inpaint Anything can fill the object with any desired content (i.e., Fill Anything) or replace the background of it arbitrarily (i.e., Replace Anything).
SAM 3 video predictor — one less model and checkpoint
Video inpainting
STTN
ProPainter
Text-guided fill / replace
SD 2 (no longer downloadable)
SDXL, optional FLUX.1-Fill
Robotics
—
remove_hands.py — batch hand removal for Human-to-Robot pipelines
Two things you can do there that you cannot do here:
Name the object instead of clicking it.--text_select "dog" finds every match, which also means the pipelines can run unattended over a whole dataset.
Prepare egocentric data for robot learning.remove_hands.py erases human hands from egocentric video and exports the masks — the hand removal and inpainting stage of Human-to-Robot synthesis pipelines such as Qwen-RobotManip and EgoEngine. On EgoMimic footage it matches human annotation at IoU 0.96, and it reconstructs the background rather than blacking the arm out.
git checkout main_2026
# then follow the Quick start in that branch's README
⚠️ main_2026 is in beta. It needs Python ≥ 3.12, PyTorch ≥ 2.7 and
CUDA ≥ 12.6 (SAM 3’s floor), and the NeRF-based 3D path has not been
end-to-end verified on that stack yet. Every legacy backend
(SAM 1 / MobileSAM, OSTrack, STTN) is still selectable by flag, so you can fall
back per stage.
🤝 Contributions very welcome — especially on the robotics side. Issues and
PRs against main_2026 are appreciated: more egocentric datasets, action
retargeting, robot rendering and compositing, or newer inpainting backends.
Please open an issue if you hit anything.
📜 News
[2026/7/28] 🔥NEWmain_2026branch (beta): upgraded to SAM 3 with text prompts, ProPainter for video, SDXL/FLUX for text-guided editing, and robotics support via remove_hands.py. OSTrack is no longer needed. Contributions welcome!
[2023/9/15] Remove Anything 3D code is available!
[2023/4/30] Remove Anything Video available! You can remove any object from a video!
[2023/4/24] Local web UI supported! You can run the demo website locally!
[2023/4/22] Website available! You can experience Inpaint Anything through the interface!
[2023/4/22] Remove Anything 3D available! You can remove any 3D object from a 3D scene!
[2023/4/13] Technical report on arXiv available!
Download the model checkpoints provided in Segment Anything and LaMa (e.g., sam_vit_h_4b8939.pth and big-lama), and put them into ./pretrained_models. For simplicity, you can also go here, directly download pretrained_models, put the directory into ./ and get ./pretrained_models.
For MobileSAM, the sam_model_type should use “vit_t”, and the sam_ckpt should use “./weights/mobile_sam.pt”.
For the MobileSAM project, please refer to MobileSAM
bash script/remove_anything.sh
Specify an image and a point, and Remove Anything will remove the object at the point.
You can change --coords_type key_in to --coords_type click if your machine has a display device. If click is set, after running the above command, the image will be displayed. (1) Use left-click to record the coordinates of the click. It supports modifying points, and only last point coordinates are recorded. (2) Use right-click to finish the selection.
Demo
📌 Fill Anything
Text prompt: "a teddy bear on a bench"
Click on an object, type in what you want to fill, and Inpaint Anything will fill it!
Download the model checkpoints provided in Segment Anything (e.g., sam_vit_h_4b8939.pth) and put them into ./pretrained_models. For simplicity, you can also go here, directly download pretrained_models, put the directory into ./ and get ./pretrained_models.
For MobileSAM, the sam_model_type should use “vit_t”, and the sam_ckpt should use “./weights/mobile_sam.pt”.
For the MobileSAM project, please refer to MobileSAM
bash script/fill_anything.sh
Specify an image, a point and text prompt, and run:
Download the model checkpoints provided in Segment Anything (e.g. sam_vit_h_4b8939.pth) and put them into ./pretrained_models. For simplicity, you can also go here, directly download pretrained_models, put the directory into ./ and get ./pretrained_models.
For MobileSAM, the sam_model_type should use “vit_t”, and the sam_ckpt should use “./weights/mobile_sam.pt”.
For the MobileSAM project, please refer to MobileSAM
bash script/replace_anything.sh
Specify an image, a point and text prompt, and run:
Download the model checkpoints provided in Segment Anything and LaMa (e.g., sam_vit_h_4b8939.pth), and put them into ./pretrained_models. Further, download OSTrack pretrained model from here (e.g., vitb_384_mae_ce_32x4_ep300.pth) and put it into ./pytracking/pretrain. In addition, download [nerf_llff_data] (e.g, horns), and put them into ./example/3d. For simplicity, you can also go here, directly download pretrained_models, put the directory into ./ and get ./pretrained_models. Additionally, download pretrain, put the directory into ./pytracking and get ./pytracking/pretrain.
For MobileSAM, the sam_model_type should use “vit_t”, and the sam_ckpt should use “./weights/mobile_sam.pt”.
For the MobileSAM project, please refer to MobileSAM
bash script/remove_anything_3d.sh
Specify a 3d scene, a point, scene config and mask index (indicating using which mask result of the first view), and Remove Anything 3D will remove the object from the whole scene.
The --mask_idx is usually set to 1, which typically is the most confident mask result of the first frame. If the object is not segmented out well, you can try other masks (0 or 2).
📌 Remove Anything Video
With a single click on an object in the first video frame, Remove Anything Video can remove the object from the whole video!
Click on an object in the first frame of a video;
SAM segments the object out (with three possible masks);
Select one mask;
A tracking model such as OSTrack is ultilized to track the object in the video;
SAM segments the object out in each frame according to tracking results;
A video inpainting model such as STTN is ultilized to inpaint the object in each frame.
Download the model checkpoints provided in Segment Anything and STTN (e.g., sam_vit_h_4b8939.pth and sttn.pth), and put them into ./pretrained_models. Further, download OSTrack pretrained model from here (e.g., vitb_384_mae_ce_32x4_ep300.pth) and put it into ./pytracking/pretrain. For simplicity, you can also go here, directly download pretrained_models, put the directory into ./ and get ./pretrained_models. Additionally, download pretrain, put the directory into ./pytracking and get ./pytracking/pretrain.
For MobileSAM, the sam_model_type should use “vit_t”, and the sam_ckpt should use “./weights/mobile_sam.pt”.
For the MobileSAM project, please refer to MobileSAM
bash script/remove_anything_video.sh
Specify a video, a point, video FPS and mask index (indicating using which mask result of the first frame), and Remove Anything Video will remove the object from the whole video.
The --mask_idx is usually set to 2, which typically is the most confident mask result of the first frame. If the object is not segmented out well, you can try other masks (0 or 1).
If you find this work useful for your research, please cite us:
@article{yu2023inpaint,
title={Inpaint Anything: Segment Anything Meets Image Inpainting},
author={Yu, Tao and Feng, Runseng and Feng, Ruoyu and Liu, Jinming and Jin, Xin and Zeng, Wenjun and Chen, Zhibo},
journal={arXiv preprint arXiv:2304.06790},
year={2023}
}
评论