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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
task_categories:
|
| 4 |
+
- image-classification
|
| 5 |
+
- image-regression
|
| 6 |
+
tags:
|
| 7 |
+
- medical
|
| 8 |
+
- retina
|
| 9 |
+
- age-prediction
|
| 10 |
+
- fundus-images
|
| 11 |
+
size_categories:
|
| 12 |
+
- 1K<n<10K
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# Retina Age Analysis Dataset
|
| 16 |
+
|
| 17 |
+
## Dataset Description
|
| 18 |
+
|
| 19 |
+
This dataset contains **9,857 retinal fundus images** from **5,393 patients** for age prediction tasks.
|
| 20 |
+
|
| 21 |
+
### Dataset Summary
|
| 22 |
+
|
| 23 |
+
- **Task**: Age prediction from retinal fundus images
|
| 24 |
+
- **Images**: 9,857 high-quality retinal images
|
| 25 |
+
- **Patients**: 5,393 unique patients
|
| 26 |
+
- **Age Range**: 5-97 years
|
| 27 |
+
- **Image Format**: JPEG
|
| 28 |
+
- **Average Image Size**: ~1 MB
|
| 29 |
+
|
| 30 |
+
### Supported Tasks
|
| 31 |
+
|
| 32 |
+
1. **Regression**: Predict continuous age (5-97 years)
|
| 33 |
+
2. **Classification**: Predict age group (5 classes: pediatric, young adult, middle age, senior, elderly)
|
| 34 |
+
|
| 35 |
+
### Data Splits
|
| 36 |
+
|
| 37 |
+
| Split | Images | Patients | Percentage |
|
| 38 |
+
|-------|--------|----------|------------|
|
| 39 |
+
| Train | 6,902 | 3,775 | 70% |
|
| 40 |
+
| Validation | 1,493 | 809 | 15% |
|
| 41 |
+
| Test | 1,462 | 809 | 15% |
|
| 42 |
+
|
| 43 |
+
**Note**: Split at patient level to prevent data leakage.
|
| 44 |
+
|
| 45 |
+
### Age Distribution
|
| 46 |
+
|
| 47 |
+
| Age Group | Age Range | Count | Percentage |
|
| 48 |
+
|-----------|-----------|-------|------------|
|
| 49 |
+
| Pediatric | 5-17 | 291 | 3.0% |
|
| 50 |
+
| Young Adult | 18-39 | 1,447 | 14.7% |
|
| 51 |
+
| Middle Age | 40-59 | 2,946 | 29.9% |
|
| 52 |
+
| Senior | 60-74 | 3,484 | 35.3% |
|
| 53 |
+
| Elderly | 75+ | 1,689 | 17.1% |
|
| 54 |
+
|
| 55 |
+
### Dataset Structure
|
| 56 |
+
|
| 57 |
+
```
|
| 58 |
+
retina-age-analysis/
|
| 59 |
+
├── images/ # 9,857 retinal fundus images
|
| 60 |
+
│ ├── img00001.jpg
|
| 61 |
+
│ ├── img00002.jpg
|
| 62 |
+
│ └── ...
|
| 63 |
+
│
|
| 64 |
+
└── splits/ # Train/val/test split CSV files
|
| 65 |
+
├── train.csv # 6,902 samples
|
| 66 |
+
├── val.csv # 1,493 samples
|
| 67 |
+
└── test.csv # 1,462 samples
|
| 68 |
+
```
|
| 69 |
+
|
| 70 |
+
### Data Fields
|
| 71 |
+
|
| 72 |
+
Each CSV file contains:
|
| 73 |
+
|
| 74 |
+
- `image_id`: Image filename (without extension)
|
| 75 |
+
- `patient_id`: Unique patient identifier
|
| 76 |
+
- `patient_age`: Age in years (target variable for regression)
|
| 77 |
+
- `age_group_broad`: Age category name
|
| 78 |
+
- `age_group_broad_numeric`: Age category index (0-4, target for classification)
|
| 79 |
+
- `patient_sex`: Gender (1=Male, 2=Female)
|
| 80 |
+
- `exam_eye`: Eye examined (1=Right, 2=Left)
|
| 81 |
+
- `diabetic_retinopathy`: DR status (0=No, 1=Yes)
|
| 82 |
+
- `camera`: Camera type used
|
| 83 |
+
- Additional clinical features
|
| 84 |
+
|
| 85 |
+
### Usage Example
|
| 86 |
+
|
| 87 |
+
```python
|
| 88 |
+
from datasets import load_dataset
|
| 89 |
+
from PIL import Image
|
| 90 |
+
import pandas as pd
|
| 91 |
+
|
| 92 |
+
# Load dataset
|
| 93 |
+
dataset = load_dataset("ramankamran/retina-age-analysis")
|
| 94 |
+
|
| 95 |
+
# Load splits
|
| 96 |
+
train_df = pd.read_csv("hf://datasets/ramankamran/retina-age-analysis/splits/train.csv")
|
| 97 |
+
val_df = pd.read_csv("hf://datasets/ramankamran/retina-age-analysis/splits/val.csv")
|
| 98 |
+
test_df = pd.read_csv("hf://datasets/ramankamran/retina-age-analysis/splits/test.csv")
|
| 99 |
+
|
| 100 |
+
# Load an image
|
| 101 |
+
from huggingface_hub import hf_hub_download
|
| 102 |
+
img_path = hf_hub_download(
|
| 103 |
+
repo_id="ramankamran/retina-age-analysis",
|
| 104 |
+
filename="images/img00001.jpg",
|
| 105 |
+
repo_type="dataset"
|
| 106 |
+
)
|
| 107 |
+
image = Image.open(img_path)
|
| 108 |
+
|
| 109 |
+
# Get corresponding label
|
| 110 |
+
label = train_df[train_df['image_id'] == 'img00001']['patient_age'].values[0]
|
| 111 |
+
```
|
| 112 |
+
|
| 113 |
+
### PyTorch DataLoader
|
| 114 |
+
|
| 115 |
+
See the training code in the repository for PyTorch DataLoader implementation with:
|
| 116 |
+
- Data augmentation (rotation, flip, brightness, contrast)
|
| 117 |
+
- ImageNet normalization
|
| 118 |
+
- Batch loading
|
| 119 |
+
|
| 120 |
+
### Baseline Results
|
| 121 |
+
|
| 122 |
+
**Regression (Age Prediction):**
|
| 123 |
+
- MAE: 7-10 years (baseline)
|
| 124 |
+
- Target: < 5 years (optimized)
|
| 125 |
+
|
| 126 |
+
**Classification (Age Groups):**
|
| 127 |
+
- Accuracy: 70-75% (baseline)
|
| 128 |
+
- Target: 85-90% (with semi-supervised learning)
|
| 129 |
+
|
| 130 |
+
### License
|
| 131 |
+
|
| 132 |
+
MIT License
|
| 133 |
+
|
| 134 |
+
### Citation
|
| 135 |
+
|
| 136 |
+
If you use this dataset, please cite:
|
| 137 |
+
|
| 138 |
+
```bibtex
|
| 139 |
+
@dataset{retina_age_analysis,
|
| 140 |
+
author = {Raman Kamran},
|
| 141 |
+
title = {Retina Age Analysis Dataset},
|
| 142 |
+
year = {2025},
|
| 143 |
+
publisher = {Hugging Face},
|
| 144 |
+
url = {https://huggingface.co/datasets/ramankamran/retina-age-analysis}
|
| 145 |
+
}
|
| 146 |
+
```
|
| 147 |
+
|
| 148 |
+
### Dataset Curators
|
| 149 |
+
|
| 150 |
+
Dataset cleaned and prepared by ramankamran.
|
| 151 |
+
|
| 152 |
+
### Preprocessing
|
| 153 |
+
|
| 154 |
+
- Removed images with missing age labels (33.5% of original data)
|
| 155 |
+
- Removed inadequate quality images (8.9%)
|
| 156 |
+
- Verified all image files exist
|
| 157 |
+
- Created stratified train/val/test splits
|
| 158 |
+
- Patient-level splitting to prevent data leakage
|
| 159 |
+
|
| 160 |
+
### Intended Use
|
| 161 |
+
|
| 162 |
+
- Medical image analysis research
|
| 163 |
+
- Age prediction from retinal images
|
| 164 |
+
- Transfer learning for ophthalmology tasks
|
| 165 |
+
- Semi-supervised learning experiments
|
| 166 |
+
|
| 167 |
+
### Limitations
|
| 168 |
+
|
| 169 |
+
- Class imbalance (elderly patients over-represented, pediatric under-represented)
|
| 170 |
+
- Single imaging center data
|
| 171 |
+
- Requires domain knowledge for clinical interpretation
|
| 172 |
+
|
| 173 |
+
### Additional Information
|
| 174 |
+
|
| 175 |
+
For training code and examples, see: [GitHub Repository](https://github.com/ramankamran/retina-age-analysis)
|