|
|
""" |
|
|
Utils Package for BackgroundFX Pro |
|
|
================================= |
|
|
|
|
|
This package provides utility modules for device management, logging, |
|
|
configuration, and shared utilities. |
|
|
|
|
|
Author: BackgroundFX Pro Team |
|
|
License: MIT |
|
|
""" |
|
|
|
|
|
|
|
|
from .utilities import * |
|
|
|
|
|
|
|
|
from .device import ( |
|
|
DeviceManager, |
|
|
get_device_manager, |
|
|
get_optimal_device, |
|
|
fix_cuda_compatibility, |
|
|
setup_optimal_threading, |
|
|
get_system_diagnostics |
|
|
) |
|
|
|
|
|
from .logger import ( |
|
|
BackgroundFXLogger, |
|
|
setup_logging, |
|
|
get_logger, |
|
|
log_function_call, |
|
|
log_processing_pipeline, |
|
|
log_info, |
|
|
log_error, |
|
|
log_warning, |
|
|
log_debug |
|
|
) |
|
|
|
|
|
from .config import ( |
|
|
ConfigManager, |
|
|
ModelConfig, |
|
|
QualityConfig, |
|
|
ProcessingConfig, |
|
|
VideoConfig, |
|
|
get_config, |
|
|
load_config, |
|
|
get_model_config, |
|
|
is_model_enabled, |
|
|
get_quality_thresholds, |
|
|
get_processing_config |
|
|
) |
|
|
|
|
|
from .utils import ( |
|
|
ProgressTracker, |
|
|
FileManager, |
|
|
VideoUtils, |
|
|
ImageUtils, |
|
|
ValidationUtils, |
|
|
PerformanceUtils, |
|
|
temporary_directory, |
|
|
error_handler, |
|
|
retry_on_failure, |
|
|
batch_process, |
|
|
format_duration, |
|
|
get_system_info, |
|
|
ConfigurationError, |
|
|
ValidationError, |
|
|
ProcessingError, |
|
|
safe_division, |
|
|
clamp, |
|
|
interpolate, |
|
|
moving_average |
|
|
) |
|
|
|
|
|
|
|
|
__version__ = "1.0.0" |
|
|
__author__ = "BackgroundFX Pro Team" |
|
|
__all__ = [ |
|
|
|
|
|
'DeviceManager', |
|
|
'get_device_manager', |
|
|
'get_optimal_device', |
|
|
'fix_cuda_compatibility', |
|
|
'setup_optimal_threading', |
|
|
'get_system_diagnostics', |
|
|
|
|
|
|
|
|
'BackgroundFXLogger', |
|
|
'setup_logging', |
|
|
'get_logger', |
|
|
'log_function_call', |
|
|
'log_processing_pipeline', |
|
|
'log_info', |
|
|
'log_error', |
|
|
'log_warning', |
|
|
'log_debug', |
|
|
|
|
|
|
|
|
'ConfigManager', |
|
|
'ModelConfig', |
|
|
'QualityConfig', |
|
|
'ProcessingConfig', |
|
|
'VideoConfig', |
|
|
'get_config', |
|
|
'load_config', |
|
|
'get_model_config', |
|
|
'is_model_enabled', |
|
|
'get_quality_thresholds', |
|
|
'get_processing_config', |
|
|
|
|
|
|
|
|
'ProgressTracker', |
|
|
'FileManager', |
|
|
'VideoUtils', |
|
|
'ImageUtils', |
|
|
'ValidationUtils', |
|
|
'PerformanceUtils', |
|
|
'temporary_directory', |
|
|
'error_handler', |
|
|
'retry_on_failure', |
|
|
'batch_process', |
|
|
'format_duration', |
|
|
'get_system_info', |
|
|
'ConfigurationError', |
|
|
'ValidationError', |
|
|
'ProcessingError', |
|
|
'safe_division', |
|
|
'clamp', |
|
|
'interpolate', |
|
|
'moving_average' |
|
|
] |
|
|
|
|
|
|
|
|
try: |
|
|
|
|
|
_logger = setup_logging(logs_dir="LOGS") |
|
|
_logger.info("β
BackgroundFX Pro Utils package initialized") |
|
|
|
|
|
|
|
|
_device_manager = get_device_manager() |
|
|
|
|
|
|
|
|
_config = get_config(checkpoints_dir="checkpoints") |
|
|
|
|
|
_logger.info("π Utils package ready for BackgroundFX Pro") |
|
|
|
|
|
except Exception as e: |
|
|
print(f"β οΈ Utils package initialization warning: {e}") |