File size: 3,371 Bytes
9482d82
 
 
 
 
 
 
 
 
 
 
 
 
b3e51d0
 
 
 
 
 
 
83c04ad
 
b3e51d0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9482d82
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
---
title: Stop Sign Predictor
emoji: 🦀
colorFrom: yellow
colorTo: yellow
sdk: gradio
sdk_version: 5.47.2
app_file: app.py
pinned: false
license: mit
---
# Stop Sign Classifier

This Hugging Face Space hosts a **Gradio app** that predicts whether an uploaded traffic image contains a **Stop Sign**.  
It uses a **classmate’s AutoGluon MultiModal model** trained during Homework 2.  

---

## Dataset & Model Card

- **Dataset:** Traffic sign images (binary classification: Stop Sign vs. No Stop Sign).
- **Dataset Information:** This app uses the [ecopus-sign--classification](https://huggingface.co/datasets/ecopus/sign_identification) The dataset is licensed under **MIT** and consists of **~300 records** in Parquet format (split into `original` and `augmented`) 
- **Model Repo:** [scottymcgee/image-classifier](https://huggingface.co/scottymcgee/image-classifier)  
- **Framework:** [AutoGluon MultiModal](https://auto.gluon.ai/stable/index.html)  
- **Task:** Binary classification → predict `Stop Sign` or `No Stop Sign`.  

### Input Features
| Feature | Type           | Description               |
|---------|----------------|---------------------------|
| Image   | JPG/PNG/Webcam | Traffic scene input image |

### Label
- `0 → 🚫 No Stop Sign`  
- `1 → 🛑 Stop Sign`  

---

## App Interface

- **Widgets:**  
  - `Image Upload` (supports drag and drop or webcam).  
  - `Confidence Threshold` slider (filter low confidence results).  

- **Output:**  
  - Original uploaded image.  
  - Preprocessed 256×256 version (what the model actually sees).  
  - Human readable prediction with probabilities.  

- **Examples:** 3 preloaded example images for quick testing.  
- **Validation:** Ensures uploaded files are valid images and not oversized.  

---

## Example Usage

| Example Image     | Predicted Class |
|-------------------|-----------------|
| `stop1.jpg`       | 🛑 Stop Sign    | 
| `no_stop1.jpg`    | 🚫 No Stop Sign |
| `stop2.jpg`       | 🛑 Stop Sign    |

---

## Technical Details

- **Backend:** AutoGluon `MultiModalPredictor` loaded from classmate’s Hugging Face repo.  
- **Interface:** [Gradio](https://www.gradio.app/).  
- **Deployment:** Hugging Face Spaces (`sdk: gradio`).  
- **Environment:** Python 3.10, pinned requirements.  

---

## Limitations

- **Binary labels only:** App only distinguishes `Stop Sign` vs. `No Stop Sign`.  
- **Dataset limitations:** Accuracy depends heavily on dataset quality (lighting, occlusion, unusual traffic scenes).  
- **Threshold behavior:** High thresholds may filter out useful predictions.  

---

## Future Improvements

- Expand dataset to include more traffic sign types (yield, speed limit, etc.).  
- Add bounding box detection to highlight the Stop Sign in the image.  
- Display top-k predictions dynamically instead of threshold filtering.  
- Improve UI with tooltips and confidence visualization (bar chart).  

---

## AI Disclosure

This app was developed with support from AI assistance in:

- Adding input validation and a configurable threshold slider
- Streamlining the Gradio interface for better usability
- Drafting the initial version of this README

All core modeling and training artifacts come from a **classmate’s AutoGluon model**.  

---

Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference