File size: 891 Bytes
19f420a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# drive_paddy/detection/factory.py
from src.detection.strategies.geometric import GeometricProcessor
from src.detection.strategies.cnn_model import CnnProcessor
from src.detection.strategies.hybrid import HybridProcessor

def get_detector(config):
    """
    Factory function to get the appropriate drowsiness detector.
    """
    strategy = config.get('detection_strategy', 'geometric')
    
    if strategy == 'geometric':
        print("Initializing Geometric drowsiness detector...")
        return GeometricProcessor(config)
    elif strategy == 'cnn_model':
        print("Initializing CNN Model drowsiness detector...")
        return CnnProcessor(config)
    elif strategy == 'hybrid':
        print("Initializing Hybrid (Geometric + CNN) drowsiness detector...")
        return HybridProcessor(config)
    else:
        raise ValueError(f"Unknown detection strategy: {strategy}")