Skip to main content

Deep learning method for removing specular reflections from RGB images.

Project description

UnReflectAnything

Project PyPI Paper Weights Demo License

RGB-Only Highlight Removal by Rendering Synthetic Specular Supervision

UnReflectAnything inputs any RGB image and removes specular highlights, returning a clean diffuse-only outputs. We trained UnReflectAnything by synthetizing specularities and supervising in DINOv3 feature space.

UnReflectAnything works on both natural indoor and surgical/endoscopic domain data.


examples

Installation

pip install unreflectanything

Install UnReflectAnything as a Python Package.

The minimum required Python version is 3.11, but development and all experiments have been bases on Python 3.12.

For GPU support, make sure PyTorch comes with CUDA version for your system (see PyTorch Get Started).

Setting up

After pip-installing, you can use the unreflectanything CLI command, which is also aliased to unreflect and ura. The three commands are equivalent.

With the CLI you can already download the model weights with

unreflectanything download --weights

and some sample images with

unreflectanything download --images

Weights are stored by default in ~/.cache/unreflectanything/weights (or $XDG_CACHE_HOME/unreflectanything/weights if set ; %LOCALAPPDATA%\unreflectanything for Windows). Use --output-dir to choose another location.

Both the weights and images are stored on the HuggingFace Model Repo.

Enable shell completion

Shell completion is available for the bash and zsh shells. Run

unreflectanything completion bash

and execute the echo ... command that gets printed.

Command Line Interface

Get an overview of the available CLI endpoints with

unreflectanything --help   # alias 'unreflect --help' alias 'ura --help'

Refer to the Wiki to get detailed documentation about each endpoint. We report a summary of the available subcommands. Remember that ura is aliased to the unreflectanything command

Subcommand Description Command
inference Run inference on an image directory ura inference --input /path/to/images --output /path/to/unref_images
train Run training ura train --config config_train.yaml
test Run evaluation on a trained model ura test --config config_test.yaml
download Download checkpoint weights, sample images, notebooks ura download --weights
verify Verify weights installation and compatibility, as well as dataset directory structure ura verify --dataset /path/to/dataset
evaluate Compute metrics on output data ura evaluate --output /path/to/unref_images --gt /path/to/groundtruth_images/
completion Print shell completion (bash/zsh): ura completion bash
cite Print shell completion (bash/zsh) ura cite --bibtex

Python API

The same endpoints above are exposed as a Python API. Refer to the Wiki to get detailed documentation about each endpoint. A few examples are reported below

import unreflectanything
from unreflectanything import UnReflectModel
import torch

img = torch.from_numpy(np.array(PIL.Image.open("path/to/image.jpg")))

# Instantiate and call the model
unreflect = UnReflectModel()
unreflected_img = unreflect(img)

# Run training or testing
unreflectanything.run_pipeline(mode="train")   # or mode="test"
unreflectanything.run_pipeline(mode="test")   

# Run inference from options
options = unreflectanything.InferenceOptions(
    weights_path="path/to/full_model_weights.pt",
    input_dir="path/to/input/images",
    output_dir="path/to/output/diffuse",
)
unreflectanything.inference(options)

Citation

If you include UnReflectAnything in your pipline or research work, please cite us

@misc{rota2025unreflectanythingrgbonlyhighlightremoval,
      title={UnReflectAnything: RGB-Only Highlight Removal by Rendering Synthetic Specular Supervision}, 
      author={Alberto Rota and Mert Kiray and Mert Asim Karaoglu and Patrick Ruhkamp and Elena De Momi and Nassir Navab and Benjamin Busam},
      year={2025},
      eprint={2512.09583},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2512.09583}, 
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

unreflectanything-0.1.7.tar.gz (264.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

unreflectanything-0.1.7-py3-none-any.whl (279.8 kB view details)

Uploaded Python 3

File details

Details for the file unreflectanything-0.1.7.tar.gz.

File metadata

  • Download URL: unreflectanything-0.1.7.tar.gz
  • Upload date:
  • Size: 264.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.14

File hashes

Hashes for unreflectanything-0.1.7.tar.gz
Algorithm Hash digest
SHA256 dec51a431860efa3adcf67c83c3d3c45ba349f003ac92f05608fc8de8256d7f7
MD5 03831148a371c312c7a0faeaa0364d69
BLAKE2b-256 88c49e0d71939defe7c355f9aadd66f53a68c5ca53ac0efc1a6dacb8e4ae7009

See more details on using hashes here.

File details

Details for the file unreflectanything-0.1.7-py3-none-any.whl.

File metadata

File hashes

Hashes for unreflectanything-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 abc76eb540c77e08bbe7729e6b5c688233b76bba493487bf078678f6a21baf4a
MD5 06c76c746ce982a9bb0b058e8419284a
BLAKE2b-256 b7b3295fbd74366ad8b7f30813acf74c10c2f191620230fd780616ecc4ab208c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page