Add README.md with model card
Browse files
README.md
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
tags:
|
| 3 |
+
- autogluon
|
| 4 |
+
- multimodal
|
| 5 |
+
- image-classification
|
| 6 |
+
- binary-classification
|
| 7 |
+
- ensemble-learning
|
| 8 |
+
- education
|
| 9 |
+
- homework
|
| 10 |
+
datasets:
|
| 11 |
+
- ecopus/sign_identification
|
| 12 |
+
license: mit
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# HW1 Sign Identification with AutoGluon
|
| 16 |
+
|
| 17 |
+
## Model Description
|
| 18 |
+
This repository contains an **AutoML image classification model trained with AutoGluon Multimodal**
|
| 19 |
+
to identify two categories of sign images.
|
| 20 |
+
The model was trained as part of **Homework 1** in CMU 24-679 (Designing and Deploying AI/ML).
|
| 21 |
+
|
| 22 |
+
- **Framework**: [AutoGluon Multimodal](https://auto.gluon.ai/stable/tutorials/multimodal/index.html)
|
| 23 |
+
- **Backbone**: TimmAutoModelForImagePrediction (~194M parameters)
|
| 24 |
+
- **Task**: Binary image classification (`label`)
|
| 25 |
+
- **Classes**: `0`, `1`
|
| 26 |
+
|
| 27 |
+
---
|
| 28 |
+
|
| 29 |
+
## Training Setup
|
| 30 |
+
- **Dataset**: [ecopus/sign_identification](https://huggingface.co/datasets/ecopus/sign_identification)
|
| 31 |
+
- `augmented` split (385 samples) → used for training/validation (80/20).
|
| 32 |
+
- `original` split (35 samples) → reserved for final testing.
|
| 33 |
+
- **Time budget**: 300 seconds (≈7 minutes).
|
| 34 |
+
- **Hardware**: Colab GPU (CUDA 12.6, mixed precision).
|
| 35 |
+
- **Presets**: `best_quality` (ensembling + hyperparameter tuning).
|
| 36 |
+
|
| 37 |
+
---
|
| 38 |
+
|
| 39 |
+
## Results
|
| 40 |
+
- **Validation ROC-AUC**: 0.998
|
| 41 |
+
- **Test Accuracy**: 97.1%
|
| 42 |
+
- **Weighted F1**: 97.1%
|
| 43 |
+
|
| 44 |
+
### Classification Report (Test Set)
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
precision recall f1-score support
|
| 48 |
+
0 0.95 1.00 0.97 19
|
| 49 |
+
1 1.00 0.94 0.97 16
|
| 50 |
+
accuracy 0.97 35
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
macro avg 0.97 0.97 0.97 35
|
| 54 |
+
weighted avg 0.97 0.97 0.97 35
|
| 55 |
+
|
| 56 |
+
---
|
| 57 |
+
|
| 58 |
+
## How to Use
|
| 59 |
+
|
| 60 |
+
### Install requirements
|
| 61 |
+
```bash
|
| 62 |
+
pip install autogluon.multimodal huggingface_hub cloudpickle
|
| 63 |
+
|
| 64 |
+
import cloudpickle
|
| 65 |
+
from huggingface_hub import hf_hub_download
|
| 66 |
+
|
| 67 |
+
pkl_path = hf_hub_download(
|
| 68 |
+
repo_id="cassieli226/sign-identification-automl",
|
| 69 |
+
filename="autogluon_predictor.pkl",
|
| 70 |
+
repo_type="model"
|
| 71 |
+
)
|
| 72 |
+
|
| 73 |
+
with open(pkl_path, "rb") as f:
|
| 74 |
+
predictor = cloudpickle.load(f)
|
| 75 |
+
|
| 76 |
+
# Predict on new data (expects DataFrame with 'image' column containing file paths)
|
| 77 |
+
import pandas as pd
|
| 78 |
+
X_test = pd.DataFrame({"image": ["path/to/your/image.png"]})
|
| 79 |
+
print(predictor.predict(X_test))
|
| 80 |
+
|
| 81 |
+
|
| 82 |
+
import pathlib, shutil, zipfile
|
| 83 |
+
from huggingface_hub import hf_hub_download
|
| 84 |
+
import autogluon.multimodal as ag
|
| 85 |
+
import pandas as pd
|
| 86 |
+
|
| 87 |
+
zip_path = hf_hub_download(
|
| 88 |
+
repo_id="cassieli226/sign-identification-automl",
|
| 89 |
+
filename="autogluon_predictor_dir.zip",
|
| 90 |
+
repo_type="model"
|
| 91 |
+
)
|
| 92 |
+
|
| 93 |
+
extract_dir = pathlib.Path("predictor_dir")
|
| 94 |
+
if extract_dir.exists():
|
| 95 |
+
shutil.rmtree(extract_dir)
|
| 96 |
+
with zipfile.ZipFile(zip_path, "r") as zf:
|
| 97 |
+
zf.extractall(str(extract_dir))
|
| 98 |
+
|
| 99 |
+
predictor = ag.MultiModalPredictor.load(str(extract_dir))
|
| 100 |
+
print(predictor.predict(pd.DataFrame({"image": ["path/to/your/image.png"]})))
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
#Intended Use
|
| 104 |
+
- Coursework demonstration of AutoML for neural networks on images.
|
| 105 |
+
- Educational example for using augmented vs. original splits for training and evaluation.
|
| 106 |
+
#Limitations
|
| 107 |
+
- Trained on a small student-collected dataset (≈420 images).
|
| 108 |
+
- Accuracy may not generalize to unseen real-world data.
|
| 109 |
+
- Model assumes binary labels only (0, 1).
|
| 110 |
+
#Ethical Notes
|
| 111 |
+
- Dataset is non-sensitive, contains no personal information.
|
| 112 |
+
- Augmentation was applied responsibly to avoid unrealistic samples.
|
| 113 |
+
# References
|
| 114 |
+
- Dataset: ecopus/sign_identification
|
| 115 |
+
- Framework: AutoGluon
|
| 116 |
+
- OpenAI’s ChatGPT (2025) was used for code generation, structuring, and debugging.
|