File size: 3,115 Bytes
e6d39e4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
104
105
106
107
108
109
---
license: cc-by-4.0
task_categories:
- image-classification
language:
- en
---

# CIFAR-10 Feature Representations (BTL3)

This dataset contains pre-extracted **feature embeddings** from the CIFAR-10 dataset, produced using several pretrained image classification models.  
The goal is to enable fast experimentation, classifier prototyping, and model comparison **without needing to train or forward pass large models in Colab**.

---

## Dataset Source

The original CIFAR-10 dataset is MIT-licensed and available here:  
https://www.cs.toronto.edu/~kriz/cifar.html

This dataset **does not contain the raw images**, only derived representation vectors.

---

## Models Used for Feature Extraction

| Model           | Input Size | Library / Weights                                     | Feature Representation         | Output Dim |
| --------------- | ---------- | ----------------------------------------------------- | ------------------------------ | ---------- |
| ResNet-50       | 224×224    | torchvision (`ResNet50_Weights.IMAGENET1K_V1`)        | Global average pooled          | **2048**   |
| VGG-16          | 224×224    | torchvision (`VGG16_Weights.IMAGENET1K_V1`)           | FC6 layer output               | **4096**   |
| EfficientNet-B0 | 224×224    | torchvision (`EfficientNet_B0_Weights.IMAGENET1K_V1`) | Global average pooled          | **1280**   |
| ViT-Base/16     | 224×224    | timm (`vit_base_patch16_224`)                         | CLS token embedding            | **768**    |
| Swin-Base       | 224×224    | timm (`swin_base_patch4_window7_224`)                 | Global mean pooled final stage | **1024**   |

Each model produces a different feature dimensionality depending on its architecture.

---

## File Format

All feature data is stored in **compressed `.npz`** format:

```
model_name/
train_features.npz
test_features.npz
````

Each `.npz` file contains:
- **`features`** → Feature vectors of shape `(N, D)`
- **`labels`** → Corresponding class labels `(N,)`

Example:  
If using ResNet-50 → `(50000, 2048)` for training features.

---

## Loading the Features in Python

```python
from huggingface_hub import hf_hub_download
import numpy as np

def load_features(model_name, split="train"):
    file_path = hf_hub_download(
        repo_id="LeTienDat/BTL3_CIFAR-10",
        filename=f"{model_name}/{split}_features.npz"
    )
    data = np.load(file_path)
    return data["features"], data["labels"]

# Example usage
X_train, y_train = load_features("resnet50", "train")
X_test, y_test = load_features("resnet50", "test")

print(X_train.shape, y_train.shape)
````

---

## License

This dataset is released under the **CC-BY 4.0** license.

You are free to:

* Use
* Modify
* Share
* Publish results

As long as you **credit this dataset repository**.

Original CIFAR-10 dataset is MIT licensed.

---

## Citation

If you use these features, please cite:

```
@misc{BTL3_CIFAR10_Features,
  author = {Le Tien Dat},
  title = {BTL3 CIFAR-10 Feature Dataset},
  year = {2025},
  howpublished = {\url{https://huggingface.co/LeTienDat/BTL3_CIFAR-10}}
}
```