Quick Access:
- π Paper: arXiv:2509.06839
- π€ Model: joelseytre/toonout
- π Dataset: joelseytre/toonout
While state-of-the-art background removal models excel at realistic imagery, they frequently underperform in specialized domainsβsuch as anime-style content, where complex features like hair and transparency present unique challenges.
To address this limitation, we collected and annotated a custom dataset of 1,228 high-quality anime images of characters and objects, and fine-tuned the open-sourced BiRefNet model on this dataset. The resulting model, ToonOut, shows marked improvements in background removal accuracy for anime-style images, achieving an increase in Pixel Accuracy from 95.3% to 99.5% on our test set.
βββ birefnet/ # Core library code
βββ scripts/ # Python scripts (training, evaluation, etc.)
βββ bash_scripts/ # Bash entrypoint scripts
βββ LICENSE # MIT License (code + weights)
βββ LICENSE-DATASET # CC-BY 4.0 License (dataset)
βββ toonout_demo.ipynb # demo running inference using fine-tuned weights
This repository is a fork of the original BiRefNet with enhanced functionality and corrected settings for anime-style background removal.
Disclaimer: this repo was used on an environment with 2x GeForce RTW 4090 instances with 24GB of VRAM. You might need to adapt some of your settings to run the same scripts we used (in particular: the number of GPUs)
- Adjusted Training Settings: Added
train_finetuning.shwith proper configuration to avoid NaN gradient problems (switched tobfloat16data type) - Fixed Evaluation: Added
evaluations.pywith corrected settings from the originaleval_existingOnes.py - Reorganized Structure: Separated code into three organized folders:
scripts/for Python scriptsbash_scripts/for bash entrypoint scriptsbirefnet/for core library files
Each Python script has a corresponding bash script for easy execution:
- Data Splitting: Takes original and annotated image folders β splits into train/validation/test sets
- Training: Trains the neural network β saves checkpoints to a folder
- Testing: Takes a checkpoint β generates and saves predictions
- Evaluation: Takes model predictions β computes metrics on the test set
- Visualization: Takes predictions from multiple models (fine-tuned/baseline/external) β visualizes results and ranks models by chosen metrics
- Baseline Predictions: Generate baseline model predictions from RGB input folders
- Alpha Mask Generation: Extract alpha channel masks from RGBA annotated images
- Photoroom Integration: Generate Photoroom API predictions from RGB folders
git clone https://github.com/MatteoKartoon/BiRefNet.git
cd BiRefNet
pip install -r requirements.txtbash bash_scripts/train_finetuning.shpython scripts/evaluations.py --checkpoint path/to/checkpointThe dataset consists of 1,228 annotated anime images, curated and labeled for background removal tasks.
- License: CC-BY 4.0 (must credit authors)
The dataset is organized into train, test, and val splits, with each split containing multiple generation folders. Within each generation folder, you'll find three subfolders:
im/: Raw RGB imagesgt/: Ground truth transparency masksan/: Combined RGBA images with transparency
toonout_dataset/
βββ train/
β βββ train_generations_20250318_emotion/
β β βββ im/ # RGB images
β β βββ gt/ # Ground truth masks
β β βββ an/ # RGBA annotated images
β βββ train_generations_*/...
βββ test/
β βββ test_generations_*/...
βββ val/
βββ validation_generations_*/...
The fine-tuned ToonOut weights are provided for easy inference.
- License: MIT
Example usage:
coming soon
This repository accompanies the paper:
ToonOut: Fine-tuned Background Removal for Anime Characters
Matteo Muratori (University of Bologna, Kartoon AI), JoΓ«l Seytre (Kartoon AI)
If you use this work, please cite:
@misc{muratori2025toonout,
title={ToonOut: Fine-tuned Background Removal for Anime Characters},
author={Muratori, Matteo and Seytre, JoΓ«l},
year={2025},
eprint={2509.06839},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2509.06839},
doi={10.48550/arXiv.2509.06839}
}Project by Kartoon AI, powering toongether, check us out at kartoon.ai & toongether.ai
This project is forked from BiRefNet, originally licensed under MIT.


