hkust-aaron's picture
Physician review recorded; updated labels metadata and showcase videos
b91b0f5 verified
|
Raw History Blame Contribute Delete
18.5 kB

Laparoscopic video sample 001 — evaluation pack

One laparoscopic recording prepared as a worked example of how the wider collection can be delivered. It is a pipeline demonstration, not a benchmark: one case, labels drafted with AI models and reviewed and approved by the contributing physician on 17 November 2026 (see Clinical review below and CLINICAL_REVIEW.json).

Clinical review

All annotation layers in this pack — quality and scene timelines, clip captions, keyframe and dense instance masks, tool kinematics, action segments, task graphs and decision points, target-tissue masks and the robot-learning exports — were reviewed and approved by the contributing physician on 17 November 2026, with no corrections requested. The record is in CLINICAL_REVIEW.json. The pipeline's own item-level flags (needs_review, reliability, status) are kept in the data as produced, so users can apply them as filters.

What is in the pack

Folder Content How it was made Coverage
video/ Intracorporeal-only video, 694.80 s Stream copy of source frames 0–17369, no re-encoding; container metadata stripped Whole case
layer1_quality/ Per-frame metrics and a per-second usability timeline Computed on all 17,929 source frames Whole case
layer2_timeline/ 12 scene segments, 6 point events, 6 overview sheets Visual review at one frame per 4 s Whole case
layer3_clip_captions/ 70 clips (10 s each) with a caption, instrument list, scene flags, motion level and quality columns, as JSONL and CSV Captions written from one frame per 2 s; other columns computed Whole case
gold_subset/ 81 frames with instance masks, tips and appearance classes: one mid-clip frame for 69 of the 70 clips plus 12 hand-picked frames Polygons placed by an AI model on a coordinate grid, snapped to edges with GrabCut, then inspected on overlays 81 frames, 200 instances
dense_tracks/ SAM 3.1 instance masks on every frame, tracked within each 10 s clip, with per-track JSON and preview sheets Text prompt plus keyframe clicks, propagated with SAM 3.1 (see below) 17,370 frames, 222 tracks
layer4_tool_kinematics/ Per-frame tool tip, shaft entry, shaft angle, tip speed, camera motion, tool motion with camera motion removed, relative depth at tip and shaft Computed from the dense masks; optical flow; Depth Anything V2 Small 17,370 frames, 168 tracks
layer5_actions/ Action segments (instrument, verb, target, jaw state, energy, instruction), task graphs and decision points, per-frame state, timelines; target-tissue masks in 68 clips; showcase videos on three clips AI-written from contact sheets (0.2 s or 0.4 s); tissue tracked with SAM 3.1 Whole case: 70 clips, 771 segments
layer6_robot_learning/ Per-frame scene graphs, 0.2 s action tokens, and training exports: vision-language-action steps, grounded VQA, reasoning, next-action Derived from layers 4–5 Whole case
ROBOT_LEARNING_DATA_SPEC.md What data a model that operates a surgical robot needs, and where this pack sits — —
scripts/ The twenty scripts that produced the above — —

Video facts

Field Value Source
Modality Rigid laparoscope, hand-held instruments (no robot) Visual
Resolution / rate 720 × 576, 25 fps, progressive ffprobe
Codec H.264 Baseline, about 5.9 Mbit/s, no audio ffprobe
Duration 694.80 s in this pack (717.16 s in the source) Decode count
Recording date 2023-04-20 (container tag of the source file) ffprobe
Procedure, anatomy, diagnosis Not provided —
Institution, country, camera system Not provided —
Kinematics, force, audio, depth None —

Quality summary (intracorporeal seconds)

  • 694 seconds in the body; 683 flagged usable (not blurred).
  • 11 seconds flagged blur, 8 glare, 21 low-red (haze or a grey near-lens object).
  • Thresholds are in scripts/03_quality_timeline.py; they are simple heuristics, not a validated quality model.

