0-ma commited on
Commit
f249d1f
1 Parent(s): 71f282c

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +49 -3
README.md CHANGED
@@ -1,3 +1,49 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: microsoft/beit-base-patch16-224-pt22k-ft22k
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 Tiny
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/microsoft/beit-base-patch16-224-pt22k-ft22k
20
+
21
+ ## Accuracy
22
+
23
+ - Accuracy on dataset 0-ma/geometric-shapes [test] : ????
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
+ "None",
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/beit-geometric-shapes-base')
41
+ model = AutoModelForImageClassification.from_pretrained('0-ma/beit-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
+
48
+ ## Modfel generation
49
+ The model has been created using the 'train_shape_detector.py.py' of the project from the project https://github.com/0-ma/geometric-shape-detector. No external code sources were used.