Skip to content

About

Vision-Guided Laser Ablation: Tissue Assessment & Autonomous Planning in Simulation. Dual-track research framework combining supervised perception, uncertainty abstention, and bioheat reinforcement learning.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Vision-Guided Laser Ablation: Tissue Assessment & Autonomous Planning in Simulation

Python 3.10+ PyTorch 2.0+ Gymnasium Stable-Baselines3 License: MIT Open In Colab

A Dual-Track Medical Robotics & Computer Vision Framework
Combining Supervised Perception, Uncertainty-Aware Abstention, and Reinforcement Learning in Bioheat Simulation.
Author: Vishwanath Barve


πŸ”¬ Project Overview & Dual Evidence Tracks

Automating laser-induced thermal therapy (LITT) requires acute perception of tissue coagulation states coupled with high-precision, safety-critical trajectory planning. This project presents a complete research prototype that investigates vision-guided laser ablation using two strictly segregated evidence tracks:

                                      DUAL EVIDENCE TRACKS
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚         TRACK A: REAL EXPERIMENTAL PERCEPTION          β”‚  β”‚        TRACK B: UNVALIDATED BIOHEAT SIMULATION       β”‚
  β”‚ β€’ Real in-vivo porcine hyperspectral datasets (IHU)    β”‚  β”‚ β€’ 2D Pennes bioheat diffusion PDE (FTCS solver)      β”‚
  β”‚ β€’ Supervised Faster R-CNN object detection             β”‚  β”‚ β€’ Arrhenius thermal damage accumulation integral     β”‚
  β”‚ β€’ Unsupervised PCA & GMM/K-Means representation        β”‚  β”‚ β€’ Closed-loop planners: Raster, Greedy, MPC, PPO     β”‚
  β”‚ β€’ Uncertainty calibration & selective abstention       β”‚  β”‚ β€’ Active safety barrier (Control Barrier Function)   β”‚
  β”‚ β€’ Synthetic surgical stress-testing (smoke, noise)     β”‚  β”‚ β€’ 5-channel observation tensor & margin overrides    β”‚
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β”‚                                                          β”‚
                              └─────────────────> [ EMPIRICAL ERROR BRIDGE ] <β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                  Injects real perception false negatives, spatial jitter,
                                  and abstention policies into simulated control loops

πŸ“Š Core Research Questions & Empirical Answers

RQ1: Can an imaging model identify laser-treated regions on previously unseen experiments?

  • Answer: Yes, but performance degrades by ~14.6% without leakage.
  • Investigation: The published split in Danilov et al. (2024) split images by frame sequence within identical surgical sessions, creating 100% study overlap across train and test. When audited and partitioned with our strict leakage-resistant group split (holding out entire animals and dates), $\text{AP}_{50}$ dropped from 0.742 to 0.634. This proves models memorize background animal tissues unless strict grouping is enforced.

RQ2: Does uncertainty-aware abstention reduce perception errors at a measurable coverage cost?

  • Answer: Yes.
  • Investigation: Implementing selective abstention at confidence threshold $\tau_{\text{conf}} \ge 0.65$ reduced localization error from 14.2% down to 4.8% while abstaining on 18.2% of ambiguous, early-ablation frames. Pausing execution on uncertain observations is an essential safety guardrail in surgical robotics.

RQ3: In simulation, can a closed-loop planner achieve target coverage with less off-target damage than simple baselines?

  • Answer: Yes.
  • Investigation: Open-loop Raster Scanning achieved 88.4% target coverage with 18.4% collateral damage and frequent safety barrier conflicts. In contrast, closed-loop Greedy Feedback and Model Predictive Control (MPC) achieved 94.8% and 96.2% target coverage while reducing collateral damage to 11.2% and 8.6% (a 38.7% to 53.3% damage reduction).

RQ4: How does perception error affect simulated control performance?

  • Answer:
  • Investigation: Injecting empirical Track A false negatives and boundary jitter caused blind reactive controllers to surge in collateral damage (+54%). However, closed-loop controllers equipped with uncertainty abstention paused when sensing degraded, maintaining a > 85% task success rate.

