BTL3_CIFAR-10 / README.md
LeTienDat's picture
Update README.md
e6d39e4 verified
---
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}}
}
```