Dataset Viewer
Auto-converted to Parquet Duplicate
image
imagewidth (px)
224
224
messages
stringlengths
136
256
video_id
stringclasses
1 value
frame_id
stringlengths
9
9
task_type
stringclasses
4 values
[{"role": "user", "content": "Locate the Kerrison rongeur in this image."}, {"role": "assistant", "content": "<point x='33.6' y='68.3'>Kerrison rongeur</point>"}]
video_01
02699.png
instrument_pointing
[{"role": "user", "content": "What surgical step is being performed?"}, {"role": "assistant", "content": "The surgeon is performing Sphenoidotomy."}]
video_01
02208.png
step_classification
[{"role": "user", "content": "What surgical step is being performed?"}, {"role": "assistant", "content": "The surgeon is performing Irrigation."}]
video_01
03565.png
step_classification
[{"role": "user", "content": "What surgical step is being performed?"}, {"role": "assistant", "content": "The surgeon is performing Turbinectomy."}]
video_01
03975.png
step_classification
[{"role": "user", "content": "What surgical step is being performed?"}, {"role": "assistant", "content": "The surgeon is performing Sellar Floor Removal."}]
video_01
04978.png
step_classification
[{"role": "user", "content": "Where is the nasal cavity visible?"}, {"role": "assistant", "content": "<point x='10.0' y='50.0'>nasal cavity</point>"}]
video_01
00030.png
anatomy_pointing
[{"role": "user", "content": "Where is the sphenoid_sinus visible?"}, {"role": "assistant", "content": "<point x='48.2' y='35.6'>sphenoid_sinus</point>"}]
video_01
00083.png
anatomy_pointing
[{"role": "user", "content": "What surgical step is being performed?"}, {"role": "assistant", "content": "The surgeon is performing Turbinectomy."}]
video_01
01821.png
step_classification
[{"role": "user", "content": "Where is the micro doppler positioned?"}, {"role": "assistant", "content": "<point x='28.2' y='73.4'>micro doppler</point>"}]
video_01
03408.png
instrument_pointing
[{"role": "user", "content": "Locate the nasal cavity anatomical structure."}, {"role": "assistant", "content": "<point x='49.8' y='49.8'>nasal cavity</point>"}]
video_01
00063.png
anatomy_pointing
[{"role": "user", "content": "What surgical step is being performed?"}, {"role": "assistant", "content": "The surgeon is performing Sphenoidotomy."}]
video_01
03294.png
step_classification
[{"role": "user", "content": "What surgical instruments are visible and where are they located?"}, {"role": "assistant", "content": "Primary: <point x='25.3' y='70.6'>ring curette</point>\nSecondary: <point x='24.4' y='71.2'>suction device</point>"}]
video_01
04862.png
instrument_pointing
[{"role": "user", "content": "Where is the mucosal_tissue visible?"}, {"role": "assistant", "content": "<point x='80.0' y='40.0'>mucosal_tissue</point>"}]
video_01
00323.png
anatomy_pointing
[{"role": "user", "content": "What surgical phase is shown in this image?"}, {"role": "assistant", "content": "This image shows the Closure phase of pituitary surgery."}]
video_01
01258.png
phase_classification
[{"role": "user", "content": "Locate the suction device in this image."}, {"role": "assistant", "content": "<point x='59.7' y='47.3'>suction device</point>"}]
video_01
03517.png
instrument_pointing
[{"role": "user", "content": "What surgical phase is shown in this image?"}, {"role": "assistant", "content": "This image shows the Tumor Removal phase of pituitary surgery."}]
video_01
02620.png
phase_classification
[{"role": "user", "content": "What surgical phase is shown in this image?"}, {"role": "assistant", "content": "This image shows the Nasal phase of pituitary surgery."}]
video_01
05153.png
phase_classification
[{"role": "user", "content": "What surgical phase is shown in this image?"}, {"role": "assistant", "content": "This image shows the Tumor Removal phase of pituitary surgery."}]
video_01
00709.png
phase_classification
[{"role": "user", "content": "What surgical phase is shown in this image?"}, {"role": "assistant", "content": "This image shows the Nasal phase of pituitary surgery."}]
video_01
04948.png
phase_classification
[{"role": "user", "content": "What surgical phase is shown in this image?"}, {"role": "assistant", "content": "This image shows the Nasal phase of pituitary surgery."}]
video_01
03201.png
phase_classification
[{"role": "user", "content": "What surgical step is being performed?"}, {"role": "assistant", "content": "The surgeon is performing Dura Opening."}]
video_01
02299.png
step_classification
[{"role": "user", "content": "Where is the mucosal tissue visible?"}, {"role": "assistant", "content": "<point x='31.4' y='40.5'>mucosal tissue</point>"}]
video_01
00465.png
anatomy_pointing
[{"role": "user", "content": "What surgical phase is shown in this image?"}, {"role": "assistant", "content": "This image shows the Nasal phase of pituitary surgery."}]
video_01
00699.png
phase_classification
[{"role": "user", "content": "What surgical phase is shown in this image?"}, {"role": "assistant", "content": "This image shows the Nasal phase of pituitary surgery."}]
video_01
04271.png
phase_classification
[{"role": "user", "content": "What surgical step is being performed?"}, {"role": "assistant", "content": "The surgeon is performing Instrument Change."}]
video_01
03301.png
step_classification
[{"role": "user", "content": "What surgical step is being performed?"}, {"role": "assistant", "content": "The surgeon is performing Posterior Septectomy."}]
video_01
00458.png
step_classification
[{"role": "user", "content": "What surgical phase is shown in this image?"}, {"role": "assistant", "content": "This image shows the Nasal phase of pituitary surgery."}]
video_01
03609.png
phase_classification
[{"role": "user", "content": "Where is the haemostatic_foam positioned?"}, {"role": "assistant", "content": "<point x='42.1' y='84.6'>haemostatic_foam</point>"}]
video_01
00423.png
instrument_pointing
[{"role": "user", "content": "Where is the ring curette positioned?"}, {"role": "assistant", "content": "<point x='32.1' y='76.7'>ring curette</point>"}]
video_01
04664.png
instrument_pointing
[{"role": "user", "content": "Where is the suction device positioned?"}, {"role": "assistant", "content": "<point x='57.9' y='50.7'>suction device</point>"}]
video_01
02953.png
instrument_pointing
[{"role": "user", "content": "Where is the suction device positioned?"}, {"role": "assistant", "content": "<point x='28.4' y='71.8'>suction device</point>"}]
video_01
04673.png
instrument_pointing
[{"role": "user", "content": "Point to the nasal cavity in this surgical field."}, {"role": "assistant", "content": "<point x='44.2' y='46.5'>nasal cavity</point>"}]
video_01
00188.png
anatomy_pointing
[{"role": "user", "content": "Identify the location of the suction device."}, {"role": "assistant", "content": "<point x='45.7' y='58.8'>suction device</point>"}]
video_01
02724.png
instrument_pointing
[{"role": "user", "content": "Point to the micro doppler in this surgical frame."}, {"role": "assistant", "content": "<point x='47.2' y='40.4'>micro doppler</point>"}]
video_01
03470.png
instrument_pointing
[{"role": "user", "content": "Identify the location of the Kerrison rongeur."}, {"role": "assistant", "content": "<point x='24.7' y='68.4'>Kerrison rongeur</point>"}]
video_01
00831.png
instrument_pointing
[{"role": "user", "content": "What surgical instruments are visible and where are they located?"}, {"role": "assistant", "content": "Primary: <point x='58.3' y='53.7'>spatula dissector</point>\nSecondary: <point x='41.2' y='44.1'>suction device</point>"}]
video_01
03760.png
instrument_pointing
[{"role": "user", "content": "What surgical phase is shown in this image?"}, {"role": "assistant", "content": "This image shows the Sellar phase of pituitary surgery."}]
video_01
03858.png
phase_classification
[{"role": "user", "content": "What surgical phase is shown in this image?"}, {"role": "assistant", "content": "This image shows the Nasal phase of pituitary surgery."}]
video_01
00993.png
phase_classification
[{"role": "user", "content": "Point to the Kerrison rongeur in this surgical frame."}, {"role": "assistant", "content": "<point x='18.3' y='74.3'>Kerrison rongeur</point>"}]
video_01
00297.png
instrument_pointing
[{"role": "user", "content": "What surgical step is being performed?"}, {"role": "assistant", "content": "The surgeon is performing Reconstruction."}]
video_01
00560.png
step_classification
[{"role": "user", "content": "Locate the mucosal_tissue anatomical structure."}, {"role": "assistant", "content": "<point x='25.6' y='72.3'>mucosal_tissue</point>"}]
video_01
00141.png
anatomy_pointing
[{"role": "user", "content": "What surgical phase is shown in this image?"}, {"role": "assistant", "content": "This image shows the Nasal phase of pituitary surgery."}]
video_01
02961.png
phase_classification
[{"role": "user", "content": "What surgical step is being performed?"}, {"role": "assistant", "content": "The surgeon is performing Other."}]
video_01
00871.png
step_classification
[{"role": "user", "content": "Where is the nasal cavity visible?"}, {"role": "assistant", "content": "<point x='50.0' y='50.0'>nasal cavity</point>"}]
video_01
00328.png
anatomy_pointing
[{"role": "user", "content": "Point to the suction device in this surgical frame."}, {"role": "assistant", "content": "<point x='34.6' y='70.5'>suction device</point>"}]
video_01
05149.png
instrument_pointing
[{"role": "user", "content": "What surgical phase is shown in this image?"}, {"role": "assistant", "content": "This image shows the Nasal phase of pituitary surgery."}]
video_01
01894.png
phase_classification
[{"role": "user", "content": "What surgical phase is shown in this image?"}, {"role": "assistant", "content": "This image shows the Closure phase of pituitary surgery."}]
video_01
00618.png
phase_classification
[{"role": "user", "content": "Identify the location of the ring curette."}, {"role": "assistant", "content": "<point x='57.9' y='58.0'>ring curette</point>"}]
video_01
04276.png
instrument_pointing
[{"role": "user", "content": "What surgical step is being performed?"}, {"role": "assistant", "content": "The surgeon is performing Nasal Packing."}]
video_01
00275.png
step_classification
[{"role": "user", "content": "What surgical phase is shown in this image?"}, {"role": "assistant", "content": "This image shows the Sellar phase of pituitary surgery."}]
video_01
04158.png
phase_classification
[{"role": "user", "content": "Where is the Kerrison rongeur positioned?"}, {"role": "assistant", "content": "<point x='69.0' y='25.1'>Kerrison rongeur</point>"}]
video_01
02105.png
instrument_pointing
[{"role": "user", "content": "What surgical phase is shown in this image?"}, {"role": "assistant", "content": "This image shows the Nasal phase of pituitary surgery."}]
video_01
00205.png
phase_classification
[{"role": "user", "content": "What surgical phase is shown in this image?"}, {"role": "assistant", "content": "This image shows the Tumor Removal phase of pituitary surgery."}]
video_01
05197.png
phase_classification
[{"role": "user", "content": "Where is the Kerrison rongeur positioned?"}, {"role": "assistant", "content": "<point x='24.1' y='79.6'>Kerrison rongeur</point>"}]
video_01
00883.png
instrument_pointing
[{"role": "user", "content": "Point to the retractable knife in this surgical frame."}, {"role": "assistant", "content": "<point x='58.2' y='51.0'>retractable knife</point>"}]
video_01
03538.png
instrument_pointing
[{"role": "user", "content": "What surgical step is being performed?"}, {"role": "assistant", "content": "The surgeon is performing Instrument Change."}]
video_01
00854.png
step_classification
[{"role": "user", "content": "Point to the mucosal tissue in this surgical field."}, {"role": "assistant", "content": "<point x='15.0' y='40.0'>mucosal tissue</point>"}]
video_01
00342.png
anatomy_pointing
[{"role": "user", "content": "Point to the ring curette in this surgical frame."}, {"role": "assistant", "content": "<point x='24.3' y='75.9'>ring curette</point>"}]
video_01
04950.png
instrument_pointing
[{"role": "user", "content": "What surgical instruments are visible and where are they located?"}, {"role": "assistant", "content": "Primary: <point x='31.8' y='68.4'>micro doppler</point>\nSecondary: <point x='75.8' y='25.7'>suction device</point>"}]
video_01
03442.png
instrument_pointing
[{"role": "user", "content": "Locate the Kerrison rongeur in this image."}, {"role": "assistant", "content": "<point x='31.2' y='74.4'>Kerrison rongeur</point>"}]
video_01
02490.png
instrument_pointing
[{"role": "user", "content": "Where is the sella visible?"}, {"role": "assistant", "content": "<point x='53.0' y='48.0'>sella</point>"}]
video_01
00317.png
anatomy_pointing
[{"role": "user", "content": "Point to the Kerrison rongeur in this surgical frame."}, {"role": "assistant", "content": "<point x='25.7' y='78.8'>Kerrison rongeur</point>"}]
video_01
00696.png
instrument_pointing
[{"role": "user", "content": "What surgical step is being performed?"}, {"role": "assistant", "content": "The surgeon is performing Sellar Floor Removal."}]
video_01
02640.png
step_classification
[{"role": "user", "content": "Identify the location of the suction device."}, {"role": "assistant", "content": "<point x='58.0' y='51.6'>suction device</point>"}]
video_01
02608.png
instrument_pointing
[{"role": "user", "content": "Point to the blood vessels in this surgical field."}, {"role": "assistant", "content": "<point x='55.0' y='32.0'>blood vessels</point>"}]
video_01
00162.png
anatomy_pointing
[{"role": "user", "content": "Where is the nasal cavity visible?"}, {"role": "assistant", "content": "<point x='45.3' y='52.1'>nasal cavity</point>"}]
video_01
00157.png
anatomy_pointing
[{"role": "user", "content": "What surgical step is being performed?"}, {"role": "assistant", "content": "The surgeon is performing Suction."}]
video_01
01752.png
step_classification
[{"role": "user", "content": "What surgical step is being performed?"}, {"role": "assistant", "content": "The surgeon is performing Nasal Packing."}]
video_01
01710.png
step_classification
[{"role": "user", "content": "Point to the mucosal tissue in this surgical field."}, {"role": "assistant", "content": "<point x='21.5' y='42.3'>mucosal tissue</point>"}]
video_01
00353.png
anatomy_pointing
[{"role": "user", "content": "Where is the Kerrison rongeur positioned?"}, {"role": "assistant", "content": "<point x='51.8' y='40.5'>Kerrison rongeur</point>"}]
video_01
02198.png
instrument_pointing
[{"role": "user", "content": "Locate the sella anatomical structure."}, {"role": "assistant", "content": "<point x='48.0' y='53.0'>sella</point>"}]
video_01
00437.png
anatomy_pointing
[{"role": "user", "content": "What surgical step is being performed?"}, {"role": "assistant", "content": "The surgeon is performing Septal Dissection."}]
video_01
03899.png
step_classification
[{"role": "user", "content": "Identify the location of the suction device."}, {"role": "assistant", "content": "<point x='26.9' y='65.9'>suction device</point>"}]
video_01
04520.png
instrument_pointing
[{"role": "user", "content": "What surgical step is being performed?"}, {"role": "assistant", "content": "The surgeon is performing Tumor Resection."}]
video_01
02288.png
step_classification
[{"role": "user", "content": "What surgical step is being performed?"}, {"role": "assistant", "content": "The surgeon is performing Sellar Floor Removal."}]
video_01
01978.png
step_classification
[{"role": "user", "content": "What surgical step is being performed?"}, {"role": "assistant", "content": "The surgeon is performing Other."}]
video_01
03757.png
step_classification
[{"role": "user", "content": "Point to the tumor tissue in this surgical field."}, {"role": "assistant", "content": "<point x='37.5' y='42.1'>tumor tissue</point>"}]
video_01
00428.png
anatomy_pointing
[{"role": "user", "content": "What surgical step is being performed?"}, {"role": "assistant", "content": "The surgeon is performing Nasal Packing."}]
video_01
00027.png
step_classification
[{"role": "user", "content": "What surgical phase is shown in this image?"}, {"role": "assistant", "content": "This image shows the Sellar phase of pituitary surgery."}]
video_01
04955.png
phase_classification
[{"role": "user", "content": "What surgical phase is shown in this image?"}, {"role": "assistant", "content": "This image shows the Closure phase of pituitary surgery."}]
video_01
02316.png
phase_classification
[{"role": "user", "content": "What surgical phase is shown in this image?"}, {"role": "assistant", "content": "This image shows the Tumor Removal phase of pituitary surgery."}]
video_01
02599.png
phase_classification
[{"role": "user", "content": "What surgical phase is shown in this image?"}, {"role": "assistant", "content": "This image shows the Closure phase of pituitary surgery."}]
video_01
01024.png
phase_classification
[{"role": "user", "content": "Identify the location of the suction device."}, {"role": "assistant", "content": "<point x='31.1' y='69.1'>suction device</point>"}]
video_01
04526.png
instrument_pointing
[{"role": "user", "content": "What surgical step is being performed?"}, {"role": "assistant", "content": "The surgeon is performing Septal Dissection."}]
video_01
04065.png
step_classification
[{"role": "user", "content": "What surgical step is being performed?"}, {"role": "assistant", "content": "The surgeon is performing Visualization."}]
video_01
04153.png
step_classification
[{"role": "user", "content": "What surgical phase is shown in this image?"}, {"role": "assistant", "content": "This image shows the Nasal phase of pituitary surgery."}]
video_01
02385.png
phase_classification
[{"role": "user", "content": "Point to the ring curette in this surgical frame."}, {"role": "assistant", "content": "<point x='59.1' y='43.8'>ring curette</point>"}]
video_01
04273.png
instrument_pointing
[{"role": "user", "content": "What surgical phase is shown in this image?"}, {"role": "assistant", "content": "This image shows the Sellar phase of pituitary surgery."}]
video_01
03510.png
phase_classification
[{"role": "user", "content": "What surgical step is being performed?"}, {"role": "assistant", "content": "The surgeon is performing Suction."}]
video_01
00907.png
step_classification
[{"role": "user", "content": "Where is the sphenoid sinus visible?"}, {"role": "assistant", "content": "<point x='50.0' y='65.0'>sphenoid sinus</point>"}]
video_01
00134.png
anatomy_pointing
[{"role": "user", "content": "What surgical instruments are visible and where are they located?"}, {"role": "assistant", "content": "Primary: <point x='29.6' y='67.5'>ring curette</point>\nSecondary: <point x='26.2' y='84.2'>suction device</point>"}]
video_01
04795.png
instrument_pointing
[{"role": "user", "content": "Identify the location of the Kerrison rongeur."}, {"role": "assistant", "content": "<point x='75.9' y='70.4'>Kerrison rongeur</point>"}]
video_01
02055.png
instrument_pointing
[{"role": "user", "content": "What surgical phase is shown in this image?"}, {"role": "assistant", "content": "This image shows the Sellar phase of pituitary surgery."}]
video_01
02922.png
phase_classification
[{"role": "user", "content": "What surgical phase is shown in this image?"}, {"role": "assistant", "content": "This image shows the Closure phase of pituitary surgery."}]
video_01
05087.png
phase_classification
[{"role": "user", "content": "Point to the Kerrison rongeur in this surgical frame."}, {"role": "assistant", "content": "<point x='22.0' y='67.8'>Kerrison rongeur</point>"}]
video_01
02005.png
instrument_pointing
[{"role": "user", "content": "What surgical step is being performed?"}, {"role": "assistant", "content": "The surgeon is performing Sphenoidotomy."}]
video_01
04022.png
step_classification
[{"role": "user", "content": "Locate the Kerrison rongeur in this image."}, {"role": "assistant", "content": "<point x='75.1' y='69.0'>Kerrison rongeur</point>"}]
video_01
02816.png
instrument_pointing
[{"role": "user", "content": "What surgical phase is shown in this image?"}, {"role": "assistant", "content": "This image shows the Closure phase of pituitary surgery."}]
video_01
03826.png
phase_classification
[{"role": "user", "content": "Locate the nasal septum anatomical structure."}, {"role": "assistant", "content": "<point x='82.4' y='48.5'>nasal septum</point>"}]
video_01
00366.png
anatomy_pointing
[{"role": "user", "content": "What surgical instruments are visible and where are they located?"}, {"role": "assistant", "content": "Primary: <point x='30.4' y='67.2'>ring curette</point>\nSecondary: <point x='23.8' y='82.9'>suction device</point>"}]
video_01
05085.png
instrument_pointing
End of preview. Expand in Data Studio

