NVR with realtime local object detection for IP cameras
TypeScript aicameragoogle-coralhome-assistanthome-automationhomeautomationmqttnvrobject-detectionrealtimertsptensorflow
Add count of audio labels to active count (#8310)
Nicolas Mowen1a9e00ee496c
diff --git a/frigate/events/audio.py b/frigate/events/audio.pyindex b96e76af3b..e8f4f6546d 100644--- a/frigate/events/audio.py+++ b/frigate/events/audio.py@@ -205,14 +205,10 @@ class AudioEventMaintainer(threading.Thread):# only run audio detection when volume is above min_volumeif 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 detectionswaveform = (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()diff --git a/frigate/record/maintainer.py b/frigate/record/maintainer.pyindex 0370bbf3ea..a5bc1b3e8c 100644--- a/frigate/record/maintainer.py+++ b/frigate/record/maintainer.py@@ -303,6 +303,10 @@ class RecordingMaintainer(threading.Thread):if frame[0] < start_time.timestamp():continue+ # add active audio label count to count of active objects+ active_count += len(frame[2])++ # add sound level to audio valuesaudio_values.append(frame[1])average_dBFS = 0 if not audio_values else np.average(audio_values)@@ -461,6 +465,7 @@ class RecordingMaintainer(threading.Thread):camera,frame_time,dBFS,+ audio_detections,) = self.audio_recordings_info_queue.get(True, timeout=0.01)if frame_time < run_start - stale_frame_count_threshold:@@ -471,6 +476,7 @@ class RecordingMaintainer(threading.Thread):(frame_time,dBFS,+ audio_detections,))except queue.Empty: