Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,40 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
---
|
| 4 |
+
|
| 5 |
+
# Camera Angle
|
| 6 |
+
|
| 7 |
+
This model predicts an image's cinematic camera angle [low, neutral, high, overhead, dutch]. The model is a DinoV2 with registers backbone (initiated with `facebook/dinov2-with-registers-large` weights) and trained on a diverse set of two thousand human-annotated images.
|
| 8 |
+
|
| 9 |
+
## How to use:
|
| 10 |
+
```python
|
| 11 |
+
|
| 12 |
+
import torch
|
| 13 |
+
from PIL import Image
|
| 14 |
+
from transformers import AutoImageProcessor
|
| 15 |
+
from transformers import AutoModelForImageClassification
|
| 16 |
+
|
| 17 |
+
image_processor = AutoImageProcessor.from_pretrained("facebook/dinov2-with-registers-large")
|
| 18 |
+
model = AutoModelForImageClassification.from_pretrained('aslakey/camera_angle')
|
| 19 |
+
model.eval()
|
| 20 |
+
|
| 21 |
+
# example duetch angle image
|
| 22 |
+
image = Image.open('dutch_angle.jpg')
|
| 23 |
+
inputs = image_processor(image, return_tensors="pt")
|
| 24 |
+
with torch.no_grad():
|
| 25 |
+
outputs = model(**inputs)
|
| 26 |
+
|
| 27 |
+
# technically multi-label training, but argmax works too!
|
| 28 |
+
predicted_label = outputs.logits.argmax(-1).item()
|
| 29 |
+
print(model.config.id2label[predicted_label])
|
| 30 |
+
```
|
| 31 |
+
|
| 32 |
+
## Performance:
|
| 33 |
+
|
| 34 |
+
| Camera Angle | Precision | Recall |
|
| 35 |
+
|--------------|-----------|--------|
|
| 36 |
+
| Low | 86% | 72% |
|
| 37 |
+
| Neutral | 88% | 94% |
|
| 38 |
+
| High | 83% | 78% |
|
| 39 |
+
| Overhead (low coverage) | 0% | 0% |
|
| 40 |
+
| Dutch (low coverage) | 100% | 50% |
|