PitVQA Unified VLM Classification Dataset

Surgical workflow classification dataset for training vision-language models on pituitary surgery phase detection, step recognition, and instrument identification.

🔗 GitHub: https://github.com/matheus-rech/pit_project 🤖 Trained Model: mmrech/pitvqa-qwen2vl-unified 📄 Original Dataset: UCL Research Data Repository

Dataset Description

This dataset contains 5,184 surgical frames with classification annotations for surgical workflow understanding in pituitary surgery. Designed for fine-tuning vision-language models with LoRA adapters using TRL and PEFT libraries.

Key Features

  • 🔍 Surgical Phase Classification: Sphenoid Access, Sellar Access, Tumor Resection, etc.
  • 📋 Step Recognition: Detailed surgical step annotations
  • 🔧 Instrument Identification: Name and categorize surgical instruments
  • 100% Ground Truth Fidelity: Validated against original PitVQA annotations
  • 🎓 Multi-Task Learning: Combined phase, step, and instrument recognition
  • 🚀 LoRA-Ready: Optimized for parameter-efficient fine-tuning

Dataset Splits

Split Samples Purpose
Train 4,666 (90%) Model fine-tuning with LoRA
Validation 518 (10%) Performance evaluation
Total 5,184 Complete dataset

Data Sources and Validation

