Views
No views yet
facebook/dinov2-with-registers-large weights) and trained on a diverse set of five thousand human-annotated images.1
2import torch
3from PIL import Image
4from transformers import AutoImageProcessor
5from transformers import AutoModelForImageClassification
6
7image_processor = AutoImageProcessor.from_pretrained("facebook/dinov2-with-registers-large")
8model = AutoModelForImageClassification.from_pretrained('aslakey/shot_scale')
9model.eval()
10
11# example medium shot image
12# Model labels: [extreme_close_up, close_up, medium, full, wide]
13image = Image.open('medium.jpg')
14inputs = image_processor(image, return_tensors="pt")
15with torch.no_grad():
16 outputs = model(**inputs)
17
18# technically multi-label training, but argmax works too!
19predicted_label = outputs.logits.argmax(-1).item()
20print(model.config.id2label[predicted_label])| Category | Precision | Recall |
|---|---|---|
| ECU (low coverage) | 75% | 32% |
| CU | 66% | 51% |
| M | 88% | 90% |
| F | 69% | 68% |
| W | 89% | 83% |