mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-05 18:55:23 +03:00
Add const for float
This commit is contained in:
parent
cc11cf1737
commit
c73118ae49
@ -14,9 +14,9 @@ BTBN_PATH = "/usr/lib/btbn-ffmpeg"
|
|||||||
|
|
||||||
# Audio Consts
|
# Audio Consts
|
||||||
|
|
||||||
AUDIO_DETECTOR = "audio-detector"
|
|
||||||
AUDIO_DURATION = 0.975
|
AUDIO_DURATION = 0.975
|
||||||
AUDIO_FORMAT = "s16le"
|
AUDIO_FORMAT = "s16le"
|
||||||
|
AUDIO_MAX_BIT_RANGE = 32768.0
|
||||||
AUDIO_SAMPLE_RATE = 16000
|
AUDIO_SAMPLE_RATE = 16000
|
||||||
|
|
||||||
# Regex Consts
|
# Regex Consts
|
||||||
|
|||||||
@ -19,6 +19,7 @@ from frigate.config import CameraConfig, FrigateConfig
|
|||||||
from frigate.const import (
|
from frigate.const import (
|
||||||
AUDIO_DURATION,
|
AUDIO_DURATION,
|
||||||
AUDIO_FORMAT,
|
AUDIO_FORMAT,
|
||||||
|
AUDIO_MAX_BIT_RANGE,
|
||||||
AUDIO_SAMPLE_RATE,
|
AUDIO_SAMPLE_RATE,
|
||||||
CACHE_DIR,
|
CACHE_DIR,
|
||||||
)
|
)
|
||||||
@ -146,7 +147,7 @@ class AudioEventMaintainer(threading.Thread):
|
|||||||
self.audio_listener = None
|
self.audio_listener = None
|
||||||
|
|
||||||
def detect_audio(self, audio) -> None:
|
def detect_audio(self, audio) -> None:
|
||||||
waveform = (audio / 32768.0).astype(np.float32)
|
waveform = (audio / AUDIO_MAX_BIT_RANGE).astype(np.float32)
|
||||||
model_detections = self.detector.detect(waveform)
|
model_detections = self.detector.detect(waveform)
|
||||||
|
|
||||||
for label, score, _ in model_detections:
|
for label, score, _ in model_detections:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user