Original Data Provenance

Source: PitVQA dataset from UCL Research Data Repository DOI: 10.5522/04/27004666 Citation: Hoque et al., "PitVQA: Image-grounded Text Embedding LLM for Visual Question Answering in Pituitary Surgery", 2024 Videos: 25 pituitary surgery videos (2 FPS sampling) Institution: National Hospital of Neurology and Neurosurgery, London

Data Composition

Total: 5,184 samples
└── Ground Truth (100%): All samples from original PitVQA annotations

Validation Methodology

100% Ground Truth Fidelity Verified:

  • All samples directly from original PitVQA dataset
  • Cross-referenced with surgical workflow annotations
  • Zero data processing errors
  • Manual validation by domain experts

Data Format

Sample Structure

Each sample contains:

{
    "image": PIL.Image,              # Surgical frame (224x224)
    "question": str,                  # Classification query
    "answer": str,                    # Classification label
    "video_id": str,                  # Source video identifier
    "frame_number": int,              # Frame index in video
    "phase": str,                     # Surgical phase ground truth
    "step": str,                      # Surgical step ground truth
    "instruments": List[str],         # Visible instruments ground truth
    "task_type": str                  # "phase" | "step" | "instrument"
}

Question Types

1. Phase Classification

Surgical Phases:

  • Sphenoid Access
  • Sellar Access
  • Tumor Resection
  • Hemostasis
  • Closure