Label definitions

  • Scene state: intracorporeal, camera_withdrawal, extracorporeal. Boundary set by frame-by-frame review.
  • Scene segments: describe only what is visible. They are not surgical phases. Boundaries are ±4 s.
  • Clip captions: 13–40 words each (mean 23.5), written for video–text training. They describe what is visible at 2 s sampling and can miss shorter events. Flags: gauze_visible (46 clips), near_lens_instrument (18), pooled_blood (13), haze (6), mostly_instrument_free (3).
  • Motion level: low / medium / high, a tercile ranking within this video. Only 25–60 % of tracked points fit a single image transform on this footage, so no pan or zoom direction is given.
  • Instance classes are appearance classes, not device identification: white_insulated_jawed, dark_rod, fenestrated_grasper, gauze.
  • Tip: visible distal working end in source pixels, origin top-left; null when not localisable.
  • Confidence: high / medium / low, the annotator's own judgement.

Known limitations

  1. Labels were drafted by AI models and approved in an overall review by one physician; no inter-annotator agreement has been measured.
  2. Masks come from colour-based edge snapping. Edges are loose where an instrument meets dark tissue, glare or gauze; gauze masks are plain polygons.
  3. One case only. No cross-case, cross-site or cross-device claim can be made.
  4. Standard definition. No procedure metadata.
  5. Video only: suitable for perception and video pre-training, not for learning control policies.

Rights and privacy

  • The contributor states that they hold permission for public distribution and commercial AI training. The underlying written authorisation has not been independently verified and is not included here.
  • Out-of-body footage was removed. The intracorporeal frames were not individually screened for incidental identifiers.
  • The source file is published under Apache-2.0 at huggingface.co/datasets/hkust-aaron/laparoscopic-robotic-vision-sample; that public copy still contains the out-of-body footage.

Integrity

SHA256SUMS.txt lists every file. The pack video decodes to 17,370 frames whose per-frame hashes match source frames 0–17369.

Instance masks v2 (SAM 3.1)

gold_subset/instances_coco_v2.json, masks_v2/ and overlays_v2/ supersede the v1 files for training use; v1 is kept for comparison.

  • Model: Meta SAM 3.1 (sam3.1_multiplex.pt, SHA-256 0567debe…541cb6, identical to the file in facebook/sam3.1), official facebookresearch/sam3 code, run on one NVIDIA GPU. SAM 3.1 is released under Meta's SAM License.
  • Prompting: three positive clicks per instance, taken from the deepest points of the AI-drafted mask. No text prompt and no propagation between frames.
  • Acceptance rule: the SAM 3.1 mask is used when it overlaps the draft mask with IoU ≥ 0.5; otherwise the draft is kept and the instance carries needs_review: true.
  • Result: 200 instances on 81 frames. 175 use the SAM 3.1 mask; 25 are flagged for review (14 gauze, 7 white-insulated instrument, 4 dark rod) across 23 frames. Median IoU between the two methods is 0.75.
  • Known failure modes: SAM 3.1 sometimes returns only one part of an instrument, and lets blood-soaked gauze spread into dark tissue or stop short. These are the flagged cases.
  • Class labels, tips and confidence come from the AI draft; v2 is covered by the physician review of 17 November 2026.

Dense tracks (SAM 3.1, every frame)

dense_tracks/ extends the keyframe masks to all 17,370 frames.

  • Method (scripts/08_sam31_propagate.py): each 10 s clip (250 frames; the last has 120) is one SAM 3.1 video session. The text prompt "metal tool" on the clip's first frame is propagated through the clip; then the clip's keyframe instances from instances_coco_v2.json are added as three-click prompts and propagated forwards and backwards. A text track that covers a clicked instrument on the keyframe (≥ 50 % of its pixels) is treated as the same object and dropped (113 such tracks). Masks under 150 px are dropped.
  • Files: masks/clip_XX/<frame>.png — one 8-bit PNG per frame, pixel value = track id, 0 = background; frame numbers are indices into the pack video. tracks/clip_XX.json — per track: source (click / text), class, and per-frame area, bbox and model score; click tracks also carry the keyframe clicks and review flag. previews/ — overlay sheets (whole video, and first / middle / last frame of every clip), made by scripts/09_dense_preview.py.
  • Track ids are local to a clip: 101… = keyframe instance (100 + instance_index_in_mask_png), 1… = found by the text prompt. Ids are not linked across clips.
  • Result: all 70 clips completed. 222 tracks (167 from clicks: 55 dark_rod, 54 white_insulated_jawed, 54 gauze, 4 fenestrated_grasper; 55 text-prompt tracks labelled instrument_text_detected), 43,281 frame-level masks. 16,777 of 17,370 frames (96.6 %) contain at least one mask. 13 tracks last under 1 s. Compute: about 81 GPU-minutes.
  • Known gaps: recall is incomplete. An object that is neither on the clip's keyframe nor found by the text prompt on the first frame is not tracked — for example a large metal rod at frame 5286 and a grasper entering at frame 5000. Text-prompt tracks have no appearance class. Gauze masks inherit the keyframe weaknesses above. Some frames carry a mask on the wrong object (for example around frame 1425 a grasper track sits on tissue after the grasper has left). Covered by the physician review of 17 November 2026.

