Model Card for Mobilenet Geometric Shapes Dataset

Training Dataset

Base Model

Accuracy

  • Accuracy on dataset 0-ma/geometric-shapes [test] : 0.9914

Loading and using the model

import numpy as np
from PIL import Image
from transformers import AutoImageProcessor, AutoModelForImageClassification 
import requests
labels =  [
    "None",
    "Circle",
    "Triangle",
    "Square",
    "Pentagon",
    "Hexagon"
] 
images = [Image.open(requests.get("https://raw.githubusercontent.com/0-ma/geometric-shape-detector/main/input/exemple_circle.jpg", stream=True).raw), 
        Image.open(requests.get("https://raw.githubusercontent.com/0-ma/geometric-shape-detector/main/input/exemple_pentagone.jpg", stream=True).raw)]
feature_extractor = AutoImageProcessor.from_pretrained('0-ma/mobilenet-v2-geometric-shapes')
model = AutoModelForImageClassification.from_pretrained('0-ma/mobilenet-v2-geometric-shapes')
inputs = feature_extractor(images=images, return_tensors="pt")
logits = model(**inputs)['logits'].cpu().detach().numpy()
predictions = np.argmax(logits, axis=1)    
predicted_labels = [labels[prediction] for prediction in predictions]
print(predicted_labels)

Model generation

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.

Downloads last month
15
Safetensors
Model size
2.27M params
Tensor type
F32
ยท
Inference Providers NEW
This model is not currently available via any of the supported Inference Providers.
The model cannot be deployed to the HF Inference API: The model has no library tag.

Model tree for 0-ma/mobilenet-v2-geometric-shapes

Finetuned
(40)
this model

Dataset used to train 0-ma/mobilenet-v2-geometric-shapes

Space using 0-ma/mobilenet-v2-geometric-shapes 1