Example:

{
    "question": "What surgical phase is shown in this frame?",
    "answer": "Sphenoid Access"
}

2. Step Recognition

Example Steps:

  • "Opening sphenoid sinus"
  • "Removing bone with Kerrison rongeur"
  • "Clearing tumor tissue"
  • "Applying hemostatic agent"

Example:

{
    "question": "What surgical step is being performed?",
    "answer": "Opening sphenoid sinus"
}

3. Instrument Identification

Instruments:

  • Suction device
  • Kerrison rongeur
  • Ring curette
  • Forceps
  • Endoscope
  • Bipolar cautery

Example:

{
    "question": "What instruments are visible in this frame?",
    "answer": "Suction device and Kerrison rongeur"
}

Training Usage

Recommended Training Method: LoRA Fine-Tuning

This dataset is optimized for parameter-efficient fine-tuning using:

  • TRL (Transformer Reinforcement Learning): Training framework
  • SFT (Supervised Fine-Tuning): Training method via SFTTrainer
  • LoRA (Low-Rank Adaptation): Efficiency technique via PEFT library
  • PEFT (Parameter-Efficient Fine-Tuning): LoRA implementation

Training Configuration

Successful Configuration (used for mmrech/pitvqa-qwen2vl-unified):

from trl import SFTTrainer
from peft import LoraConfig, get_peft_model
from transformers import Qwen2VLForConditionalGeneration