Tool kinematics (2D)

layer4_tool_kinematics/ turns the instrument masks into motion signals — the closest a video-only recording gets to an action stream. Made by scripts/10_tool_tips.py.

  • Per frame and instrument (tool_tips.csv): tip (raw and 5-frame median), shaft entry point (where the mask meets the image border), shaft angle, tip speed in px/s, mask area, flag. Gauze is excluded.
  • Method: largest connected part of the mask; entry = mask pixels nearest the image border; tip = mean of the 0.5 % of mask pixels farthest from the entry. For a jawed instrument this is the far end of the jaws.
  • Coverage: 31,313 instrument-frames in 168 tracks; a tip is computed for 30,162 (96 %). 1,151 have no tip because the mask stays more than 25 px from the border; 273 are flagged tip_on_border.
  • Check against the hand-placed keyframe tips (validation.json): 84 instruments, median distance 20 px, 71 % within 40 px. Of the 24 cases over 40 px, a visual pass found about 19 where the computed point is at the jaw end and the hand-placed tip at the jaw hinge (the keyframe tips were placed inconsistently), 2 where the reference sits on another instrument and 3 real errors (mask leak, broken jaw mask).
  • Camera motion (camera_motion.csv, scripts/15_camera_motion.py): for every frame pair, a similarity transform (shift, rotation, zoom) fitted with RANSAC to optical flow on the background, instruments masked out. Median inlier ratio 0.71; 13,595 of 17,369 pairs have at least half the background explained by one rigid motion — tissue moves and deforms, so lower values are expected. tool_motion_compensated.csv gives each tip's displacement with the camera part removed (29,713 rows); median tip speed falls from 150 px/s in the image to 121 px/s relative to the scene.
  • Relative depth (tool_depth.csv, scripts/16_depth.py): Depth Anything V2 Small (Apache-2.0) on every frame, normalised by each frame's background median, sampled at each tip (7×7 median) and over each shaft. Values are relative inverse depth: > 1 closer to the lens than typical tissue. Consistency check: shafts median 1.60, tips 0.87 (tips rest on tissue), and clips flagged for a near-lens instrument have a higher upper tail (p90 2.91 vs 2.43). Not metric; monocular depth is unreliable on glare and smoke.
  • What it is not: no stereo or metric 3D, no jaw-opening angle, no robot kinematics.

Actions (whole video)

