VOOZH about

URL: https://huggingface.co/prithivMLmods/Road-Subsigns-Classification

⇱ prithivMLmods/Road-Subsigns-Classification · Hugging Face


👁 13.png

Road-Subsigns-Classification

Road-Subsigns-Classification is an image classification vision-language encoder model fine-tuned from google/siglip2-base-patch16-224 for a single-label classification task. It is designed to classify images of road subsigns using the SiglipForImageClassification architecture.

Classification Report:
 precision recall f1-score support

 M1 0.9907 0.9815 0.9860 324
 M11c1-E 1.0000 0.9787 0.9892 47
 M2 0.9950 0.9853 0.9901 204
 M3a-droite 0.9699 0.9680 0.9690 500
 M3a-gauche 0.9431 0.9375 0.9403 336
 M3b-gauche 1.0000 1.0000 1.0000 14
 M4a 0.9914 0.9664 0.9787 119
 M4b 0.8929 1.0000 0.9434 25
 M4c 0.8947 1.0000 0.9444 17
 M4d1 0.9887 1.0000 0.9943 175
 M4d2 0.9844 0.9844 0.9844 64
 M4f 0.9826 1.0000 0.9912 452
 M4g 0.9940 1.0000 0.9970 329
 M4h 0.0000 0.0000 0.0000 1
 M4u 0.8571 0.9231 0.8889 13
 M4v 1.0000 1.0000 1.0000 100
 M4z1 1.0000 1.0000 1.0000 45
 M4z2 0.0000 0.0000 0.0000 1
 M5-STOP 1.0000 0.9872 0.9935 234
 M6a 0.9940 0.9920 0.9930 500
 M6h 1.0000 0.9943 0.9972 353
 M6i 0.9885 1.0000 0.9942 86
 M6j 0.9855 1.0000 0.9927 68
 M8a 0.9619 0.9528 0.9573 106
 M8b 0.7407 0.9091 0.8163 22
 M8c 0.8485 0.9825 0.9106 57
 M8d 0.9739 0.9739 0.9739 115
 M8e 0.9754 0.9835 0.9794 121
 M8f 0.9972 0.9756 0.9863 369
 M9Z-INTERDIT-HORS-CASES 0.9787 0.9919 0.9852 370
 M9Z-SAUF-BUS 0.9650 0.9452 0.9550 146
 M9Z-SAUF-BUS-SCOLAIRE 0.9688 0.9394 0.9538 66
 M9c 0.9843 1.0000 0.9921 500
 M9d 0.9945 0.9759 0.9851 373
 M9v 0.9952 1.0000 0.9976 418
 M9z 0.7760 0.7132 0.7433 136
 M9z-DES-DEUX-COTES 0.9741 0.9496 0.9617 119
 M9z-ECOLE 1.0000 0.9474 0.9730 38
 M9z-PARKING-PRIVE 1.0000 1.0000 1.0000 9
 M9z-PASSAGE-SURELEVE 0.9808 0.9808 0.9808 104
 M9z-PROPRIETE-PRIVEE 0.9091 0.8333 0.8696 12
 M9z-RAPPEL 0.9933 0.9978 0.9955 447
 M9z-SAUF-CHANTIER 1.0000 0.7273 0.8421 11
 M9z-SAUF-CONVOIS-EXCEPT 0.0000 0.0000 0.0000 2
 M9z-SAUF-CYCLISTES 0.9626 0.9836 0.9730 183
 M9z-SAUF-DESSERTE 0.9307 0.9792 0.9543 96
 M9z-SAUF-LIVRAISONS 0.8478 0.9286 0.8864 42
 M9z-SAUF-POLICE 1.0000 0.8667 0.9286 15
 M9z-SAUF-RIVERAINS 0.9677 0.9615 0.9646 312
 M9z-SAUF-SERVICE 0.9160 0.9375 0.9266 128
 M9z-SAUF-TAXIS 0.7778 0.8235 0.8000 17