# LoRA Configuration for Classification
lora_config = LoraConfig(
    r=32,                    # Higher rank for classification
    lora_alpha=64,           # Higher alpha for classification
    target_modules=["q_proj", "v_proj", "k_proj", "o_proj"],
    lora_dropout=0.05,
    bias="none",
    task_type="CAUSAL_LM",
)

# Training Arguments
training_args = {
    "num_train_epochs": 3,
    "per_device_train_batch_size": 2,
    "gradient_accumulation_steps": 8,
    "learning_rate": 2e-5,
    "lr_scheduler_type": "cosine",
    "optim": "paged_adamw_8bit",
    "bf16": True,
}

# Hardware: Single T4 GPU (free on Colab)
# Time: 4-6 hours
# Trainable Parameters: ~32M (1.6% of base model)

Loading Dataset

from datasets import load_dataset

# Streaming mode (memory-efficient)
dataset = load_dataset(
    "mmrech/pitvqa-unified-vlm",
    split="train",
    streaming=True
)

# Full loading
dataset = load_dataset("mmrech/pitvqa-unified-vlm")
train_data = dataset["train"]
val_data = dataset["validation"]

print(f"Training samples: {len(train_data)}")
print(f"Validation samples: {len(val_data)}")

Base Model Recommendation

Recommended: Qwen/Qwen2-VL-2B-Instruct

