Spaces:
Runtime error
Runtime error
Update README.md
Browse files
README.md
CHANGED
|
@@ -7,85 +7,4 @@ sdk: gradio
|
|
| 7 |
sdk_version: 6.11.0
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
-
---
|
| 11 |
-
|
| 12 |
-
# Sport Classification Comparison
|
| 13 |
-
|
| 14 |
-
This app compares 3 image classification approaches on sports images:
|
| 15 |
-
|
| 16 |
-
- Fine-tuned transfer learning model (`sports-vit-transfer-improved`)
|
| 17 |
-
- Zero-shot CLIP (`openai/clip-vit-large-patch14`)
|
| 18 |
-
- OpenAI vision model (LLM image classification)
|
| 19 |
-
|
| 20 |
-
## Dataset Used For Training
|
| 21 |
-
|
| 22 |
-
- Custom dataset loaded with Hugging Face `imagefolder`
|
| 23 |
-
- Local dataset structure: `data/sports/train` and `data/sports/test`
|
| 24 |
-
- Classes: `football`, `tennis`, `golf`, `baseball`, `basketball`
|
| 25 |
-
- Number of classes: `5`
|
| 26 |
-
- Train split used for learning, test split used as validation during training
|
| 27 |
-
|
| 28 |
-
## Preprocessing Steps
|
| 29 |
-
|
| 30 |
-
- Convert images to RGB
|
| 31 |
-
- Resize/crop to the backbone input size
|
| 32 |
-
- Normalize with the backbone mean/std values
|
| 33 |
-
- Training augmentation:
|
| 34 |
-
- RandomResizedCrop
|
| 35 |
-
- RandomHorizontalFlip
|
| 36 |
-
- RandomRotation
|
| 37 |
-
- ColorJitter
|
| 38 |
-
- Backbone frozen for the final improved model to stabilize training on the small dataset
|
| 39 |
-
|
| 40 |
-
## Trained Model
|
| 41 |
-
|
| 42 |
-
- Hugging Face model link: [https://huggingface.co/ochsncon/sport-vit-transfer](https://huggingface.co/ochsncon/sport-vit-transfer)
|
| 43 |
-
- Local training output folder: `sports-vit-transfer-improved`
|
| 44 |
-
- Base model: `microsoft/resnet-18`
|
| 45 |
-
|
| 46 |
-
## Training Performance
|
| 47 |
-
|
| 48 |
-
The table below shows the improved training run on the sports dataset.
|
| 49 |
-
|
| 50 |
-
| Training Loss | Epoch | Step | Validation Loss | Accuracy |
|
| 51 |
-
|---:|---:|---:|---:|---:|
|
| 52 |
-
| 1.7275 | 1.82 | 20 | 1.6322 | 0.1905 |
|
| 53 |
-
| 1.4909 | 5.45 | 60 | 1.2697 | 0.5952 |
|
| 54 |
-
| 1.3534 | 10.91 | 120 | 0.9794 | 0.7619 |
|
| 55 |
-
| 1.2263 | 14.55 | 160 | 0.9674 | 0.8810 |
|
| 56 |
-
| 1.2805 | 20.00 | 220 | 0.9006 | 0.9048 |
|
| 57 |
-
|
| 58 |
-
Final validation accuracy: `0.9048`
|
| 59 |
-
|
| 60 |
-
## Example Image Results
|
| 61 |
-
|
| 62 |
-
The table below reports the true class and Top-3 predictions for the custom model and CLIP.
|
| 63 |
-
|
| 64 |
-
| Image | True Class | Custom Model Top-3 (score) | CLIP Top-3 (score) | OpenAI LLM (label, confidence) |
|
| 65 |
-
|---|---|---|---|---|
|
| 66 |
-
| `example_images/baseball.jpg` | baseball | `baseball` (0.787038)<br>`football` (0.083003)<br>`tennis` (0.063252) | `baseball` (0.982466)<br>`cricket` (0.007831)<br>`athletics` (0.007332) | `baseball` (1.0) |
|
| 67 |
-
| `example_images/basketball.jpg` | basketball | `basketball` (0.651632)<br>`football` (0.190022)<br>`baseball` (0.078006) | `basketball` (0.985004)<br>`handball` (0.008034)<br>`athletics` (0.006052) | `basketball` (1.0) |
|
| 68 |
-
| `example_images/football.jpg` | football | `football` (0.586812)<br>`baseball` (0.252700)<br>`basketball` (0.099161) | `football` (0.935547)<br>`handball` (0.049766)<br>`athletics` (0.007480) | `football` (1.0) |
|
| 69 |
-
| `example_images/golf.jpg` | golf | `golf` (0.569676)<br>`baseball` (0.206489)<br>`tennis` (0.099076) | `golf` (0.996420)<br>`badminton` (0.001648)<br>`cricket` (0.000783) | `golf` (1.0) |
|
| 70 |
-
| `example_images/tennis.jpg` | tennis | `tennis` (0.363185)<br>`football` (0.318908)<br>`basketball` (0.141583) | `tennis` (0.983747)<br>`badminton` (0.008469)<br>`table tennis` (0.005272) | `tennis` (1.0) |
|
| 71 |
-
|
| 72 |
-
Note: These values are taken from the current Space output and can be extended with additional test runs if desired.
|
| 73 |
-
|
| 74 |
-
## Links to Model and App
|
| 75 |
-
|
| 76 |
-
Fill in these fields after upload:
|
| 77 |
-
|
| 78 |
-
- Hugging Face Model: `https://huggingface.co/ochsncon/sport-vit-transfer`
|
| 79 |
-
- Hugging Face Space: `https://huggingface.co/spaces/ochsncon/sport-classification`
|
| 80 |
-
|
| 81 |
-
## Comparison Results
|
| 82 |
-
|
| 83 |
-
The results below summarize the three-model comparison used in the app.
|
| 84 |
-
|
| 85 |
-
| Image | True Label | Custom Model (Top-1, Score) | CLIP (Top-1, Score) | OpenAI (Label, Confidence) |
|
| 86 |
-
|---|---|---|---|---|
|
| 87 |
-
| `example_images/baseball.jpg` | baseball | baseball (0.7870) | baseball (0.9825) | baseball (0.99) |
|
| 88 |
-
| `example_images/basketball.jpg` | basketball | basketball (0.6516) | basketball (0.9850) | basketball (1.0) |
|
| 89 |
-
| `example_images/football.jpg` | football | football (0.5868) | football (0.9355) | football (1.0) |
|
| 90 |
-
| `example_images/golf.jpg` | golf | golf (0.5697) | golf (0.9964) | golf (0.95) |
|
| 91 |
-
| `example_images/tennis.jpg` | tennis | tennis (0.3632) | tennis (0.9837) | tennis (0.98) |
|
|
|
|
| 7 |
sdk_version: 6.11.0
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|