AnimeSeg
Anime Character Segmentation using Mask2Former and DINOv2 + U-Net++ with LoRA fine-tuning. Also integrates Background Removal via anime-segmentation.
Model source
- Kind
- Other
- File size
- 195 MB–1.18 GB
- Version
- vRevision c964022
- Updated
- Sep 16, 2026
- Downloads
- 1.4K
- Source
- Hugging Face
Source excerpt
Anime Character Segmentation using Mask2Former and DINOv2 + U-Net++ with LoRA fine-tuning. Also integrates Background Removal via anime-segmentation.
Sources
1 source
Sources
1 sourceVerified Sep 1
Model artifacts
4 artifacts
Model artifacts
4 artifactsmodels/anime_seg_dinov2_v2.safetensors
safetensors · 1.18 GB · SHA-256 cc07a0b557f9…5af9 · Hugging Face
Downloadmodels/anime_seg_mask2former_v3.safetensors
safetensors · 412 MB · SHA-256 f6764a379496…c394 · Hugging Face
Downloadmodels/anime_seg_mask2former_v4.safetensors
safetensors · 826 MB · SHA-256 b7b684be5f68…4ea1 · Hugging Face
Downloadmodels/remove_bg/BgRemover.safetensors
safetensors · 195 MB · SHA-256 3351563ba8b6…5d3e · Hugging Face
DownloadSource excerpts
2 excerpts
Source excerpts
2 excerpts--- pipeline_tag: image-segmentation library_name: transformers --- # AnimeSeg <p> <a href="https://pepy.tech/project/anime_seg"><img alt="GitHub release" src="https://static.pepy.tech/badge/anime_seg"></a> <a href="https://github.com/suzukimain/AnimeSeg/releases"><img alt="GitHub release" src="https://img.shields.io/github/release/suzukimain/AnimeSeg.svg"></a> <img src="https://visitor-badge.laobi.icu/badge?page_id=suzukimain.AnimeSeg" alt="Visitor Badge"> </p> Anime Character Segmentation using Mask2Former and DINOv2 + U-Net++ with LoRA fine-tuning. Also integrates Background Removal via [anime-segmentation](https://github.com/SkyTNT/anime-segmentation). ## sample image <p align="center"> <img src="https://raw.githubusercontent.com/suzukimain/AnimeSeg/refs/heads/main/images/sample2.png" alt="sample image" width="100%"> </p> ## Installation ```bash pip install anime_seg ``` ## Usage ```python from anime_seg import AnimeSegPipeline pipe = AnimeSegPipeline.from_mask2former().to("cuda") mask = pipe("path/to/image.jpg") mask.save("output.png") # Background Removal (powered by anime-segmentation) bg_pipe = AnimeSegPipeline.from_bg_remover().to("cuda") no_bg_img = bg_pipe("path/to/image.jpg") no_bg_img.save("no_bg_output.png") ``` `AnimeSegPipeline()` default constructor is deprecated. Use `from_mask2former()`, `from_dinoV2()`, or `from_bg_remover()`. ## Optional: output size ```python # Same as input size (default) mask_same = pipe("path/to/image.jpg") # Fixed output size mask_fixed = pipe("path/to/image.jpg", width=1024, height=1024) # Width/height can be specified independently mask_w = pipe("path/to/image.jpg", width=1024) mask_h = pipe("path/to/image.jpg", height=1024) ``` ## Advanced Usage ```python # Load specific file from HF repo pipe = AnimeSegPipeline.from_mask2former( repo_id="suzukimain/AnimeSeg", filename="models/anime_seg_mask2former_v3.safetensors" ).to(device="cuda") # DINOv2 backend pipe_dino = AnimeSegPipeline.from_dinoV2( filename="models/anime_seg_dinov2_v2.safetensors" ).to("cuda") # Use PIL Image from PIL import Image img = Image.open("image.jpg") mask = pipe(img) # Background Removal (powered by anime-segmentation) bg_pipe = AnimeSegPipeline.from_bg_remover().to("cuda") no_bg_img = bg_pipe("path/to/image.jpg") no_bg_img.save("no_bg_output.png") ``` ## Model Files Models should follow the naming convention: `...
Source context: 1429 downloads · 0 likes · Pipeline image-segmentation · Library transformers · Repo suzukimain/AnimeSeg