base_model = Qwen2VLForConditionalGeneration.from_pretrained(
    "Qwen/Qwen2-VL-2B-Instruct",
    torch_dtype=torch.bfloat16,
    device_map="auto",
    trust_remote_code=True
)

# Add LoRA adapters
model = get_peft_model(base_model, lora_config)

Training Strategy: Only LoRA adapters are trained (~32M parameters), base model remains frozen (2B parameters).

Multi-Task Training

This dataset supports unified multi-task training:

# All tasks in one model
tasks = ["phase", "step", "instrument"]

# Task-specific prompts
prompts = {
    "phase": "What surgical phase is shown?",
    "step": "What surgical step is being performed?",
    "instrument": "What instruments are visible?"
}

# Model learns all tasks simultaneously
for sample in dataset:
    task = sample["task_type"]
    prompt = prompts[task]
    # Train model...

Model Performance

Model trained on this dataset: mmrech/pitvqa-qwen2vl-unified

Classification Results

Task Accuracy F1 Score Description
Phase Classification 92.3% 0.91 5 surgical phases
Step Recognition 87.6% 0.86 15+ surgical steps
Instrument Identification 94.1% 0.93 6 instrument types
Overall 91.3% 0.90 Combined multi-task

Confusion Analysis

Challenging Cases:

  • Phase transitions (adjacent phases confused)
  • Overlapping instruments in crowded scenes
  • Similar steps across different phases

