ReX is a causal explainability tool for image classifiers. It also works on tabular and 3D data.
Given an input image and a classifier, ReX calculates a causal responsibility map across the data and identifies a minimal, sufficient, explanation.
ReX is black-box, that is, agnostic to the internal structure of the classifier. ReX finds single explanations, non-contiguous explanations (for partially obscured images), multiple independent explanations, contrastive explanations and lots of other things! It has a host of options and parameters, allowing you to fine tune it to your data.
For background information and detailed usage instructions, see our documentation.
ReX can be installed using pip
.
We recommend creating a virtual environment to install ReX.
ReX has been tested using versions of Python >= 3.10.
The following instructions assume conda
:
conda create -n rex python=3.13
conda activate rex
pip install rex_xai
This should install an executable rex
in your path.
Note:
By default,
onnxruntime
will be installed. If you wish to use a GPU, you should uninstallonnxruntime
and installonnxruntime-gpu
instead. You can alternatively clone the project and edit thepyproject.toml
to read "onnxruntime-gpu >= 1.17.0" rather than "onnxruntime >= 1.17.0".
If you want to use ReX with 3D data, you will need to install some optional extra dependenices:
pip install 'rex_xai[3D]'
Bug reports, questions, and suggestions for enhancements are welcome - please check the GitHub Issues to see if there is already a relevant issue, or open a new one!
Your contributions are highly valued and welcomed. To get started, please review the guidelines outlined in the CONTRIBUTING.md file. We look forward to your participation!