Update README.md
Browse files
README.md
CHANGED
@@ -2,39 +2,15 @@
|
|
2 |
tags:
|
3 |
- image-classification
|
4 |
- pytorch
|
5 |
-
|
6 |
-
|
|
|
|
|
7 |
---
|
8 |
|
9 |
|
10 |
|
11 |
-
A vision transformer finetuned to classify the age of a given person's face.
|
12 |
|
|
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
```python
|
17 |
-
import requests
|
18 |
-
from PIL import Image
|
19 |
-
from io import BytesIO
|
20 |
-
|
21 |
-
from transformers import ViTFeatureExtractor, ViTForImageClassification
|
22 |
-
|
23 |
-
# Get example image from official fairface repo + read it in as an image
|
24 |
-
r = requests.get('https://github.com/dchen236/FairFace/blob/master/detected_faces/race_Asian_face0.jpg?raw=true')
|
25 |
-
im = Image.open(BytesIO(r.content))
|
26 |
-
|
27 |
-
# Init model, transforms
|
28 |
-
model = ViTForImageClassification.from_pretrained('nateraw/vit-age-classifier')
|
29 |
-
transforms = ViTFeatureExtractor.from_pretrained('nateraw/vit-age-classifier')
|
30 |
-
|
31 |
-
# Transform our image and pass it through the model
|
32 |
-
inputs = transforms(im, return_tensors='pt')
|
33 |
-
output = model(**inputs)
|
34 |
-
|
35 |
-
# Predicted Class probabilities
|
36 |
-
proba = output.logits.softmax(1)
|
37 |
-
|
38 |
-
# Predicted Classes
|
39 |
-
preds = proba.argmax(1)
|
40 |
-
```
|
|
|
2 |
tags:
|
3 |
- image-classification
|
4 |
- pytorch
|
5 |
+
pipeline_tag: image-classification
|
6 |
+
library_name: transformers
|
7 |
+
license: other
|
8 |
+
license_name: all-rights-reserved
|
9 |
---
|
10 |
|
11 |
|
12 |
|
|
|
13 |
|
14 |
+
© 2024 Mandela Logan. All rights reserved.
|
15 |
|
16 |
+
No part of this model may be reproduced, distributed, or transmitted in any form or by any means, including photocopying, recording, or other electronic or mechanical methods, without the prior written permission of the copyright holder. Unauthorized use or reproduction of this model is strictly prohibited by copyright law.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|