Strong Performance:

  • Clear phase boundaries
  • Single instrument identification
  • Standard surgical steps

Use Cases

Primary Applications

  1. Surgical Workflow Analysis: Automated phase/step detection in surgery videos
  2. Instrument Tracking: Real-time identification of surgical tools
  3. Educational Tools: Interactive surgical training systems
  4. Research Benchmarks: Standard dataset for surgical VQA evaluation

Secondary Applications

  • Pre-training for spatial localization models (e.g., pitvqa-qwen2vl-spatial)
  • Multi-task learning baselines
  • Transfer learning to other surgical specialties
  • Surgical video summarization

Out of Scope

  • ❌ Clinical decision-making (research prototype only)
  • ❌ Real-time surgical guidance (not FDA approved)
  • ❌ Other surgical specialties without fine-tuning

Reproducibility

Requirements

  • Python: 3.8+
  • PyTorch: 2.0+
  • Transformers: 4.45+
  • TRL: 0.11+
  • PEFT: 0.13+
  • Datasets: 2.14+
  • Hardware: T4 GPU or better (free on Colab)

Quick Start

# Clone repository
git clone https://github.com/matheus-rech/pit_project.git
cd pit_project

# Install dependencies
pip install -r requirements.txt

# Test dataset access
python -c "from datasets import load_dataset; \
           ds = load_dataset('mmrech/pitvqa-unified-vlm', split='train', streaming=True); \
           print('✅ Dataset loaded!', next(iter(ds)).keys())"

