ochsncon commited on
Commit
7127065
·
verified ·
1 Parent(s): f90fe21

Create readme.md

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