phamdt2003's picture
Sync deliverable: spec-aligned subtypes + Task 1 + Task 2 source videos
0fe76cd verified
---
license: other
license_name: autolaparo-non-commercial
license_link: https://arxiv.org/abs/2208.02049
language:
- en
task_categories:
- visual-question-answering
- question-answering
tags:
- surgical-video
- laparoscopy
- hysterectomy
- workflow-recognition
- instrument-segmentation
- medical-imaging
- chain-of-thought
pretty_name: AutoLaparo QnA Sample (spec-aligned subtypes)
size_categories:
- n<1K
---
# AutoLaparo QnA Sample (spec-aligned subtypes)
**A small, spec-aligned QnA dataset for surgical-video VQA.**
Each record follows the same schema as the production file `output/qna_dataset.json`,
and each `question_subtype` is one of the subtypes defined in the project's `spec/*.md`.
Built from AutoLaparo Task 1 (workflow phase recognition, video 14) and Task 3
(instrument and anatomy segmentation).
**11 records / 11 subtypes** — exactly one record per supported subtype to keep the
sample lightweight. Subtypes that AutoLaparo cannot ground are listed at the bottom
with the data they would need.
---
## Subtypes in this sample
### `spatial` (3 records — from Task 3 segmentation masks)
| `question_subtype` | what it asks | record id |
|---|---|---|
| `left_right_relation` | Is object A to the left or right of object B? | `autolaparo_task3__001001__left_right_relation` |
| `tool_organ_contact` | Is the tool touching or near the organ? | `autolaparo_task3__001001__tool_organ_contact` |
| `relative_size` | Which of two objects is larger (by bbox area)? | `autolaparo_task3__001001__relative_size` |
### `temporal` (3 records — from Task 1 phase labels of video 14)
| `question_subtype` | what it asks | record id |
|---|---|---|
| `order_reasoning` | Which of two events happens first? | `autolaparo_task1__14__order_reasoning` |
| `phase_transition` | When does one phase end and the next begin? | `autolaparo_task1__14__phase_transition` |
| `before_after_event` | Does event A happen before or after event B? | `autolaparo_task1__14__before_after_event` |
### `temporal_spatial` (3 records — from Task 3 multi-frame clip)
Anchored by the 6 sampled frames (t=0..5s at 1 fps) of one Task 3 clip — these
records compare bbox / class presence between two timestamps in the same clip.
| `question_subtype` | what it asks | record id |
|---|---|---|
| `tool_movement_direction` | In which direction does a tool move between two frames? | `autolaparo_task3__clip006__tool_movement_direction` |
| `object_entering_exiting` | Does an object enter or exit the field of view between two frames? | `autolaparo_task3__clip006__object_entering_exiting` |
| `instrument_switching` | Does the primary instrument change between two frames? | `autolaparo_task3__clip006__instrument_switching` |
### `free_form` (2 records — mixed source)
| `question_subtype` | what it asks | record id |
|---|---|---|
| `phase_understanding` | What characterises this surgical phase? | `autolaparo_task1__14__phase_understanding` |
| `tool_purpose` | What is this instrument used for? | `autolaparo_task3__001001__tool_purpose` |
---
## Record schema (same as `output/qna_dataset.json`)
| field | type | notes |
|---|---|---|
| `id` | string | composite slug, unique per record |
| `video_id` | string | source clip id (`14` for Task 1, `001`..`300` for Task 3) |
| `frame_id` | int | frame index within the source |
| `timestamp_s` | float | seconds into the source video / clip |
| `phase` | string \| null | surgical phase (Task 1) or `null` (Task 3, no phase labels) |
| `qna_type` | string | `spatial` \| `temporal` \| `temporal_spatial` \| `free_form` |
| `question_subtype` | string | one of the 11 subtypes above |
| `question` | string | the natural-language question |
| `answer` | string | chain-of-thought reasoning + conclusion |
| `validation_status` | string | `valid` |
| `image_context` / `video_context` | object | `path` → JPG snapshot in this folder (temporal_spatial adds `path_t2` for the second anchor frame) |
Grounding tags used inside `answer` (matches `spec/`):
- `<obj>name</obj>` — refer to an object by name
- `<box>[x1,y1,x2,y2]</box>` — refer to a bounding box (spatial only)
- `<t>SECONDS</t>` — refer to a timestamp (temporal only)
- Free-form answers use **no** grounding tags (plain prose only).
### Example record
```json
{
"id": "autolaparo_task1__14__phase_transition",
"source_stack": "AutoLaparo",
"task": "task1_workflow_recognition",
"video_id": "14",
"frame_id": 179,
"timestamp_s": 178.0,
"phase": "Dividing Ligament and Peritoneum",
"qna_type": "temporal",
"question_subtype": "phase_transition",
"question": "What are the phases involved in this transition and when does it occur?",
"answer": "Step 1: Identify the phases involved.\n - The phase before the transition is Preparation.\n - The phase after the transition is Dividing Ligament and Peritoneum.\n\nStep 2: Locate the transition boundary.\n - The Preparation phase ends at <t>177.0</t>s.\n - The Dividing Ligament and Peritoneum phase begins at <t>178.0</t>s.\n\nConclusion: The transition from Preparation to Dividing Ligament and Peritoneum occurs between <t>177.0</t>s and <t>178.0</t>s.",
"validation_status": "valid",
"video_context": {
"path": "video_context/task1/14.mp4",
"frame_index_1fps": 179,
"timestamp_s": 178.0
}
}
```
---
## Subtypes NOT in this sample (and why)
AutoLaparo annotates phases (Task 1) and per-frame masks (Task 3), but no per-frame
tools / actions / object bboxes across time. The following spec subtypes therefore
cannot be grounded from AutoLaparo alone — they exist in the full
`output/qna_dataset.json` (built from CholecT50).
| `qna_type` | `question_subtype` | missing data |
|---|---|---|
| `temporal` | `tool_appearance_duration` | AutoLaparo Task 1 has no per-frame tool annotations |
| `temporal` | `co_occurrence_timing` | no tool intervals -> cannot compute co-occurrence windows |
| `temporal_spatial` | `tool_target_interaction_evolution` | needs action triplets (instrument, verb, target) per frame — not annotated by AutoLaparo |
| `temporal_spatial` | `action_sequence_reasoning` | needs action triplets per frame — not annotated by AutoLaparo |
| `free_form` | `clinical_reasoning` | needs richer per-frame metadata (tools+actions) to ground reasoning |
| `free_form` | `surgical_knowledge` | needs richer per-frame metadata (tools+actions) to ground reasoning |
---
## File map
```
autolaparo_hf_sample/
├── qna.json # 8 records, JSON array (human-readable)
├── qna.jsonl # 8 records, line-delimited (streaming-friendly)
├── manifest.json # source metadata + subtype coverage trace
├── README.md # this file
└── video_context/
├── task1/
│ └── 14.mp4 # full Task 1 source video — referenced by every temporal/free_form record's `video_context.path`
└── task3/
├── *.jpg # the exact annotated frames (image_context.path / path_t2)
└── *.mp4 # the Task 2 source clips each frame was sampled from (image_context.source_clip)
```
Each `image_context.path` and `video_context.path` inside a record is a relative
path into this folder, so you can load the JPG directly from the record.
## Reproduce
```bash
python scripts/build_autolaparo_task1_task3_sample.py --extract-videos
```
Needs `data/task1/labels.zip`, `data/task3/imgs.zip`, `data/task3/masks.zip`, and
`videos.zip` at the repo root. Tests: `python -m unittest discover tests -v`.
## Source & licence
Derived from **AutoLaparo** (Wang et al., 2022, arXiv:2208.02049).
Non-commercial use only. If you use this sample, cite the AutoLaparo paper.