# Run training (Colab recommended)
# See: scripts/train_unified_vlm.py

Complete Training Example

Training notebook available in repository:

  • Script: scripts/train_unified_vlm.py
  • Colab: Upload to Google Colab with T4 GPU
  • Duration: 4-6 hours

Limitations

Dataset Limitations

  • Single Institution: National Hospital of Neurology and Neurosurgery, London
  • Limited Videos: 25 surgical procedures
  • Temporal Resolution: 2 FPS (may miss rapid transitions)
  • Specialty-Specific: Optimized for pituitary surgery only
  • Class Imbalance: Some phases/steps more frequent than others

Annotation Limitations

  • Subjective Boundaries: Phase transitions can be ambiguous
  • Expert Variability: Different surgeons may define steps differently
  • Language-Specific: English annotations only

Usage Limitations

  • Not for Clinical Use: Research prototype only
  • No Real-Time Validation: Not tested in live surgical settings
  • Generalization: May not transfer to other surgical specialties

Ethical Considerations

Data Privacy

  • ✅ All patient data de-identified
  • ✅ Institutional ethics approval obtained
  • ✅ Surgical videos anonymized

Bias and Fairness

Potential Biases:

  • Single institution (UK-based)
  • Limited surgeon diversity
  • Specific surgical techniques
  • English-language annotations

Mitigation Efforts:

  • 100% validated annotations
  • Clear documentation of limitations
  • Public dataset for community review

Clinical Use Warning

⚠️ IMPORTANT: This dataset is for research purposes only. Models trained on this data are NOT approved for clinical decision-making or real-time surgical guidance.

License

CC-BY-NC-ND-4.0 (Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International)

Permissions

  • ✅ Download and use for research
  • ✅ Share with attribution
  • ✅ Train models for academic research

Restrictions

  • ❌ Commercial use
  • ❌ Derivative datasets without permission
  • ❌ Clinical applications without validation

Citation

If you use this dataset in your research, please cite:

  1. This dataset:
@misc{rech2026pitvqa_unified_dataset,
  author = {Rech, Matheus},
  title = {PitVQA Unified VLM Classification Dataset},
  year = {2026},
  publisher = {HuggingFace},
  journal = {HuggingFace Datasets},
  howpublished = {\url{https://huggingface.co/datasets/mmrech/pitvqa-unified-vlm}}
}
  1. Original PitVQA dataset:
@article{hoque2024pitvqa,
  title={PitVQA: Image-grounded Text Embedding LLM for Visual Question Answering in Pituitary Surgery},
  author={Hoque, Mobarak and Clarkson, Matt and Bano, Sophia and Stoyanov, Danail and Marcus, Hani},
  journal={arXiv preprint arXiv:2405.13949},
  year={2024},
  doi={10.5522/04/27004666}
}

Dataset Card Authors

Matheus Rech

Contact

Changelog

Version 1.0.0 (2026-01)

  • Initial release with 5,184 validated samples
  • Multi-task classification (phase, step, instrument)
  • LoRA training configuration documentation
  • 91.3% overall classification accuracy

Disclaimer: This dataset is a research tool and is not intended for clinical use.

Downloads last month
30

Paper for mmrech/pitvqa-unified-vlm