Upload readme.md
Browse files
readme.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Computer Vision Classification Comparison
|
| 3 |
+
emoji: 📷
|
| 4 |
+
colorFrom: yellow
|
| 5 |
+
colorTo: blue
|
| 6 |
+
sdk: gradio
|
| 7 |
+
sdk_version: "6.12.0"
|
| 8 |
+
app_file: app.py
|
| 9 |
+
pinned: false
|
| 10 |
+
---
|
| 11 |
+
# Gradio Pokemon Classification App
|
| 12 |
+
|
| 13 |
+
This app compares 3 image classification approaches on custom Pokemon images:
|
| 14 |
+
|
| 15 |
+
- Fine-tuned transfer learning model (ResNet18) from this project
|
| 16 |
+
- Zero-shot CLIP (`openai/clip-vit-base-patch32`)
|
| 17 |
+
- OpenAI vision model (LLM image classification)
|
| 18 |
+
|
| 19 |
+
## Dataset Used For Training
|
| 20 |
+
|
| 21 |
+
- Custom dataset from course materials (week 8 style): `data/pokemon`
|
| 22 |
+
- Train split: `data/pokemon/train`
|
| 23 |
+
- Test split: `data/pokemon/test`
|
| 24 |
+
- Number of classes: `6` (`charizard`, `charmander`, `charmeleon`, `ditto`, `eevee`, `ekans`)
|
| 25 |
+
|
| 26 |
+
## Trained Model
|
| 27 |
+
|
| 28 |
+
- Local model artifact: `models/custom_resnet18.pth`
|
| 29 |
+
- Hugging Face model link: `https://huggingface.co/kukalend/pokemon-transfer-resnet18`
|
| 30 |
+
|
| 31 |
+
## Training Performance
|
| 32 |
+
|
| 33 |
+
| Training Loss | Epoch | Step | Validation Loss | Accuracy |
|
| 34 |
+
|---:|---:|---:|---:|---:|
|
| 35 |
+
| 1.6525 | 1 | - | 0.4324 | 0.2848 |
|
| 36 |
+
| 0.9985 | 2 | - | 0.6216 | 0.7285 |
|
| 37 |
+
| 0.6668 | 3 | - | 0.7838 | 0.8344 |
|
| 38 |
+
| 0.4450 | 4 | - | 0.8378 | 0.9007 |
|
| 39 |
+
|
| 40 |
+
Notes:
|
| 41 |
+
- Validation loss was not logged separately in the training script, so the table reports validation accuracy in the validation column context and train accuracy in the accuracy column.
|
| 42 |
+
- Final test accuracy of the custom model: `0.80`.
|
| 43 |
+
|
| 44 |
+
## Example Image Results
|
| 45 |
+
|
| 46 |
+
The table below reports the true class and Top-3 predictions for Custom ResNet and CLIP.
|
| 47 |
+
|
| 48 |
+
| Image | True Class | Custom ResNet Top-3 (score) | CLIP Top-3 (score) | OpenAI LLM (label, confidence) |
|
| 49 |
+
|---|---|---|---|---|
|
| 50 |
+
| `charizard.png` | `charizard` | `eevee` (0.5464)<br>`charizard` (0.3056)<br>`charmander` (0.0711) | `charizard` (0.4536)<br>`charmander` (0.3524)<br>`charmeleon` (0.0896) | `charizard` (0.9000) |
|
| 51 |
+
| `charmander.png` | `charmander` | `charmander` (0.5801)<br>`charmeleon` (0.3410)<br>`ekans` (0.0315) | `charmeleon` (0.5400)<br>`charmander` (0.4202)<br>`charizard` (0.0268) | `charmander` (0.9500) |
|
| 52 |
+
| `charmeleon.png` | `charmeleon` | `charmeleon` (0.3503)<br>`eevee` (0.3164)<br>`ekans` (0.2516) | `charmeleon` (0.4247)<br>`eevee` (0.3977)<br>`charizard` (0.0802) | `charmeleon` (0.9500) |
|
| 53 |
+
| `ditto.png` | `ditto` | `ditto` (0.8271)<br>`ekans` (0.0959)<br>`eevee` (0.0370) | `ditto` (0.5273)<br>`ekans` (0.2055)<br>`eevee` (0.1169) | `ekans` (0.9000) |
|
| 54 |
+
| `eevee.png` | `eevee` | `eevee` (0.9962)<br>`ekans` (0.0022)<br>`charizard` (0.0006) | `eevee` (0.9984)<br>`ditto` (0.0008)<br>`charizard` (0.0004) | `eevee` (0.9500) |
|
| 55 |
+
| `ekans.png` | `ekans` | `ekans` (0.5366)<br>`eevee` (0.3374)<br>`charmander` (0.0682) | `ekans` (0.5120)<br>`charmeleon` (0.2303)<br>`charmander` (0.2177) | `ekans` (0.9500) |
|
| 56 |
+
|
| 57 |
+
## Overall Comparison (Test Set)
|
| 58 |
+
|
| 59 |
+
- Custom transfer learning model accuracy: `0.80`
|
| 60 |
+
- CLIP zero-shot model accuracy: `0.72`
|
| 61 |
+
- OpenAI vision model accuracy: `0.7083` on 24 evaluated samples
|
| 62 |
+
|
| 63 |
+
## Links
|
| 64 |
+
|
| 65 |
+
- Hugging Face Space: `https://huggingface.co/spaces/kukalend/computer-Vision-classification`
|
| 66 |
+
- Hugging Face model repo: `https://huggingface.co/kukalend/pokemon-transfer-resnet18`
|