How gulkoa/uncountable works
Main Components
• Main Electron.js Process – This is the central orchestration component. It is responsible for:
• Spawning and managing Python child processes for running object detection.
• Handling runtime configurations and driving communication between the UI and backend.
• Renderer Electron.js Process (Frontend) – This component is focused on the end-user experience by:
• Displaying real-time video feeds with overlaid tracking information.
• Providing UI controls for configuration and alert monitoring.
• Python Object Detection Module – A backend service implemented in Python that:
• Runs a fine-tuned YOLOv8 model (using PyTorch) to detect surgical instruments.
• Uses Websockets for real-time data transmission back to the Electron processes.
• Data and Resources – Include components for:
• The custom dataset (under the “images” directory) used to train and refine the model.
• Pre-trained model files such as “yolov8m-seg.pt”, “best2.pt”, “best4.pt”, etc.
• Additional scripts (e.g. generateData.py, generateBackgroundImages.py) for data preparation.
Relationships and Interactions
• The Main Electron Process launches the Python object detection service and then manages bidirectional communication between:
• The Python processes (handling heavy computer vision operations).
• The Renderer process (user interface) which displays the video stream and alerts.
• The Python module (object detection module) works with a YOLOv8 model under the “python/ultralytics” folder structure. The training/inference code and utility scripts here are critical, with dependencies on PyTorch.
• Communication is handled via Websockets, ensuring low-latency transmission of detection results between the processes.
Important Architectural Patterns and Design Principles
• Separation of Concerns – Distinct processes are used to isolate the UI (renderer) from the backend (object detection), ensuring that intensive computations do not block the user interface.
• Child Process Management – The main Electron process handles Python child processes for executing deep learning tasks.
• Real-Time Communication – Use of Websockets for continuous, real-time data flow between components.
• Modular Design – The Python source is organized into modular subdirectories (ultralytics/engine, models, nn, trackers, etc.) reflecting a clear separation between object detection, tracking, and utility functions.
Relevant Technologies and Tools
• Electron.js (both main and renderer processes, leveraging Node.js and web technologies like HTML, CSS, and JavaScript).
• Python 3.8+ with key dependencies (PyTorch, YOLOv8 configurations and inference scripts).
• Websockets for communication between the Electron process and Python child processes.
• Data resources including custom images and pre-trained model files.