mnist_28 / README.md
FrankCCCCC's picture
Update README.md
5d6f490 verified
---
license: apache-2.0
task_categories:
- image-classification
- unconditional-image-generation
language:
- en
size_categories:
- 10K<n<100K
---
# MNIST 28×28 Grayscale Dataset
The original MNIST dataset with handwritten digits in 28×28 grayscale format, stored in efficient Parquet format for modern deep learning applications.
## Overview
This dataset contains the original MNIST handwritten digit dataset in its native format:
- **Format**: 28×28 grayscale images
- **Digit labels**: 0-9 (single-label classification)
- **Image format**: Grayscale PIL Images
- **Storage**: Parquet format for efficient loading
## Dataset Statistics
### Training Set (60,000 samples)
| Digit | Count | Digit | Count |
|-------|-------|-------|-------|
| 0 | 5,923 | 5 | 5,421 |
| 1 | 6,742 | 6 | 5,918 |
| 2 | 5,958 | 7 | 6,265 |
| 3 | 6,131 | 8 | 5,851 |
| 4 | 5,842 | 9 | 5,949 |
### Test Set (10,000 samples)
| Digit | Count | Digit | Count |
|-------|-------|-------|-------|
| 0 | 980 | 5 | 892 |
| 1 | 1,135 | 6 | 958 |
| 2 | 1,032 | 7 | 1,028 |
| 3 | 1,010 | 8 | 974 |
| 4 | 982 | 9 | 1,009 |
## Directory Structure
```
mnist_28/
├── README.md # This documentation
├── train-00000-of-00001.parquet # Training data (Parquet format)
└── test-00000-of-00001.parquet # Test data (Parquet format)
```
## Key Features
- **Original Resolution**: Maintains original 28×28 pixel resolution
- **Grayscale Format**: Single-channel grayscale format as in original MNIST
- **PIL Integration**: Images loaded as PIL RGB objects ready for preprocessing
- **Standard Splits**: Maintains original MNIST train/test division
- **HuggingFace Compatible**: Full integration with datasets library
- **Efficient Loading**: Parquet format for fast columnar data access and compression
## Usage
### Loading with HuggingFace Datasets
```python
from datasets import load_dataset
# Load the dataset using the custom script
dataset = load_dataset("FrankCCCCC/mnist_28", trust_remote_code=True)
print(f"Train samples: {len(dataset['train'])}")
print(f"Test samples: {len(dataset['test'])}")
# Access a sample
sample = dataset['train'][0]
print(f"Image shape: {sample['image'].size}") # (28, 28)
print(f"Image mode: {sample['image'].mode}") # L (Grayscale)
print(f"Label: {sample['label']}") # Integer: 0-9
```
## Transformations Applied
The dataset preprocessing pipeline includes:
1. **Format Conversion**: IDX → Parquet
2. **Data Storage**: Parquet format for efficient storage and loading
3. **Data Type**: PIL Image objects for easy integration
4. **Format Preservation**: Maintains original 28×28 grayscale format
## Dataset Format
Each sample contains:
```python
{
'image': PIL.Image, # 28×28 grayscale image
'label': int, # Digit class (0-9)
}
```
## Technical Details
- **Original Source**: MNIST Database of Handwritten Digits
- **Format**: Parquet files for efficient columnar storage
- **Preprocessing**: Maintains original grayscale format and 28×28 resolution
- **Loading**: HuggingFace Datasets with custom GeneratorBasedBuilder
- **Compression**: Parquet format provides built-in compression and fast access
## Citation
```bibtex
@article{lecun1998mnist,
title={The MNIST database of handwritten digits},
author={LeCun, Yann and Bottou, L{\'e}on and Bengio, Yoshua and Haffner, Patrick},
year={1998},
url={http://yann.lecun.com/exdb/mnist/}
}
@misc{mnist28,
title={MNIST 28×28 Grayscale Dataset},
author={Original MNIST for Deep Learning},
year={2024},
note={Original MNIST dataset in efficient Parquet format}
}
```
## License
This dataset follows the same license as the original MNIST dataset. The original MNIST database is available under the Creative Commons Attribution-Share Alike 3.0 license.
## Acknowledgments
- Based on the original MNIST dataset by Yann LeCun, Corinna Cortes, and Christopher J.C. Burges
- Preserved in original format for classical deep learning applications
- Compatible with HuggingFace Datasets ecosystem for seamless integration
- Optimized for CNN architectures and transfer learning applications