0-ma commited on
Commit
858eefd
1 Parent(s): 9d2be22

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +47 -3
README.md CHANGED
@@ -1,3 +1,47 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: google/vit-base-patch16-224
3
+ datasets:
4
+ - 0-ma/geometric-shapes
5
+ license: apache-2.0
6
+ metrics:
7
+ - accuracy
8
+ pipeline_tag: image-classification
9
+ ---
10
+
11
+ # Model Card for VIT Geometric Shapes Dataset Base
12
+
13
+ ## Training Dataset
14
+
15
+ - **Repository:** https://huggingface.co/datasets/0-ma/geometric-shapes
16
+
17
+ ## Base Model
18
+
19
+ - **Repository:** https://huggingface.co/models/WinKawaks/vit-tiny-patch16-224
20
+
21
+ ## Accuracy
22
+
23
+ - Accuracy on dataset 0-ma/geometric-shapes [test] : 0.9269047619047619
24
+
25
+ # Loading and using the model
26
+ import numpy as np
27
+ from PIL import Image
28
+ from transformers import AutoImageProcessor, AutoModelForImageClassification
29
+ import requests
30
+ labels = [
31
+ "Only text",
32
+ "Circle",
33
+ "Triangle",
34
+ "Square",
35
+ "Pentagon",
36
+ "Hexagon"
37
+ ]
38
+ images = [Image.open(requests.get("https://raw.githubusercontent.com/0-ma/geometric-shape-detector/main/input/exemple_circle.jpg", stream=True).raw),
39
+ Image.open(requests.get("https://raw.githubusercontent.com/0-ma/geometric-shape-detector/main/input/exemple_pentagone.jpg", stream=True).raw)]
40
+ feature_extractor = AutoImageProcessor.from_pretrained('0-ma/vit-geometric-shapes-base')
41
+ model = AutoModelForImageClassification.from_pretrained('0-ma/vit-geometric-shapes-base')
42
+ inputs = feature_extractor(images=images, return_tensors="pt")
43
+ logits = model(**inputs)['logits'].cpu().detach().numpy()
44
+ predictions = np.argmax(logits, axis=1)
45
+ predicted_labels = [labels[prediction] for prediction in predictions]
46
+ print(predicted_labels)
47
+