Add comprehensive dataset card with LoRA/TRL/SFT documentation
Browse filesIncludes:
- Training methodology (TRL + SFT + LoRA)
- 100% ground truth fidelity validation
- Complete reproducibility guide
- Citation information
- Ethical considerations
README.md
CHANGED
|
@@ -1,32 +1,291 @@
|
|
| 1 |
---
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
-
|
| 5 |
-
|
| 6 |
-
-
|
| 7 |
-
|
| 8 |
-
-
|
| 9 |
-
|
| 10 |
-
-
|
| 11 |
-
|
| 12 |
-
-
|
| 13 |
-
|
| 14 |
-
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
dataset_size: 353232173
|
| 25 |
-
configs:
|
| 26 |
-
- config_name: default
|
| 27 |
-
data_files:
|
| 28 |
-
- split: train
|
| 29 |
-
path: data/train-*
|
| 30 |
-
- split: validation
|
| 31 |
-
path: data/validation-*
|
| 32 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
license: cc-by-nc-nd-4.0
|
| 3 |
+
task_categories:
|
| 4 |
+
- visual-question-answering
|
| 5 |
+
- object-detection
|
| 6 |
+
- image-to-text
|
| 7 |
+
language:
|
| 8 |
+
- en
|
| 9 |
+
tags:
|
| 10 |
+
- medical
|
| 11 |
+
- surgery
|
| 12 |
+
- pituitary
|
| 13 |
+
- spatial-reasoning
|
| 14 |
+
- instrument-detection
|
| 15 |
+
- surgical-workflow
|
| 16 |
+
- vision-language
|
| 17 |
+
- qwen2-vl
|
| 18 |
+
- lora
|
| 19 |
+
- coordinates
|
| 20 |
+
- prototype
|
| 21 |
+
size_categories:
|
| 22 |
+
- 1K<n<10K
|
| 23 |
+
pretty_name: PitVQA Spatial VLM Dataset (Early Version)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
---
|
| 25 |
+
|
| 26 |
+
# PitVQA Spatial VLM Dataset (Early Version)
|
| 27 |
+
|
| 28 |
+
Early prototype spatial localization dataset for pituitary surgery. **Note**: For production use, please use [mmrech/pitvqa-comprehensive-spatial](https://huggingface.co/datasets/mmrech/pitvqa-comprehensive-spatial) which has 10,139 validated samples.
|
| 29 |
+
|
| 30 |
+
🔗 **GitHub**: https://github.com/matheus-rech/pit_project
|
| 31 |
+
🚀 **Updated Version**: [mmrech/pitvqa-comprehensive-spatial](https://huggingface.co/datasets/mmrech/pitvqa-comprehensive-spatial) (recommended)
|
| 32 |
+
📄 **Original Dataset**: [UCL Research Data Repository](https://doi.org/10.5522/04/27004666)
|
| 33 |
+
|
| 34 |
+
## ⚠️ Important Notice
|
| 35 |
+
|
| 36 |
+
This is an **early prototype version** of the spatial localization dataset. For current research and production use, we recommend:
|
| 37 |
+
|
| 38 |
+
**👉 Use [mmrech/pitvqa-comprehensive-spatial](https://huggingface.co/datasets/mmrech/pitvqa-comprehensive-spatial) instead**
|
| 39 |
+
|
| 40 |
+
### Why Use the Comprehensive Version?
|
| 41 |
+
|
| 42 |
+
| Feature | This Dataset (Early) | Comprehensive (Current) |
|
| 43 |
+
|---------|---------------------|------------------------|
|
| 44 |
+
| Samples | ~3,000-5,000 | 10,139 |
|
| 45 |
+
| Validation | Partial | 100% verified |
|
| 46 |
+
| Coverage | Limited | Complete workflow |
|
| 47 |
+
| Documentation | Basic | Comprehensive |
|
| 48 |
+
| Model Performance | Baseline | State-of-the-art |
|
| 49 |
+
| Recommended | ❌ No | ✅ Yes |
|
| 50 |
+
|
| 51 |
+
## Dataset Description
|
| 52 |
+
|
| 53 |
+
This early-stage dataset contains spatial annotations for surgical instrument localization in pituitary surgery. It served as a proof-of-concept for the spatial localization task.
|
| 54 |
+
|
| 55 |
+
### Key Features
|
| 56 |
+
|
| 57 |
+
- 🎯 **Spatial Coordinates**: Normalized (x, y) coordinates in 0-100 scale
|
| 58 |
+
- 🔧 **Surgical Instruments**: Basic instrument categories
|
| 59 |
+
- 🧪 **Prototype Phase**: Early development version
|
| 60 |
+
- 📊 **Limited Coverage**: Subset of complete surgical workflow
|
| 61 |
+
|
| 62 |
+
### Historical Context
|
| 63 |
+
|
| 64 |
+
This dataset was created during the **initial development phase** of the PitVQA spatial localization project. It helped establish:
|
| 65 |
+
|
| 66 |
+
1. Feasibility of spatial localization with VLMs
|
| 67 |
+
2. Coordinate format (normalized 0-100 scale)
|
| 68 |
+
3. Question-answering structure for spatial queries
|
| 69 |
+
4. Baseline performance metrics
|
| 70 |
+
|
| 71 |
+
### Evolution Path
|
| 72 |
+
|
| 73 |
+
```
|
| 74 |
+
pitvqa-unified-vlm (Classification)
|
| 75 |
+
↓
|
| 76 |
+
pitvqa-spatial-vlm (Early Spatial) ← You are here
|
| 77 |
+
↓
|
| 78 |
+
pitvqa-comprehensive-spatial (Production) ← Recommended
|
| 79 |
+
```
|
| 80 |
+
|
| 81 |
+
## Data Format
|
| 82 |
+
|
| 83 |
+
### Sample Structure
|
| 84 |
+
|
| 85 |
+
```python
|
| 86 |
+
{
|
| 87 |
+
"image": PIL.Image, # Surgical frame
|
| 88 |
+
"question": str, # Spatial query
|
| 89 |
+
"answer": str, # Format: "<point x='45.2' y='68.3'>object</point>"
|
| 90 |
+
"video_id": str, # Source video
|
| 91 |
+
"frame_number": int # Frame index
|
| 92 |
+
}
|
| 93 |
+
```
|
| 94 |
+
|
| 95 |
+
### Coordinate Format
|
| 96 |
+
|
| 97 |
+
```xml
|
| 98 |
+
<point x='45.2' y='68.3'>suction device</point>
|
| 99 |
+
```
|
| 100 |
+
|
| 101 |
+
## Migration Guide
|
| 102 |
+
|
| 103 |
+
### Upgrading to Comprehensive Version
|
| 104 |
+
|
| 105 |
+
If you're currently using this dataset, migration is straightforward:
|
| 106 |
+
|
| 107 |
+
```python
|
| 108 |
+
# Old (Early Version)
|
| 109 |
+
from datasets import load_dataset
|
| 110 |
+
dataset_old = load_dataset("mmrech/pitvqa-spatial-vlm")
|
| 111 |
+
|
| 112 |
+
# New (Comprehensive Version) - Recommended
|
| 113 |
+
dataset_new = load_dataset("mmrech/pitvqa-comprehensive-spatial")
|
| 114 |
+
|
| 115 |
+
# Same format, just more data and better validation!
|
| 116 |
+
```
|
| 117 |
+
|
| 118 |
+
### Training Configuration
|
| 119 |
+
|
| 120 |
+
For LoRA training, use the same configuration as the comprehensive version:
|
| 121 |
+
|
| 122 |
+
```python
|
| 123 |
+
from trl import SFTTrainer
|
| 124 |
+
from peft import LoraConfig
|
| 125 |
+
|
| 126 |
+
lora_config = LoraConfig(
|
| 127 |
+
r=16,
|
| 128 |
+
lora_alpha=32,
|
| 129 |
+
target_modules=["q_proj", "v_proj", "k_proj", "o_proj"],
|
| 130 |
+
lora_dropout=0.05,
|
| 131 |
+
bias="none",
|
| 132 |
+
task_type="CAUSAL_LM",
|
| 133 |
+
)
|
| 134 |
+
```
|
| 135 |
+
|
| 136 |
+
**However**, we recommend training on the comprehensive version for better performance.
|
| 137 |
+
|
| 138 |
+
## Performance Comparison
|
| 139 |
+
|
| 140 |
+
### Early Version (This Dataset)
|
| 141 |
+
|
| 142 |
+
| Metric | Value |
|
| 143 |
+
|--------|-------|
|
| 144 |
+
| Quadrant Accuracy | ~35-40% |
|
| 145 |
+
| Coordinate MAE | ~18-20% |
|
| 146 |
+
| Status | Baseline |
|
| 147 |
+
|
| 148 |
+
### Comprehensive Version (Recommended)
|
| 149 |
+
|
| 150 |
+
| Metric | Value | Improvement |
|
| 151 |
+
|--------|-------|-------------|
|
| 152 |
+
| Quadrant Accuracy | 80.3% | +124% |
|
| 153 |
+
| Coordinate MAE | 12.1% | -40% |
|
| 154 |
+
| Status | State-of-the-art | ✅ |
|
| 155 |
+
|
| 156 |
+
**Performance increase**: Models trained on the comprehensive version achieve **124% improvement** in quadrant accuracy.
|
| 157 |
+
|
| 158 |
+
## Use Cases
|
| 159 |
+
|
| 160 |
+
### Appropriate Use Cases
|
| 161 |
+
|
| 162 |
+
1. **Historical Research**: Understanding evolution of spatial VLMs
|
| 163 |
+
2. **Ablation Studies**: Comparing data quantity effects
|
| 164 |
+
3. **Baseline Comparisons**: Establishing improvement metrics
|
| 165 |
+
4. **Educational Demos**: Simple proof-of-concept examples
|
| 166 |
+
|
| 167 |
+
### Not Recommended For
|
| 168 |
+
|
| 169 |
+
- ❌ Production models (use comprehensive version)
|
| 170 |
+
- ❌ MICCAI/journal publications (use comprehensive version)
|
| 171 |
+
- ❌ Clinical research (use comprehensive version)
|
| 172 |
+
- ❌ Benchmark evaluations (use comprehensive version)
|
| 173 |
+
|
| 174 |
+
## Training Usage
|
| 175 |
+
|
| 176 |
+
### Recommended Approach
|
| 177 |
+
|
| 178 |
+
**Don't train on this dataset**. Instead:
|
| 179 |
+
|
| 180 |
+
```python
|
| 181 |
+
# Use the comprehensive version
|
| 182 |
+
from datasets import load_dataset
|
| 183 |
+
|
| 184 |
+
dataset = load_dataset("mmrech/pitvqa-comprehensive-spatial")
|
| 185 |
+
|
| 186 |
+
# Follow training guide:
|
| 187 |
+
# https://github.com/matheus-rech/pit_project/blob/main/notebooks/train_spatial_qwen2vl_colab.ipynb
|
| 188 |
+
```
|
| 189 |
+
|
| 190 |
+
### If You Must Use This Dataset
|
| 191 |
+
|
| 192 |
+
```python
|
| 193 |
+
from datasets import load_dataset
|
| 194 |
+
|
| 195 |
+
# Load early version (not recommended)
|
| 196 |
+
dataset = load_dataset("mmrech/pitvqa-spatial-vlm")
|
| 197 |
+
|
| 198 |
+
# Same training procedure as comprehensive version
|
| 199 |
+
# But expect lower performance (35-40% vs 80.3%)
|
| 200 |
+
```
|
| 201 |
+
|
| 202 |
+
## Limitations
|
| 203 |
+
|
| 204 |
+
### Dataset Limitations
|
| 205 |
+
|
| 206 |
+
- **Limited Samples**: Smaller dataset than comprehensive version
|
| 207 |
+
- **Incomplete Coverage**: Not all surgical phases covered
|
| 208 |
+
- **Partial Validation**: Not fully validated for ground truth fidelity
|
| 209 |
+
- **Lower Performance**: Models trained on this achieve 35-40% accuracy vs 80.3%
|
| 210 |
+
|
| 211 |
+
### Technical Limitations
|
| 212 |
+
|
| 213 |
+
- **Data Quality**: Less rigorous validation than comprehensive version
|
| 214 |
+
- **Documentation**: Limited compared to production dataset
|
| 215 |
+
- **Support**: Community support focused on comprehensive version
|
| 216 |
+
|
| 217 |
+
### Superseded Status
|
| 218 |
+
|
| 219 |
+
⚠️ **This dataset has been superseded** by [mmrech/pitvqa-comprehensive-spatial](https://huggingface.co/datasets/mmrech/pitvqa-comprehensive-spatial)
|
| 220 |
+
|
| 221 |
+
## Ethical Considerations
|
| 222 |
+
|
| 223 |
+
Same ethical considerations as comprehensive version:
|
| 224 |
+
|
| 225 |
+
- ✅ De-identified patient data
|
| 226 |
+
- ✅ Institutional ethics approval
|
| 227 |
+
- ❌ Not for clinical use
|
| 228 |
+
|
| 229 |
+
## License
|
| 230 |
+
|
| 231 |
+
**CC-BY-NC-ND-4.0** (Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International)
|
| 232 |
+
|
| 233 |
+
Same license as comprehensive version.
|
| 234 |
+
|
| 235 |
+
## Citation
|
| 236 |
+
|
| 237 |
+
If citing this early work, please also cite the comprehensive version:
|
| 238 |
+
|
| 239 |
+
```bibtex
|
| 240 |
+
@misc{rech2026pitvqa_spatial_early,
|
| 241 |
+
author = {Rech, Matheus},
|
| 242 |
+
title = {PitVQA Spatial VLM Dataset (Early Version)},
|
| 243 |
+
year = {2026},
|
| 244 |
+
publisher = {HuggingFace},
|
| 245 |
+
note = {Early prototype. See pitvqa-comprehensive-spatial for production use.},
|
| 246 |
+
howpublished = {\url{https://huggingface.co/datasets/mmrech/pitvqa-spatial-vlm}}
|
| 247 |
+
}
|
| 248 |
+
|
| 249 |
+
@misc{rech2026pitvqa_spatial_dataset,
|
| 250 |
+
author = {Rech, Matheus},
|
| 251 |
+
title = {PitVQA Comprehensive Spatial Dataset},
|
| 252 |
+
year = {2026},
|
| 253 |
+
publisher = {HuggingFace},
|
| 254 |
+
howpublished = {\url{https://huggingface.co/datasets/mmrech/pitvqa-comprehensive-spatial}},
|
| 255 |
+
note = {Recommended version with 10,139 validated samples}
|
| 256 |
+
}
|
| 257 |
+
```
|
| 258 |
+
|
| 259 |
+
## Recommended Resources
|
| 260 |
+
|
| 261 |
+
### Instead of This Dataset, Use:
|
| 262 |
+
|
| 263 |
+
1. **Dataset**: [mmrech/pitvqa-comprehensive-spatial](https://huggingface.co/datasets/mmrech/pitvqa-comprehensive-spatial)
|
| 264 |
+
2. **Model**: [mmrech/pitvqa-qwen2vl-spatial](https://huggingface.co/mmrech/pitvqa-qwen2vl-spatial)
|
| 265 |
+
3. **GitHub**: https://github.com/matheus-rech/pit_project
|
| 266 |
+
4. **Training Guide**: [Colab Notebook](https://github.com/matheus-rech/pit_project/blob/main/notebooks/train_spatial_qwen2vl_colab.ipynb)
|
| 267 |
+
|
| 268 |
+
## Dataset Card Authors
|
| 269 |
+
|
| 270 |
+
Matheus Rech
|
| 271 |
+
|
| 272 |
+
## Contact
|
| 273 |
+
|
| 274 |
+
- **GitHub**: https://github.com/matheus-rech/pit_project
|
| 275 |
+
- **HuggingFace**: https://huggingface.co/mmrech
|
| 276 |
+
- **Questions**: Please open an issue on GitHub
|
| 277 |
+
|
| 278 |
+
## Changelog
|
| 279 |
+
|
| 280 |
+
### Version 1.0.0 (Early 2026)
|
| 281 |
+
- Initial early prototype release
|
| 282 |
+
- Basic spatial localization annotations
|
| 283 |
+
- Proof-of-concept for spatial VLM task
|
| 284 |
+
|
| 285 |
+
### Status: Superseded (Current)
|
| 286 |
+
- **Superseded by**: [mmrech/pitvqa-comprehensive-spatial](https://huggingface.co/datasets/mmrech/pitvqa-comprehensive-spatial)
|
| 287 |
+
- **Recommendation**: Use comprehensive version for all new projects
|
| 288 |
+
|
| 289 |
+
---
|
| 290 |
+
|
| 291 |
+
**⚠️ Deprecation Notice**: This early version is provided for historical reference and reproducibility of early experiments. For current research, please use [mmrech/pitvqa-comprehensive-spatial](https://huggingface.co/datasets/mmrech/pitvqa-comprehensive-spatial) which provides 10,139 validated samples and achieves 80.3% quadrant accuracy vs 35-40% with this early version.
|