Skip to content

maxwoe/image-rotation-angle-estimation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Image Rotation Angle Estimation

arXiv Demo Models License: MIT

Estimate how much an image has been rotated from its upright orientation. No labels needed. Includes pretrained models, an interactive demo, and training code for custom datasets.

Quick Start

Requires Python 3.10+, CUDA 11.8+ recommended. Clone the repo, then:

pip install -r requirements.txt

Download a pretrained checkpoint from the HuggingFace Hub and place it in weights/:

weights/
└── cgd_mambaout_base_coco2017.ckpt

Then launch the demo:

python app.py  # opens Gradio UI at http://localhost:7861

For Python inference, see the HuggingFace model card.

Train on Your Own Images

No annotation files or labels needed. Just a folder of correctly-oriented images. The pipeline applies random rotations during training and learns to predict the applied angle.

python train.py --approach cgd --model-name mambaout_base \
  --train-dir path/to/your/images --validation-split 0.1 \
  --batch-size 16 --mixed-precision \
  --test-dirs path/to/test/images --run-test

Evaluation only

python train.py --approach cgd --model-name mambaout_base \
  --train-dir path/to/your/images --validation-split 0.1 \
  --batch-size 16 \
  --test-dirs path/to/test/images \
  --test-only --test-ckpt path/to/checkpoint.ckpt \
  --test-random-seed 0

For reproducing paper results on DRC-D and COCO, see data/DATASETS.md.

Results

Best results on the DRC-D test set (mean of 5 seeds):

Method Architecture MAE (°)
CLS EfficientViT-B3 1.23
CGD MambaOut Base 1.24

Transfer to COCO, tested on 1,030 val images (CGD + MambaOut Base):

Training Data MAE (°)
COCO 2014 3.71
COCO 2017 2.84

Methods

Five circular-aware approaches are implemented and benchmarked. CGD performs best overall. See the paper for a full comparison.

Abbreviation Approach Description
DA Direct Angle Scalar regression with circular loss
CLS Classification Angular binning (360 bins)
UV Unit Vector Regression on (cos θ, sin θ)
PSC Phase-Shifting Coder Frequency-domain encoding
CGD Circular Gaussian Distribution Probabilistic soft targets via KL divergence

Citation

@misc{woehrer2026irae,
  title={Image Rotation Angle Estimation: Comparing Circular-Aware Methods},
  author={Woehrer, Maximilian},
  year={2026},
  eprint={2603.25351},
  archivePrefix={arXiv},
  primaryClass={cs.CV},
  url={https://arxiv.org/abs/2603.25351}
}

About

Estimate image rotation angles using circular-aware deep learning methods. Includes 5 approaches, pretrained models, and an interactive demo.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors