SkillAgentSearch skills...

Detoxai

Python toolkit for debiasing neural networks in image classification tasks

Install / Use

/learn @DetoxAI/Detoxai
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

| thumbnail | DetoxAI is a Python package for debiasing neural networks in image classification tasks. It transforms biased models into fair and balanced ones with minimal code changes. | |:-------------------------:|:----------------------------:| | Website and demo: https://detoxai.github.io| Documentation: https://detoxai.readthedocs.io |

Python tests

Installation

Install DetoxAI from PyPI:

pip install detoxai

Quickstart

import detoxai

model = ...
dataloader = ...  # should output (input, label, protected attributes)

corrected = detoxai.debias(model, dataloader)

metrics = corrected["SAVANIAFT"].get_all_metrics()
model = corrected["SAVANIAFT"].get_model()

Minimal runnable example:

import torch
import torchvision
import detoxai

model = torchvision.models.resnet18(pretrained=True)
model.fc = torch.nn.Linear(model.fc.in_features, 2)

X = torch.rand(128, 3, 224, 224)
Y = torch.randint(0, 2, size=(128,))
PA = torch.randint(0, 2, size=(128,))

dataloader = torch.utils.data.DataLoader(list(zip(X, Y, PA)), batch_size=32)

results: dict[str, detoxai.CorrectionResult] = detoxai.debias(model, dataloader)

More examples: see examples/ folder.

How DetoxAI Works

Workflow

DetoxAI transforms biased neural networks into fair models with simple code integration.

Key Features

🛠️ Multiple Debiasing Methods

Learn how to add your own method →

📀 Dataset Integration

Learn how to use datasets →

📊 Visualization Tools

  • Saliency maps with Layer-wise Relevance Propagation (paper)
  • Side-by-side comparisons of original vs. debiased models
  • Aggregate visualizations to track model focus shift

Explore visualization tools →

| Before/After Saliency Map | Aggregate Bias Visualization | |:-------------------------:|:----------------------------:| | Side-by-side LRP | Aggregate visualization | | Saliency maps show model focus during classification. |Aggregate visualizations show focus shift after debiasing. |

💻 Simple API

  • Works with existing PyTorch models
  • Standard dataloaders
  • Single function call for multiple debiasing methods

See a complete example →

Development

Install the environment using uv (recommended)

curl -LsSf https://astral.sh/uv/install.sh | sh
# or pip install uv

uv venv
uv pip install -r pyproject.toml
source .venv/bin/activate

python main.py

Alternatively, install the environment using pip

pip install .
# or pip install -e . for editable install

Pre-commit hooks

pre-commit install
pre-commit run --all-files

Rebuild documentation

chmod u+x ./build_docs.sh
./build_docs.sh

Acknowledgment

If you use DetoxAI, please cite:

@misc{detoxai2025,
  author={Ignacy Stepka and Lukasz Sztukiewicz and Michal Wilinski and Jerzy Stefanowski},
  title={DetoxAI: a Python Toolkit for Debiasing Deep Learning Models in Computer Vision},
  year={2025},
  url={https://github.com/DetoxAI/detoxai},
}

License

MIT License

View on GitHub
GitHub Stars81
CategoryEducation
Updated1mo ago
Forks2

Languages

Python

Security Score

100/100

Audited on Feb 15, 2026

No findings