maxwoe commited on
Commit
cd023dd
·
1 Parent(s): 3552a79

Update model card

Browse files
Files changed (1) hide show
  1. README.md +80 -87
README.md CHANGED
@@ -1,87 +1,80 @@
1
- ---
2
- license: mit
3
- tags:
4
- - image-rotation
5
- - orientation-estimation
6
- - angle-detection
7
- - circular-gaussian-distribution
8
- - mambaout
9
- - pytorch
10
- datasets:
11
- - coco
12
- metrics:
13
- - mae
14
- pipeline_tag: image-classification
15
- ---
16
-
17
- # Image Rotation Angle Estimation
18
-
19
- **[Try the interactive demo](https://huggingface.co/spaces/maxwoe/image-rotation-angle-estimation)**
20
-
21
- Predicts the rotation angle of an image using the **Circular Gaussian Distribution (CGD)** method with a **MambaOut Base** backbone.
22
-
23
- The model outputs a probability distribution over 360 angle bins (1 degree resolution) and extracts the predicted angle via argmax. It handles the full 360 degree range with no boundary discontinuities.
24
-
25
- ## Available Checkpoints
26
-
27
- | Checkpoint | Dataset | MAE | Median Error |
28
- |---|---|---|---|
29
- | `cgd_mambaout_base_coco2017.ckpt` | COCO 2017 | 2.84 deg | 0.55 deg |
30
- | `cgd_mambaout_base_coco2014.ckpt` | COCO 2014 | 3.71 deg | 0.68 deg |
31
-
32
- ## Usage
33
-
34
- The inference code (`model_cgd.py`, `architectures.py`, `rotation_utils.py`) is included in this repo.
35
-
36
- ```python
37
- from huggingface_hub import snapshot_download
38
-
39
- # Download inference code
40
- snapshot_download(
41
- repo_id="maxwoe/image-rotation-angle-estimation",
42
- allow_patterns=["*.py", "*.json"],
43
- local_dir=".",
44
- )
45
-
46
- # Load model (defaults to COCO 2017 checkpoint)
47
- from model_cgd import CGDAngleEstimation
48
- model = CGDAngleEstimation.from_pretrained("maxwoe/image-rotation-angle-estimation")
49
-
50
- # Or load a specific checkpoint by filename
51
- # model = CGDAngleEstimation.from_pretrained(
52
- # "maxwoe/image-rotation-angle-estimation",
53
- # model_name="cgd_mambaout_base_coco2014.ckpt",
54
- # )
55
-
56
- # Predict rotation angle
57
- from PIL import Image
58
- image = Image.open("your_image.jpg")
59
- angle = model.predict_angle(image)
60
- print(f"Predicted rotation: {angle:.2f} degrees")
61
- ```
62
-
63
- ## Evaluation Results (COCO 2017, 5 seeds)
64
-
65
- | Metric | Value |
66
- |---|---|
67
- | MAE | 2.84 deg |
68
- | Median Error | 0.55 deg |
69
- | RMSE | 8.45 deg |
70
- | P90 Error | 3.54 deg |
71
- | P95 Error | 12.00 deg |
72
- | Accuracy at 2 deg | 90.2% |
73
- | Accuracy at 5 deg | 97.5% |
74
- | Accuracy at 10 deg | 98.1% |
75
-
76
- ## Model Details
77
-
78
- - **Method:** Circular Gaussian Distribution (CGD) — 360 bins, sigma = 6.0 degrees
79
- - **Backbone:** MambaOut Base (`mambaout_base.in1k`), pretrained on ImageNet-1K
80
- - **Input size:** 224 x 224 pixels
81
- - **Output:** Probability distribution over 360 angle bins, converted to angle via argmax
82
- - **Loss:** KL Divergence with soft Gaussian labels
83
- - **Optimizer:** AdamW with ReduceLROnPlateau scheduler
84
-
85
- ## License
86
-
87
- MIT
 
1
+ ---
2
+ license: mit
3
+ tags:
4
+ - image-rotation
5
+ - orientation-estimation
6
+ - angle-detection
7
+ - circular-gaussian-distribution
8
+ - mambaout
9
+ - pytorch
10
+ datasets:
11
+ - coco
12
+ metrics:
13
+ - mae
14
+ pipeline_tag: image-classification
15
+ ---
16
+
17
+ # Image Rotation Angle Estimation
18
+
19
+ **[Try the interactive demo](https://huggingface.co/spaces/maxwoe/image-rotation-angle-estimation)** | **[GitHub](https://github.com/maxwoe/image-rotation-angle-estimation)** | **[Paper](https://arxiv.org/abs/2603.25351)**
20
+
21
+ Predicts the rotation angle of an image using the **Circular Gaussian Distribution (CGD)** method with a **MambaOut Base** backbone.
22
+
23
+ The model outputs a probability distribution over 360 angle bins (1 degree resolution) and extracts the predicted angle via argmax. It handles the full 360 degree range with no boundary discontinuities.
24
+
25
+ ## Available Checkpoints
26
+
27
+ | Checkpoint | Dataset | MAE | Median Error |
28
+ |---|---|---|---|
29
+ | `cgd_mambaout_base_coco2017.ckpt` | COCO 2017 | 2.84° | 0.55° |
30
+ | `cgd_mambaout_base_coco2014.ckpt` | COCO 2014 | 3.71° | 0.68° |
31
+
32
+ ## Usage
33
+
34
+ Download the inference code from this Hub repo (`model_cgd.py`, `architectures.py`, `rotation_utils.py`), then:
35
+
36
+ ```python
37
+ from model_cgd import CGDAngleEstimation
38
+ from PIL import Image
39
+
40
+ # Load model (defaults to COCO 2017 checkpoint)
41
+ model = CGDAngleEstimation.from_pretrained("maxwoe/image-rotation-angle-estimation")
42
+
43
+ # Or load a specific checkpoint
44
+ # model = CGDAngleEstimation.from_pretrained(
45
+ # "maxwoe/image-rotation-angle-estimation",
46
+ # model_name="cgd_mambaout_base_coco2014.ckpt",
47
+ # )
48
+
49
+ image = Image.open("your_image.jpg")
50
+ angle = model.predict_angle(image)
51
+ print(f"Predicted rotation: {angle:.1f}°")
52
+ ```
53
+
54
+ `predict_angle` accepts a PIL Image, numpy array, or file path.
55
+
56
+ ## Evaluation Results (COCO 2017, 5 seeds)
57
+
58
+ | Metric | Value |
59
+ |---|---|
60
+ | MAE | 2.84° |
61
+ | Median Error | 0.55° |
62
+ | RMSE | 8.45° |
63
+ | P90 Error | 3.54° |
64
+ | P95 Error | 12.00° |
65
+ | Accuracy at 2° | 90.2% |
66
+ | Accuracy at 5° | 97.5% |
67
+ | Accuracy at 10° | 98.1% |
68
+
69
+ ## Model Details
70
+
71
+ - **Method:** Circular Gaussian Distribution (CGD), 360 bins, sigma = 6.0°
72
+ - **Backbone:** MambaOut Base (`mambaout_base.in1k`), pretrained on ImageNet-1K
73
+ - **Input size:** 224 x 224 pixels
74
+ - **Output:** Probability distribution over 360 angle bins, converted to angle via argmax
75
+ - **Loss:** KL Divergence with soft Gaussian labels
76
+ - **Optimizer:** AdamW with ReduceLROnPlateau scheduler
77
+
78
+ ## License
79
+
80
+ MIT