0-ma commited on
Commit
0bce965
1 Parent(s): c6bef9b

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +49 -5
README.md CHANGED
@@ -1,5 +1,49 @@
1
- ---
2
- license: other
3
- license_name: license
4
- license_link: LICENSE
5
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: google/mobilenet_v2_1.0_224
3
+ datasets:
4
+ - 0-ma/geometric-shapes
5
+ license: other
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/google/mobilenet_v2_1.0_224
20
+
21
+ ## Accuracy
22
+
23
+ - Accuracy on dataset 0-ma/geometric-shapes [test] : 0.9138095238095238
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/mobilenet-v2-geometric-shapes')
41
+ model = AutoModelForImageClassification.from_pretrained('0-ma/mobilenet-v2-geometric-shapes')
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
+ ## Model 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.