Skip to content

sandiphembram2021/surgical-nav-ai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿฅ AI-Assisted Surgical Navigation System

A lightweight, standalone desktop application for real-time surgical instrument and anatomical structure detection using computer vision and AI. Designed to run efficiently on systems with Intel i3 and 8GB RAM.

Version Platform Python License

๐ŸŽฏ Features

  • Real-time Video Processing: Live camera feed from laparoscopic/endoscopic cameras
  • AI Object Detection: Lightweight detection of surgical instruments and anatomical structures
  • 3D Mapping: Basic SLAM implementation for surgical environment reconstruction
  • User-friendly GUI: PyQt5-based interface with intuitive controls
  • Offline Operation: No internet connection required
  • Cross-platform: Runs on both Windows and Linux
  • Low Resource Usage: Optimized for Intel i3 + 8GB RAM systems

๐Ÿ”ง System Requirements

Minimum Requirements

  • OS: Windows 10+ or Ubuntu 20.04+
  • CPU: Intel i3 or equivalent
  • RAM: 8GB
  • Storage: 2GB free space
  • Camera: USB or IP laparoscopic camera
  • Display: 1280x720 minimum resolution

Recommended Requirements

  • CPU: Intel i5 or better
  • RAM: 16GB
  • GPU: Dedicated GPU (optional, for faster processing)

๐Ÿš€ Quick Start

Option 1: Download Pre-built Binaries

  1. Download the latest release from the Releases page
  2. Windows: Run SurgicalNavigation.exe
  3. Linux: Run ./SurgicalNavigation.AppImage or use the installer

Option 2: Build from Source

Prerequisites

# Install Python 3.8+
python3 --version

# Install pip
python3 -m pip install --upgrade pip

Installation

# Clone the repository
git clone https://github.com/your-username/surgical-navigation.git
cd surgical-navigation

# Install dependencies
pip install -r requirements.txt

# Run the application
python main.py

๐Ÿ—๏ธ Building Executables

Windows

# Run the Windows build script
python build_scripts/build_windows.py

# The executable will be created in dist/SurgicalNavigation.exe

Linux

# Run the Linux build script
chmod +x build_scripts/build_linux.sh
./build_scripts/build_linux.sh

# Multiple outputs will be created:
# - dist/SurgicalNavigation (executable)
# - dist/SurgicalNavigation.AppImage (if appimagetool is available)
# - dist/install.sh (system installer)

๐Ÿ“– Usage Guide

1. Camera Setup

  1. Connect your laparoscopic/USB camera
  2. Launch the application
  3. Go to Camera tab in the control panel
  4. Select your camera device and click Connect Camera
  5. Click Start Video to begin live feed

2. AI Detection

  1. Ensure camera is connected and video is running
  2. Go to AI Detection tab
  3. Adjust confidence threshold if needed (default: 0.50)
  4. Click Start Detection to enable real-time object detection

3. Viewing Results

  • Live Feed: Main window shows camera feed with detection overlays
  • Detection Info: Right panel shows detection statistics
  • 3D Mapping: Basic SLAM reconstruction (when enabled)

4. Settings

  • Display Settings: Toggle detection overlays and FPS display
  • System Info: View current system resources
  • Performance: Monitor detection speed and accuracy

๐ŸŽ›๏ธ Configuration

The application uses YAML configuration files located in the config/ directory:

# config/default_config.yaml
camera:
  default_device: 0
  resolution: [1280, 720]
  fps: 30

ai:
  confidence_threshold: 0.5
  model_path: assets/models/surgical_detector.onnx

gui:
  window_size: [1200, 800]
  show_fps: true

๐Ÿง  AI Models

The system supports ONNX models for object detection. Default classes include:

Surgical Instruments:

  • Scalpel, Forceps, Scissors, Needle Holder
  • Retractor, Suction Tube, Cautery, Clip Applier
  • Trocar, Grasper

Anatomical Structures:

  • Liver, Kidney, Heart, Lung, Stomach
  • Intestine, Blood Vessel, Nerve, Tumor, Cyst

Custom Models

To use your own trained models:

  1. Convert your model to ONNX format
  2. Place it in assets/models/
  3. Update the model_path in configuration
  4. Modify class names in src/ai/detector.py

๐Ÿ”ง Development

Project Structure

surgical_app/
โ”œโ”€โ”€ main.py                 # Application entry point
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ gui/               # GUI components
โ”‚   โ”œโ”€โ”€ camera/            # Camera management
โ”‚   โ”œโ”€โ”€ ai/                # AI detection
โ”‚   โ”œโ”€โ”€ slam/              # 3D mapping
โ”‚   โ””โ”€โ”€ utils/             # Utilities
โ”œโ”€โ”€ config/                # Configuration files
โ”œโ”€โ”€ assets/                # Models and resources
โ”œโ”€โ”€ build_scripts/         # Build automation
โ””โ”€โ”€ tests/                 # Unit tests

Running Tests

# Install test dependencies
pip install pytest pytest-qt

# Run tests
pytest tests/

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. Submit a pull request

๐Ÿ“Š Performance Optimization

For Low-end Hardware:

  • Reduce camera resolution to 640x480
  • Lower FPS to 15-20
  • Disable 3D mapping if not needed
  • Use CPU-only inference
  • Close other applications

Configuration for i3 + 8GB RAM:

camera:
  resolution: [640, 480]
  fps: 15

ai:
  use_gpu: false
  max_detections: 20

slam:
  enabled: false  # Disable for better performance

๐Ÿ› Troubleshooting

Common Issues

Camera not detected:

  • Check USB connection
  • Try different camera device IDs (0, 1, 2...)
  • Ensure camera is not used by other applications

Low performance:

  • Reduce video resolution
  • Lower detection confidence threshold
  • Disable SLAM if not needed
  • Check system resources

Detection not working:

  • Verify model file exists
  • Check confidence threshold settings
  • Ensure adequate lighting
  • Try different camera angles

Logs

Application logs are stored in:

  • Windows: logs/surgical_nav_YYYYMMDD.log
  • Linux: ~/.surgical-navigation/logs/

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿค Acknowledgments

  • OpenCV for computer vision capabilities
  • PyQt5 for the GUI framework
  • ONNX Runtime for AI inference
  • ORB-SLAM2 for SLAM inspiration

๐Ÿ“ž Support

For support, please:

  1. Check the Issues page
  2. Review the troubleshooting section
  3. Create a new issue with detailed information

๐Ÿ”ฎ Future Enhancements

  • GPU acceleration support
  • Advanced SLAM with loop closure
  • Integration with surgical robots
  • Voice command interface
  • Cloud-based model updates
  • Multi-camera support
  • AR/VR headset integration

Developed by Sandip Hembram | Version 1.0 | June 2025

surgical-nav-ai

About

AI-Assisted Surgical Navigation Desktop App

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published