Deep-Live-Cam
Deep-Live-Cam copied to clipboard
Refactor and Optimize Cross-Platform Support
Several refactors to enhance cross-platform compatibility (especially Mac OS), error handling, and efficiency.
- Cross-Platform Enhancements: Refined resource management for CUDA and ROCm execution providers, and added macOS-specific camera handling with permission checks using pyobjc.
- Improved Error Handling: Added error handling across modules, including better validation of input parameters, detailed error messages, and graceful degradation when resources or system capabilities are exceeded.
- UI Updates: Updated the theme for consistent look cross OS and modes, simplified event handling, and improved cross-platform camera selection and initialization logic.
- Refactored core.py by separating image and video processing into distinct functions, enhancing code clarity and maintainability. Deprecated argument handling was moved to a dedicated function for better organization and easier future modifications.
- Performance: Preloaded models for prediction tasks.
- Simplified file and path operations using pathlib for better cross-platform support.
- Dependency: Added pyobjc for macOS-specific functionality, ensuring seamless camera handling on macOS systems.
Tested on Mac latest, with python 3.10.14
Summary by Sourcery
Refactor and optimize cross-platform support, focusing on enhancing resource management for CUDA and ROCm, improving error handling, updating the UI theme, and simplifying file operations. Added macOS-specific camera handling with permission checks and preloaded models for prediction tasks to boost performance.
New Features:
- Added macOS-specific camera handling with permission checks using pyobjc.
- Introduced preloading of models for prediction tasks to enhance performance.
Bug Fixes:
- Improved error handling across modules, including better validation of input parameters and detailed error messages.
- Ensured graceful degradation when resources or system capabilities are exceeded.
Enhancements:
- Refined resource management for CUDA and ROCm execution providers to enhance cross-platform compatibility.
- Updated the UI theme for a consistent look across different operating systems and modes.
- Simplified event handling and improved cross-platform camera selection and initialization logic.
- Separated image and video processing into distinct functions in core.py for better code clarity and maintainability.
- Deprecated argument handling was moved to a dedicated function for better organization and easier future modifications.
- Simplified file and path operations using pathlib for better cross-platform support.
Chores:
- Added pyobjc dependency for macOS-specific functionality to ensure seamless camera handling on macOS systems.
Reviewer's Guide by Sourcery
This pull request refactors and optimizes the codebase to enhance cross-platform compatibility, especially for macOS, improve error handling, and boost performance. Significant changes include refined resource management for CUDA and ROCm execution providers, macOS-specific camera handling, better validation of input parameters, and preloading models for prediction tasks. The UI has been updated for a consistent look across different OS and modes, and file operations have been simplified using pathlib.
File-Level Changes
| Files | Changes |
|---|---|
modules/core.pymodules/ui.pymodules/utilities.py |
Refactored core functionalities, improved cross-platform support, and enhanced error handling. |
modules/processors/frame/core.pymodules/processors/frame/face_enhancer.pymodules/processors/frame/face_swapper.py |
Refactored frame processing modules for better readability, maintainability, and error handling. |
Tips
- Trigger a new Sourcery review by commenting
@sourcery-ai reviewon the pull request. - Continue your discussion with Sourcery by replying directly to review comments.
- You can change your review settings at any time by accessing your dashboard:
- Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
- Change the review language;
- You can always contact us if you have any questions or feedback.
Thanks for this wonderful push @zoharbabin