Downloads · 30 days
0
DuarteBarbosa/deep-image-orientation-detection
deep-image-orientation-detection is a machine learning model from DuarteBarbosa. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
This project implements a deep learning model to detect the orientation of images and determine the rotation needed to correct them. It uses a pre-trained EfficientNetV2 model from PyTorch, fine-tuned for the task of…
Downloads · 30 days
0
Access
Public
Updated Jul 13, 2025
Repo size
487 MB
Likes
14
Public
Click a slice to open those files.
.pth81.6 MB · 50%
From the Hugging Face model README
This project implements a deep learning model to detect the orientation of images and determine the rotation needed to correct them. It uses a pre-trained EfficientNetV2 model from PyTorch, fine-tuned for the task of classifying images into four orientation categories: 0°, 90°, 180°, and 270°.
The model achieves 98.82% accuracy on the validation set.
This model was trained on a single NVIDIA H100 GPU, taking 5 hours, 5 minutes and 37 seconds to complete.
The model is trained on a dataset of images, where each image is rotated by 0°, 90°, 180°, and 270°. The model learns to predict which rotation has been applied. The prediction can then be used to determine the correction needed to bring the image to its upright orientation.
The four classes correspond to the following rotations:
The model was trained on several datasets:
The model was trained on a huge dataset of 189,018 unique images. Each image is augmented by being rotated in four ways (0°, 90°, 180°, 270°), creating a total of 756,072 samples. This augmented dataset was then split into 604,857 samples for training and 151,215 samples for validation.
For detailed usage instructions, including how to run predictions, export to ONNX, and train the model, please refer to the GitHub repository.
For a dataset of non-compressed 5055 images, the performance on a RTX 4080 running in single-thread was:
predict.py): 135.71 secondspredict_onnx.py): 60.83 secondsFor more in-depth information about the project, including the full source code, training scripts, and detailed documentation, please visit the GitHub repository.