From db541abed4c5dd0897df4f74296da8bfae031c4d Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Sun, 16 Mar 2025 05:01:15 -0600 Subject: [PATCH] Fix model errors (#17171) --- frigate/config/config.py | 5 +++++ frigate/data_processing/real_time/bird.py | 3 ++- frigate/detectors/plugins/edgetpu_tfl.py | 15 ++++++++++++--- frigate/embeddings/__init__.py | 3 +++ frigate/record/export.py | 4 ---- 5 files changed, 22 insertions(+), 8 deletions(-) diff --git a/frigate/config/config.py b/frigate/config/config.py index 633aef803..ce59e6733 100644 --- a/frigate/config/config.py +++ b/frigate/config/config.py @@ -608,6 +608,11 @@ class FrigateConfig(FrigateBaseModel): self.model.create_colormap(sorted(self.objects.all_objects)) self.model.check_and_load_plus_model(self.plus_api) + if self.plus_api and not self.snapshots.clean_copy: + logger.warning( + "Frigate+ is configured but clean snapshots are not enabled, submissions to Frigate+ will not be possible./" + ) + for key, detector in self.detectors.items(): adapter = TypeAdapter(DetectorConfig) model_dict = ( diff --git a/frigate/data_processing/real_time/bird.py b/frigate/data_processing/real_time/bird.py index ba6d4f08c..ea181d6c3 100644 --- a/frigate/data_processing/real_time/bird.py +++ b/frigate/data_processing/real_time/bird.py @@ -144,7 +144,8 @@ class BirdRealTimeProcessor(RealTimeProcessorApi): return self.sub_label_publisher.publish( - EventMetadataTypeEnum.sub_label, (id, self.labelmap[best_id], score) + EventMetadataTypeEnum.sub_label, + (obj_data["id"], self.labelmap[best_id], score), ) self.detected_birds[obj_data["id"]] = score diff --git a/frigate/detectors/plugins/edgetpu_tfl.py b/frigate/detectors/plugins/edgetpu_tfl.py index c320bd89b..246d2dd41 100644 --- a/frigate/detectors/plugins/edgetpu_tfl.py +++ b/frigate/detectors/plugins/edgetpu_tfl.py @@ -1,4 +1,5 @@ import logging +import os import numpy as np from pydantic import Field @@ -45,9 +46,17 @@ class EdgeTpuTfl(DetectionApi): experimental_delegates=[edge_tpu_delegate], ) except ValueError: - logger.error( - "No EdgeTPU was detected. If you do not have a Coral device yet, you must configure CPU detectors." - ) + _, ext = os.path.splitext(detector_config.model.path) + + if ext and ext != ".tflite": + logger.error( + "Incorrect model used with EdgeTPU. Only .tflite models can be used with a Coral EdgeTPU." + ) + else: + logger.error( + "No EdgeTPU was detected. If you do not have a Coral device yet, you must configure CPU detectors." + ) + raise self.interpreter.allocate_tensors() diff --git a/frigate/embeddings/__init__.py b/frigate/embeddings/__init__.py index 56bd097d6..0a0d7200a 100644 --- a/frigate/embeddings/__init__.py +++ b/frigate/embeddings/__init__.py @@ -225,6 +225,9 @@ class EmbeddingsContext: if os.path.isfile(file_path): os.unlink(file_path) + if len(os.listdir(folder)) == 0: + os.rmdir(folder) + def update_description(self, event_id: str, description: str) -> None: self.requestor.send_data( EmbeddingsRequestEnum.embed_description.value, diff --git a/frigate/record/export.py b/frigate/record/export.py index 0e64021b4..4eadbf1bd 100644 --- a/frigate/record/export.py +++ b/frigate/record/export.py @@ -19,7 +19,6 @@ from frigate.const import ( CACHE_DIR, CLIPS_DIR, EXPORT_DIR, - FFMPEG_HVC1_ARGS, MAX_PLAYLIST_SECONDS, PREVIEW_FRAME_TYPE, ) @@ -233,9 +232,6 @@ class RecordingExporter(threading.Thread): ) ).split(" ") - if self.config.ffmpeg.apple_compatibility: - ffmpeg_cmd += FFMPEG_HVC1_ARGS - # add metadata title = f"Frigate Recording for {self.camera}, {self.get_datetime_from_timestamp(self.start_time)} - {self.get_datetime_from_timestamp(self.end_time)}" ffmpeg_cmd.extend(["-metadata", f"title={title}"])