mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-26 19:06:11 +01:00
420bcd7aa0
* refactor detectors * move create_detector and DetectorTypeEnum * fixed code formatting * add detector model config models * fix detector unit tests * adjust SharedMemory size to largest detector model shape * fix detector model config defaults * enable auto-discovery of detectors * simplify config * simplify config changes further * update detectors docs; detect detector configs dynamic * add suggested changes * remove custom detector doc * fix grammar, adjust device defaults
25 lines
635 B
Python
25 lines
635 B
Python
import logging
|
|
|
|
from .detection_api import DetectionApi
|
|
from .detector_config import (
|
|
PixelFormatEnum,
|
|
InputTensorEnum,
|
|
ModelConfig,
|
|
)
|
|
from .detector_types import DetectorTypeEnum, api_types, DetectorConfig
|
|
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
def create_detector(detector_config):
|
|
if detector_config.type == DetectorTypeEnum.cpu:
|
|
logger.warning(
|
|
"CPU detectors are not recommended and should only be used for testing or for trial purposes."
|
|
)
|
|
|
|
api = api_types.get(detector_config.type)
|
|
if not api:
|
|
raise ValueError(detector_config.type)
|
|
return api(detector_config)
|