mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-04-21 14:31:54 +03:00
fix synaptics detector from throwing error when unused
This commit is contained in:
parent
f30934361b
commit
805170dd87
@ -2,10 +2,6 @@ import logging
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from synap import Network
|
|
||||||
from synap.postprocessor import Detector
|
|
||||||
from synap.preprocessor import Preprocessor
|
|
||||||
from synap.types import Layout, Shape
|
|
||||||
from typing_extensions import Literal
|
from typing_extensions import Literal
|
||||||
|
|
||||||
from frigate.detectors.detection_api import DetectionApi
|
from frigate.detectors.detection_api import DetectionApi
|
||||||
@ -15,6 +11,16 @@ from frigate.detectors.detector_config import (
|
|||||||
ModelTypeEnum,
|
ModelTypeEnum,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
try:
|
||||||
|
from synap import Network
|
||||||
|
from synap.postprocessor import Detector
|
||||||
|
from synap.preprocessor import Preprocessor
|
||||||
|
from synap.types import Layout, Shape
|
||||||
|
|
||||||
|
SYNAP_SUPPORT = True
|
||||||
|
except ImportError:
|
||||||
|
SYNAP_SUPPORT = False
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
DETECTOR_KEY = "synaptics"
|
DETECTOR_KEY = "synaptics"
|
||||||
@ -28,6 +34,11 @@ class SynapDetector(DetectionApi):
|
|||||||
type_key = DETECTOR_KEY
|
type_key = DETECTOR_KEY
|
||||||
|
|
||||||
def __init__(self, detector_config: SynapDetectorConfig):
|
def __init__(self, detector_config: SynapDetectorConfig):
|
||||||
|
if not SYNAP_SUPPORT:
|
||||||
|
raise ImportError(
|
||||||
|
"Error importing Synaptics SDK modules. You must use the -synaptics Docker image variant for Synaptics detector support."
|
||||||
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
_, ext = os.path.splitext(detector_config.model.path)
|
_, ext = os.path.splitext(detector_config.model.path)
|
||||||
if ext and ext != ".synap":
|
if ext and ext != ".synap":
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user