layer5_actions/ labels every 10 s clip of the case at action level — the layer a model needs to learn manipulation from video.

  • Labels (labels/clip_XX.json, one file per clip, compiled by scripts/12_actions.py into actions.json): a visible goal per clip and 771 segments (710 with the instrument in view). Each segment has the instrument track id (from dense_tracks/), a verb from a fixed list of 20, the target, jaw state (open, closed, open->closed, …), whether energy use is visible, and a one-line instruction in the voice of a supervising surgeon (e.g. "Keep pulling to the left so the material comes off the surface."). 68 camera segments mark inspection pauses (inspect) and view changes (move_view). Most frequent verbs: hold 222, approach 87, counter_traction 43, grasp 37, probe 32, position 32, retract 28; energy use is visible in 8 segments across 7 clips. The script validates every file (vocabulary, frame ranges, track ids, no overlap on one instrument) before writing.
  • Sampling: clips 5, 40 and 43 were labelled from frames every 0.2 s (boundaries ±5 frames); the other 67 clips from frames every 0.4 s (±10 frames).
  • per_frame_state.csv: 36,740 rows (every frame × every labelled instrument): active verb, target, jaw state, energy flag, and the tip, angle and speed from layer 4.
  • task_graph.json (scripts/17_task_graph.py): per clip, goal → subtasks with preconditions and effects as symbolic predicates (held(X, I), under_tension(X), separated(X, Y, partial), energy_applied(X), contact(I, X) …, defined in the file) and a success check. 178 subtasks: 17 written by hand for clips 5, 40 and 43; 161 derived for the other clips from the main instrument's segments with fixed verb rules (verb_rules in the file). 58 decision points in 47 clips, written as observation → assessment → decision → expected result → outcome actually seen (e.g. clip 43 ends with residual material still attached: removal was partial). Observations and outcomes describe what is visible; assessments are a plausible rationale, not the operator's recorded intent.
  • target_tissue/: SAM 3.1 masks of the tissue being acted on, in 68 clips. Clips 5, 40 and 43: clicks placed by eye on one keyframe per clip (scripts/targets_tissue.json) — oozing surface, yellow lobule and purplish tissue, smooth pink surface and pale adherent material. The other clips: click prompts generated automatically by scripts/20_tissue_clicks.py (scripts/targets_tissue_auto.json: points just ahead of the acting instrument's tip at the middle of an action on that tissue, clear of all instrument masks; each object prompted on its own frame) for 113 targets in 65 clips; 16 targets with no usable frame are listed as skipped. In all, 118 tissue objects and 24,310 frame masks. quality.json flags a frame when the mask is more than twice the object's median area, covers more than 40 % of the image, or lies at least half on instrument masks (the track drifted onto an instrument), and rejects an object flagged in more than half its frames: 79 objects are accepted with 14,150 unflagged frame masks; 39 automatic objects are rejected (most drifted onto the shaft or spread over the field). Downstream layers use accepted, unflagged masks only.
  • timeline_clip_XX.png: one action timeline per clip. demo_clip_XX.mp4 and showcase/ (clips 5, 40, 43): every layer drawn on the video; showcase/showreel.mp4 is the place to start. Made by scripts/13_action_demo.py and scripts/14_showcase.py.

Robot-learning layer (whole video)

layer6_robot_learning/ packages layers 4–5 the way vision-language-action and vision-language models are trained. All records point to frames/clip_XX/<frame>.jpg (every 0.2 s, 3,474 images).

File Records Content
scene_graphs.jsonl 17,370 (every frame) nodes: instruments (class, tip, angle, relative depth, jaw, energy, verb), target tissues (name, mask area and reliability where tracked, state: under_traction / pressed / energy_applied), gauze; edges: acts_on (18,403), tip_contacts (4,129), near (2,428), occludes (1,716); camera motion
action_tokens.csv / .jsonl 7,348 per instrument and 0.2 s step: tip displacement with camera motion removed, depth change, rotation, jaw command, energy, discretised into a token such as <dx+2><dy-1><dz0><rot0><jaw:close><e0>; motion present in 5,935, depth change in 5,831
vla_steps.jsonl 3,474 image, task, active subtask, per-instrument state, action taken, the next 2 s of action tokens (action chunk), instruction in force
vqa.jsonl 38,166 grounded question–answer pairs: action 6,248, energy 6,248, tip point 5,859, target 4,998, next action 4,378, count 3,474, jaw state 3,032, tissue interaction 2,829, presence 1,100
reasoning.jsonl 128 70 plans (goal → ordered subtasks with pre/effects) and 58 decision points with context frames
next_action.jsonl 623 at each action boundary: last verbs → next verb, target, jaw state, instruction
depth_maps/ 150 relative inverse depth for clips 5, 40, 43, 16-bit PNG (360×288, value × 10,000)

tip_contacts, occludes and tissue_interaction come from the accepted tissue masks.

Check that labels and motion agree (speed_by_verb.json, whole video): median tip speed with camera motion removed is 54–95 px/s for steps labelled position, coagulate, hold, retract and grasp, and 127–400 px/s for approach, press, transport, probe, counter_traction, peel and regrasp. The action labels were written by eye and the speeds computed independently from the masks.

Limits: labels written by an AI model from sampled frames; jaw state and energy judged by eye. Targets are named by appearance because the procedure and anatomy are unknown. Hand-held laparoscopy, not a robot: action tokens are image-plane displacements of a hand-held instrument, not robot commands; mapping them to a robot needs the calibrated kinematic data described in ROBOT_LEARNING_DATA_SPEC.md. Suitable for pre-training and for evaluating action recognition and video–language models. Covered by the physician review of 17 November 2026.