mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-08-04 09:58:51 +03:00
Add count of audio labels to active count (#8310)
* Add count of audio labels to active count * Formatting
This commit is contained in:
+12
-5
@@ -205,14 +205,10 @@ class AudioEventMaintainer(threading.Thread):
|
||||
|
||||
# only run audio detection when volume is above min_volume
|
||||
if rms >= self.config.audio.min_volume:
|
||||
# add audio info to recordings queue
|
||||
self.recordings_info_queue.put(
|
||||
(self.config.name, datetime.datetime.now().timestamp(), dBFS)
|
||||
)
|
||||
|
||||
# create waveform relative to max range and look for detections
|
||||
waveform = (audio / AUDIO_MAX_BIT_RANGE).astype(np.float32)
|
||||
model_detections = self.detector.detect(waveform)
|
||||
audio_detections = []
|
||||
|
||||
for label, score, _ in model_detections:
|
||||
logger.debug(f"Heard {label} with a score of {score}")
|
||||
@@ -224,6 +220,17 @@ class AudioEventMaintainer(threading.Thread):
|
||||
"threshold", 0.8
|
||||
):
|
||||
self.handle_detection(label, score)
|
||||
audio_detections.append(label)
|
||||
|
||||
# add audio info to recordings queue
|
||||
self.recordings_info_queue.put(
|
||||
(
|
||||
self.config.name,
|
||||
datetime.datetime.now().timestamp(),
|
||||
dBFS,
|
||||
audio_detections,
|
||||
)
|
||||
)
|
||||
|
||||
self.expire_detections()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user