M9z-SAUF-VEHICULES-AGRICOLES 0.9712 0.9018 0.9352 112
M9z-SAUF-VEHICULES-AUTORISES 0.9253 0.9817 0.9527 164
 M9z-SECOURS 1.0000 0.6667 0.8000 9
 M9z-SIGNAL-AUTO 0.9892 0.9892 0.9892 93
 M9z-SORTIE-POMPIERS 0.9062 0.9355 0.9206 31
 M9z-SORTIE-VEHICULES 1.0000 0.7857 0.8800 14
 M9z-SUR-LE-TROTTOIR 0.9444 0.9444 0.9444 18
 M9z-VERGLAS 1.0000 0.6875 0.8148 16
 zz 0.9486 0.9600 0.9543 500

 accuracy 0.9732 9298
 macro avg 0.9093 0.8968 0.9009 9298
 weighted avg 0.9731 0.9732 0.9729 9298

The model categorizes road subsigns into 60 classes:

  • Class 0: "M1"
  • Class 1: "M11c1-E"
  • Class 2: "M2"
  • Class 3: "M3a-droite"
  • Class 4: "M3a-gauche"
  • Class 5: "M3b-gauche"
  • Class 6: "M4a"
  • Class 7: "M4b"
  • Class 8: "M4c"
  • Class 9: "M4d1"
  • Class 10: "M4d2"
  • Class 11: "M4f"
  • Class 12: "M4g"
  • Class 13: "M4h"
  • Class 14: "M4u"
  • Class 15: "M4v"
  • Class 16: "M4z1"
  • Class 17: "M4z2"
  • Class 18: "M5-STOP"
  • Class 19: "M6a"
  • Class 20: "M6h"
  • Class 21: "M6i"
  • Class 22: "M6j"
  • Class 23: "M8a"
  • Class 24: "M8b"
  • Class 25: "M8c"
  • Class 26: "M8d"
  • Class 27: "M8e"
  • Class 28: "M8f"
  • Class 29: "M9Z-INTERDIT-HORS-CASES"
  • Class 30: "M9Z-SAUF-BUS"
  • Class 31: "M9Z-SAUF-BUS-SCOLAIRE"
  • Class 32: "M9c"
  • Class 33: "M9d"
  • Class 34: "M9v"
  • Class 35: "M9z"
  • Class 36: "M9z-DES-DEUX-COTES"
  • Class 37: "M9z-ECOLE"
  • Class 38: "M9z-PARKING-PRIVE"
  • Class 39: "M9z-PASSAGE-SURELEVE"
  • Class 40: "M9z-PROPRIETE-PRIVEE"
  • Class 41: "M9z-RAPPEL"
  • Class 42: "M9z-SAUF-CHANTIER"
  • Class 43: "M9z-SAUF-CONVOIS-EXCEPT"
  • Class 44: "M9z-SAUF-CYCLISTES"
  • Class 45: "M9z-SAUF-DESSERTE"
  • Class 46: "M9z-SAUF-LIVRAISONS"
  • Class 47: "M9z-SAUF-POLICE"
  • Class 48: "M9z-SAUF-RIVERAINS"
  • Class 49: "M9z-SAUF-SERVICE"
  • Class 50: "M9z-SAUF-TAXIS"
  • Class 51: "M9z-SAUF-VEHICULES-AGRICOLES"
  • Class 52: "M9z-SAUF-VEHICULES-AUTORISES"
  • Class 53: "M9z-SECOURS"
  • Class 54: "M9z-SIGNAL-AUTO"
  • Class 55: "M9z-SORTIE-POMPIERS"
  • Class 56: "M9z-SORTIE-VEHICULES"
  • Class 57: "M9z-SUR-LE-TROTTOIR"
  • Class 58: "M9z-VERGLAS"
  • Class 59: "zz"

Run with Transformers🤗

!pip install -q transformers torch pillow gradio
import gradio as gr
from transformers import AutoImageProcessor, SiglipForImageClassification
from PIL import Image
import torch

