How visomaster/visomaster works
Project type and purpose
• VisoMaster is a desktop AI‑powered face‑swapping and editing application written in Python with a Qt GUI.
• It processes images, videos, and live webcam feeds, applies face detection, swapping, editing, restoration, and outputs results in real time or batch.
File structure
• Top‑level:
• main.py / Start.bat – application entrypoints
• app/ – core application code
• app/ui/ – Qt UI definitions and widget logic
• app/processors/ – AI pipelines and model runners
• app/helpers/ – utilities (download, integrity, recording, typing)
• app/onnxmodels/ – placeholder for ONNX model files
• dependencies/, model_assets/ – runtime assets
• scripts/, tools/ – setup and migration utilities
• Pattern: single‑process desktop app, MVC‑style separation (UI vs. logic vs. models).
Extract additional insights from the README
• UI: Qt-based GUI (app/ui) with dark/light styles.
• Models: ONNX / TensorRT inference in processors/utils.
• Features: face swap, face editor, live playback, webcam streaming, multi‑model support.
a. Main components
1. User Interface Layer
• Qt Designer .ui files (MainWindow.ui), widget classes (app/ui/widgets/…).
• Action handlers route user events to the controller.
2. Application Core / Controller
• main.py launches MainWindow, initializes managers (download, integrity, recording).
• Orchestrates workflows: load media → dispatch to processor → collect results → update UI.
3. Processor Layer
• VideoProcessor, FrameWorker, ModelsProcessor, external models (CLIP, ResNet).
• FaceDetectors, LandmarkDetectors, FaceSwappers, FaceEditors, FaceRestorers, FrameEnhancers.
4. Model & Asset Management
• download_models.py & app/helpers/downloader.py fetch required ONNX/DFM assets.
• integrity_checker.py verifies checksums.
• app/onnxmodels & model_assets hold runtime models.
5. Utilities & Helpers
• recording.py for video capture / webcam streaming.
• typing_helper, miscellaneous routines.
6. Hardware & External Services
• Local GPU with CUDA/cuDNN or TensorRT.
• File system for local assets.
b. Relationships & data flow
1. User clicks “Load Video/Image/Webcam” → UI layer emits signal → Controller
2. Controller loads media and sends frames to VideoProcessor
3. VideoProcessor spawns FrameWorker threads
4. Each FrameWorker:
• Face detection → landmarks → choose face swapper/editor/restorer → enhancement
• Uses ONNX/TensorRT model via engine_builder & tensorrt_predictor
5. Processed frames returned to Controller → UI renders live playback or save to disk via recording module
6. Downloader & IntegrityChecker run at startup or when models missing
c. Architectural patterns & design principles
• MVC / MVVM‑like separation between UI and processing logic
• Pipeline pattern in frame processing: chain of detectors → editors → enhancers
• Plugin‑style extensibility: adding new face swapper or restorer by placing modules under app/processors
• Threading via worker objects for responsive UI
d. Key technologies/frameworks
• Python 3.10, PyQt6 for GUI
• ONNX Runtime / TensorRT for inference
• NumPy, OpenCV, scikit-image
• DeepFaceLab models, LivePortrait models
Essential elements to capture
• UI event loop and signal connections
• Controller’s role in orchestrating download, integrity checks, and processing
• Frame processing pipeline and worker threads
• Model loading & inference (ONNX/TensorRT)
• Asset storage and management
• Output via UI display or file recording