0-ma commited on
Commit
dd3bfbd
1 Parent(s): a8c3f84

Update README.md

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