# Load model and processor
model_name = "prithivMLmods/Road-Subsigns-Classification"
model = SiglipForImageClassification.from_pretrained(model_name)
processor = AutoImageProcessor.from_pretrained(model_name)

labels = {
 "0": "M1", "1": "M11c1-E", "2": "M2", "3": "M3a-droite", "4": "M3a-gauche",
 "5": "M3b-gauche", "6": "M4a", "7": "M4b", "8": "M4c", "9": "M4d1",
 "10": "M4d2", "11": "M4f", "12": "M4g", "13": "M4h", "14": "M4u",
 "15": "M4v", "16": "M4z1", "17": "M4z2", "18": "M5-STOP", "19": "M6a",
 "20": "M6h", "21": "M6i", "22": "M6j", "23": "M8a", "24": "M8b",
 "25": "M8c", "26": "M8d", "27": "M8e", "28": "M8f", "29": "M9Z-INTERDIT-HORS-CASES",
 "30": "M9Z-SAUF-BUS", "31": "M9Z-SAUF-BUS-SCOLAIRE", "32": "M9c", "33": "M9d", "34": "M9v",
 "35": "M9z", "36": "M9z-DES-DEUX-COTES", "37": "M9z-ECOLE", "38": "M9z-PARKING-PRIVE",
 "39": "M9z-PASSAGE-SURELEVE", "40": "M9z-PROPRIETE-PRIVEE", "41": "M9z-RAPPEL",
 "42": "M9z-SAUF-CHANTIER", "43": "M9z-SAUF-CONVOIS-EXCEPT", "44": "M9z-SAUF-CYCLISTES",
 "45": "M9z-SAUF-DESSERTE", "46": "M9z-SAUF-LIVRAISONS", "47": "M9z-SAUF-POLICE",
 "48": "M9z-SAUF-RIVERAINS", "49": "M9z-SAUF-SERVICE", "50": "M9z-SAUF-TAXIS",
 "51": "M9z-SAUF-VEHICULES-AGRICOLES", "52": "M9z-SAUF-VEHICULES-AUTORISES", "53": "M9z-SECOURS",
 "54": "M9z-SIGNAL-AUTO", "55": "M9z-SORTIE-POMPIERS", "56": "M9z-SORTIE-VEHICULES",
 "57": "M9z-SUR-LE-TROTTOIR", "58": "M9z-VERGLAS", "59": "zz"
}

def classify_subsign(image):
 image = Image.fromarray(image).convert("RGB")
 inputs = processor(images=image, return_tensors="pt")
 
 with torch.no_grad():
 logits = model(**inputs).logits
 probs = torch.nn.functional.softmax(logits, dim=1).squeeze().tolist()
 
 return {labels[str(i)]: round(probs[i], 3) for i in range(len(probs))}

# Create Gradio interface
iface = gr.Interface(
 fn=classify_subsign,
 inputs=gr.Image(type="numpy"),
 outputs=gr.Label(label="Prediction Scores"),
 title="Road Subsigns Classification",
 description="Upload an image to predict the road subsign category."
)

if __name__ == "__main__":
 iface.launch()

Intended Use:

The Road-Subsigns-Classification model is designed to classify images of road subsigns into 60 categories. Potential use cases include:

  • Traffic Management: Assisting in automated monitoring and analysis of road signs.
  • Autonomous Vehicles: Helping vehicles understand road sign information.
  • Smart Cities: Enhancing traffic regulation systems.
  • Driver Assistance Systems: Providing visual cues for safer driving.
  • Urban Planning: Analyzing road sign data for infrastructure improvements.
Downloads last month
3
Safetensors
Model size
92.9M params
Tensor type
F32
·

Model tree for prithivMLmods/Road-Subsigns-Classification

Finetuned
(119)
this model

Dataset used to train prithivMLmods/Road-Subsigns-Classification

Collection including prithivMLmods/Road-Subsigns-Classification