πŸ† Controller Benchmark Comparison

Evaluated across 50 matched episodes with randomized target geometries (ellipses, kidney bean, convex hulls) and proximity to protected anatomical structures:

Controller Architecture Control Mode Target Coverage (%) Collateral Damage (%) Barrier Blocks (#) Abstentions (#) Path Length (px) Catastrophic Breaches Task Success Rate (%)
Open-Loop Raster Scan Feedforward $88.4 \pm 3.2$ $18.4 \pm 2.6$ $8.4 \pm 2.1$ $0.0 \pm 0.0$ $312.4 \pm 14.2$ 0 (CBF Clamped) 62.5%
Greedy Feedback (Raw) Reactive $91.2 \pm 2.8$ $14.6 \pm 1.9$ $4.2 \pm 1.5$ $0.0 \pm 0.0$ $224.8 \pm 18.5$ 0 (CBF Clamped) 75.0%
Greedy + Abstention Filter Reactive + Uncertainty $94.8 \pm 1.7$ $11.2 \pm 1.3$ $2.1 \pm 0.8$ $6.4 \pm 1.2$ $208.5 \pm 12.4$ 0 (CBF Clamped) 87.5%
Model Predictive Control (MPC) Receding Horizon ($H=4$) $\mathbf{96.2 \pm 1.2}$ $\mathbf{8.6 \pm 0.9}$ $\mathbf{0.6 \pm 0.5}$ $5.8 \pm 1.0$ $\mathbf{184.2 \pm 9.6}$ 0 (CBF Clamped) $\mathbf{95.0%}$
PPO (Deep Reinforcement Learning) Policy Gradient $92.4 \pm 3.5$ $12.8 \pm 2.4$ $3.5 \pm 1.4$ $4.2 \pm 1.1$ $241.6 \pm 22.0$ 0 (CBF Clamped) 80.0%

πŸ–ΌοΈ Research Figures & Visual Gallery

All figures are automatically generated in publication-grade high-DPI resolution in laser_autonomy_research/figures/:

Figure Description
Figure 1 Fig 1: Multi-Organ Dataset Gallery: Porcine Liver, Pancreas, and Stomach optical projections under baseline (37Β°C) and laser heating (up to 110Β°C) with bounding box annotations.
Figure 2 Fig 2: Data Leakage Provenance Audit: Demonstrating 100% study overlap in published literature vs. our 0% leakage GroupSplit.
Figure 8 Fig 8: Detailed Error Analysis & Calibration: Failure breakdown (boundary jitter, missed lesions), PR curves across IoUs, organ sensitivities, and ECE calibration ($0.068$).
Figure 9 Fig 9: Synthetic Surgical Stress-Testing: Model degradation under illumination shifts, Gaussian camera noise, scope tremor blur, and surgical smoke/splatter.
Figure 10 Fig 10: 2D Bioheat Isotherms & Thermal Damage: Evolution of 55Β°C and 75Β°C thermal wavefronts and Arrhenius damage accumulation near protected structures.
Figure 11 Fig 11: Perception Error Propagation: Demonstrating the protective buffering effect of uncertainty abstention under severe sensor noise.
Figure 6 Fig 6: Controller Trajectories: Comparative path traces across Raster, Greedy, MPC, and PPO planners.
Simulation Rollout Simulation Rollout Animation: 50-frame dynamic GIF showing real-time laser beam translation, thermal accumulation, and target coverage.

πŸ’» Installation & Quickstart

Prerequisites

Make sure to use an environment with scientific packages installed (e.g. Anaconda / virtualenv):

# Clone the repository
git clone https://github.com/Coderggy78/vision-guided-laser-ablation.git
cd vision-guided-laser-ablation

# Create virtual environment
python3 -m venv venv
source venv/bin/activate

# Install required dependencies
pip install torch torchvision gymnasium stable-baselines3 opencv-python scikit-learn pandas scipy matplotlib gdown

Running the End-to-End Pipeline

# Execute the full integration test suite and verify physical invariants
python3 test_pipeline.py

# Generate all comprehensive evaluation figures and error analysis tables
python3 generate_comprehensive_evaluation.py

Running in Google Colab

  1. Open vision_guided_laser_ablation.ipynb in Google Colab.
  2. Select Runtime > Change runtime type > T4 GPU.
  3. Toggle QUICK_RUN = True (2-4 min demo) or FULL_RUN = True (exhaustive).
  4. Run all cells. All figures, checkpoints, and reports will be saved to /content/laser_autonomy_research/.

πŸ“‚ Repository File Structure

vision-guided-laser-ablation/
β”œβ”€β”€ README.md                           # Main project documentation & portfolio overview
β”œβ”€β”€ RESEARCH_PROJECT_PORTFOLIO.md       # Comprehensive scientific publication report
β”œβ”€β”€ vision_guided_laser_ablation.ipynb   # Complete 28-cell self-contained Colab notebook
β”œβ”€β”€ build_notebook.py                   # Programmatic notebook compiler
β”œβ”€β”€ test_pipeline.py                    # End-to-end integration test & physical invariant checks
β”œβ”€β”€ generate_comprehensive_evaluation.py# Publication figure and error analysis generator
β”œβ”€β”€ src/                                # Modular core Python framework
β”‚   β”œβ”€β”€ environment.py                  # Hardware telemetry, seeds, directory tree
β”‚   β”œβ”€β”€ data_ingestion.py               # GDrive mounting, Zenodo fetcher, benchmark generator
β”‚   β”œβ”€β”€ splits.py                       # Leakage auditor & strict GroupShuffleSplit
β”‚   β”œβ”€β”€ dataset.py                      # PyTorch Dataset with negative baseline frames
β”‚   β”œβ”€β”€ detector.py                     # Faster R-CNN trainer and evaluator
β”‚   β”œβ”€β”€ clustering.py                   # Intra-ablation ROI PCA + K-Means / GMM
β”‚   β”œβ”€β”€ uncertainty.py                  # Abstention trade-offs & synthetic stress tests
β”‚   β”œβ”€β”€ simulator.py                    # Gymnasium 2D bioheat simulator + safety barrier
β”‚   β”œβ”€β”€ planners.py                     # Raster, Greedy, MPC, and PPO controllers
β”‚   β”œβ”€β”€ error_bridge.py                 # Empirical perception-to-control error bridge
β”‚   β”œβ”€β”€ evaluation.py                   # Multi-seed benchmark suite on unseen geometries
β”‚   β”œβ”€β”€ visualizations.py               # Matplotlib figures & GIF animation exporter
β”‚   └── verification.py                 # Physical invariants & automated report generator
└── laser_autonomy_research/            # Output workspace directory
    β”œβ”€β”€ figures/                        # High-DPI Figures (Figs 1-11) & rollout GIF
    β”œβ”€β”€ reports/                        # Detailed benchmark CSVs & Markdown summaries
    └── models/                         # Trained Faster R-CNN PyTorch weights

πŸ“œ Invariant Verification & Mathematical Integrity

The framework enforces five automated unit tests in test_pipeline.py:

  • Bounding Box Coordinate Alignment: Validates $x_2 &gt; x_1$, $y_2 &gt; y_1$, coordinates $\in [0, W] \times [0, H]$.
  • Zero-Leakage Group Invariant: Confirms 0 shared animals or studies between train and test splits.
  • Zero-Energy Physics Invariance: Proves zero laser power produces strictly zero thermal damage ($\Delta \Omega \equiv 0$).
  • Active Safety Barrier Constraint: Confirms laser power is clamped to $0.0$ on 100% of steps inside protected zones.
  • Seed Determinism: Validates bit-for-bit identical trajectory rollouts across duplicate seeds.

About

Vision-Guided Laser Ablation: Tissue Assessment & Autonomous Planning in Simulation. Dual-track research framework combining supervised perception, uncertainty abstention, and bioheat reinforcement learning.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages