szymonrucinski/types-of-film-shots
Viewer โข Updated โข 54.3k โข 280 โข 9
How to use pszemraj/beit-large-patch16-512-film-shot-classifier with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("image-classification", model="pszemraj/beit-large-patch16-512-film-shot-classifier")
pipe("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png") # pip install -U transformers accelerate
# Load model directly
from transformers import AutoImageProcessor, AutoModelForImageClassification
processor = AutoImageProcessor.from_pretrained("pszemraj/beit-large-patch16-512-film-shot-classifier")
model = AutoModelForImageClassification.from_pretrained("pszemraj/beit-large-patch16-512-film-shot-classifier", device_map="auto")This model is a fine-tuned version of microsoft/beit-large-patch16-512 on the szymonrucinski/types-of-film-shots dataset. It achieves the following results on the evaluation set:
from transformers import pipeline
from PIL import Image
import requests
pipe = pipeline(
"image-classification",
model="pszemraj/beit-large-patch16-512-film-shot-classifier",
)
url = "https://cdn-uploads.huggingface.co/production/uploads/60bccec062080d33f875cd0c/9YqYvv188ZccCMSzuv0KW.png"
image = Image.open(requests.get(url, stream=True).raw)
result = pipe(image)[0]
print(result)
try some of these:
The dataset contains the following labels:
"id2label": {
"0": "ambiguous",
"1": "closeUp",
"2": "detail",
"3": "extremeLongShot",
"4": "fullShot",
"5": "longShot",
"6": "mediumCloseUp",
"7": "mediumShot"
},
as plaintext:
ambiguous, close up, detail, extreme long shot, full shot, long shot, medium close up, medium shot
The following hyperparameters were used during training:
| Training Loss | Epoch | Step | Validation Loss | Accuracy |
|---|---|---|---|---|
| 1.0435 | 1.0 | 393 | 1.4799 | 0.4892 |
| 1.1554 | 2.0 | 786 | 1.4938 | 0.4892 |
| 1.5041 | 3.0 | 1179 | 2.1702 | 0.3597 |
| 1.0457 | 4.0 | 1572 | 1.5413 | 0.5683 |
| 0.3315 | 5.0 | 1965 | 1.0769 | 0.6978 |
| 0.2178 | 6.0 | 2358 | 1.2335 | 0.6763 |
Base model
microsoft/beit-large-patch16-512