|
|
--- |
|
|
license: apache-2.0 |
|
|
--- |
|
|
|
|
|
# Camera Angle |
|
|
|
|
|
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. |
|
|
|
|
|
## How to use: |
|
|
```python |
|
|
|
|
|
import torch |
|
|
from PIL import Image |
|
|
from transformers import AutoImageProcessor |
|
|
from transformers import AutoModelForImageClassification |
|
|
|
|
|
image_processor = AutoImageProcessor.from_pretrained("facebook/dinov2-with-registers-large") |
|
|
model = AutoModelForImageClassification.from_pretrained('aslakey/camera_angle') |
|
|
model.eval() |
|
|
|
|
|
# example dutch angle image |
|
|
# model labels [low, neutral, high, overhead, dutch] |
|
|
image = Image.open('dutch_angle.jpg') |
|
|
inputs = image_processor(image, return_tensors="pt") |
|
|
with torch.no_grad(): |
|
|
outputs = model(**inputs) |
|
|
|
|
|
# technically multi-label training, but argmax works too! |
|
|
predicted_label = outputs.logits.argmax(-1).item() |
|
|
print(model.config.id2label[predicted_label]) |
|
|
``` |
|
|
|
|
|
## Performance: |
|
|
|
|
|
| Camera Angle | Precision | Recall | |
|
|
|--------------|-----------|--------| |
|
|
| Low | 72% | 91% | |
|
|
| Neutral | 86% | 70% | |
|
|
| High | 87% | 75% | |
|
|
| Overhead | 67% | 70% | |
|
|
| Dutch (low coverage) | 50% | 50% | |