cvetanovskaa
commited on
Commit
•
b61042f
1
Parent(s):
da5ee4e
Update README
Browse files
README.md
CHANGED
@@ -16,6 +16,25 @@ Vision Transformer (ViT) model pre-trained on ImageNet-21k (14 million images, 2
|
|
16 |
- Fine-tuning Objective: Classify traffic signs into 43 different categories, including various speed limits, warning signs, and prohibitory or regulatory signs.
|
17 |
- Developer: Aleksandra Cvetanovska
|
18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
## Limitations and Bias
|
20 |
- The model is trained exclusively on data from German traffic signs, which may not generalize well to signs in other regions due to differences in design and context.
|
21 |
- Performance may vary under different lighting conditions or when signs are partially occluded
|
|
|
16 |
- Fine-tuning Objective: Classify traffic signs into 43 different categories, including various speed limits, warning signs, and prohibitory or regulatory signs.
|
17 |
- Developer: Aleksandra Cvetanovska
|
18 |
|
19 |
+
## Example Use
|
20 |
+
```
|
21 |
+
from transformers import ViTForImageClassification, ViTImageProcessor
|
22 |
+
from torch.utils.data import DataLoader
|
23 |
+
import torch
|
24 |
+
|
25 |
+
url = 'https://images.unsplash.com/photo-1572670014853-1d3a3f22b40f?q=80&w=2942&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D'
|
26 |
+
image = Image.open(requests.get(url, stream=True).raw)
|
27 |
+
|
28 |
+
model_name = "cvetanovskaa/vit-base-patch16-224-in21k-gtsrb-tuned"
|
29 |
+
model = ViTForImageClassification.from_pretrained(model_name)
|
30 |
+
processor = ViTImageProcessor.from_pretrained(model_name)
|
31 |
+
|
32 |
+
inputs = processor(images=image, return_tensors="pt")
|
33 |
+
|
34 |
+
outputs = model(**inputs)
|
35 |
+
last_hidden_states = outputs.last_hidden_state
|
36 |
+
```
|
37 |
+
|
38 |
## Limitations and Bias
|
39 |
- The model is trained exclusively on data from German traffic signs, which may not generalize well to signs in other regions due to differences in design and context.
|
40 |
- Performance may vary under different lighting conditions or when signs are partially occluded
|