NVR with realtime local object detection for IP cameras
TypeScript aicameragoogle-coralhome-assistanthome-automationhomeautomationmqttnvrobject-detectionrealtimertsptensorflow
feat: add github mirror download endpoint (#20007)
GuoQing Liub08db4913f72
diff --git a/frigate/data_processing/real_time/bird.py b/frigate/data_processing/real_time/bird.pyindex 8d2c598fc3..d547f2ddd3 100644--- a/frigate/data_processing/real_time/bird.py+++ b/frigate/data_processing/real_time/bird.py@@ -41,10 +41,13 @@ class BirdRealTimeProcessor(RealTimeProcessorApi):self.detected_birds: dict[str, float] = {}self.labelmap: dict[int, str] = {}+ GITHUB_RAW_ENDPOINT = os.environ.get(+ "GITHUB_RAW_ENDPOINT", "https://raw.githubusercontent.com"+ )download_path = os.path.join(MODEL_CACHE_DIR, "bird")self.model_files = {- "bird.tflite": "https://raw.githubusercontent.com/google-coral/test_data/master/mobilenet_v2_1.0_224_inat_bird_quant.tflite",- "birdmap.txt": "https://raw.githubusercontent.com/google-coral/test_data/master/inat_bird_labels.txt",+ "bird.tflite": f"{GITHUB_RAW_ENDPOINT}/google-coral/test_data/master/mobilenet_v2_1.0_224_inat_bird_quant.tflite",+ "birdmap.txt": f"{GITHUB_RAW_ENDPOINT}/google-coral/test_data/master/inat_bird_labels.txt",}if not all(diff --git a/frigate/data_processing/real_time/face.py b/frigate/data_processing/real_time/face.pyindex 144ec42d4d..5a6525362c 100644--- a/frigate/data_processing/real_time/face.py+++ b/frigate/data_processing/real_time/face.py@@ -60,10 +60,12 @@ class FaceRealTimeProcessor(RealTimeProcessorApi):self.faces_per_second = EventsPerSecond()self.inference_speed = InferenceSpeed(self.metrics.face_rec_speed)+ GITHUB_ENDPOINT = os.environ.get("GITHUB_ENDPOINT", "https://github.com")+download_path = os.path.join(MODEL_CACHE_DIR, "facedet")self.model_files = {- "facedet.onnx": "https://github.com/NickM-27/facenet-onnx/releases/download/v1.0/facedet.onnx",- "landmarkdet.yaml": "https://github.com/NickM-27/facenet-onnx/releases/download/v1.0/landmarkdet.yaml",+ "facedet.onnx": f"{GITHUB_ENDPOINT}/NickM-27/facenet-onnx/releases/download/v1.0/facedet.onnx",+ "landmarkdet.yaml": f"{GITHUB_ENDPOINT}/NickM-27/facenet-onnx/releases/download/v1.0/landmarkdet.yaml",}if not all(diff --git a/frigate/detectors/plugins/rknn.py b/frigate/detectors/plugins/rknn.pyindex 828507c54a..46fae3e62f 100644--- a/frigate/detectors/plugins/rknn.py+++ b/frigate/detectors/plugins/rknn.py@@ -139,8 +139,9 @@ class Rknn(DetectionApi):if not os.path.isdir(model_cache_dir):os.mkdir(model_cache_dir)+ GITHUB_ENDPOINT = os.environ.get("GITHUB_ENDPOINT", "https://github.com")urllib.request.urlretrieve(- f"https://github.com/MarcA711/rknn-models/releases/download/v2.3.2-2/{filename}",+ f"{GITHUB_ENDPOINT}/MarcA711/rknn-models/releases/download/v2.3.2-2/{filename}",model_cache_dir + filename,)diff --git a/frigate/embeddings/onnx/face_embedding.py b/frigate/embeddings/onnx/face_embedding.pyindex c0f35a5815..eb04b43b27 100644--- a/frigate/embeddings/onnx/face_embedding.py+++ b/frigate/embeddings/onnx/face_embedding.py@@ -24,11 +24,12 @@ FACENET_INPUT_SIZE = 160class FaceNetEmbedding(BaseEmbedding):def __init__(self):+ GITHUB_ENDPOINT = os.environ.get("GITHUB_ENDPOINT", "https://github.com")super().__init__(model_name="facedet",model_file="facenet.tflite",download_urls={- "facenet.tflite": "https://github.com/NickM-27/facenet-onnx/releases/download/v1.0/facenet.tflite",+ "facenet.tflite": f"{GITHUB_ENDPOINT}/NickM-27/facenet-onnx/releases/download/v1.0/facenet.tflite",},)self.download_path = os.path.join(MODEL_CACHE_DIR, self.model_name)@@ -110,11 +111,12 @@ class FaceNetEmbedding(BaseEmbedding):class ArcfaceEmbedding(BaseEmbedding):def __init__(self):+ GITHUB_ENDPOINT = os.environ.get("GITHUB_ENDPOINT", "https://github.com")super().__init__(model_name="facedet",model_file="arcface.onnx",download_urls={- "arcface.onnx": "https://github.com/NickM-27/facenet-onnx/releases/download/v1.0/arcface.onnx",+ "arcface.onnx": f"{GITHUB_ENDPOINT}/NickM-27/facenet-onnx/releases/download/v1.0/arcface.onnx",},)self.download_path = os.path.join(MODEL_CACHE_DIR, self.model_name)diff --git a/frigate/embeddings/onnx/lpr_embedding.py b/frigate/embeddings/onnx/lpr_embedding.pyindex ac981da8d3..35ff5ceeed 100644--- a/frigate/embeddings/onnx/lpr_embedding.py+++ b/frigate/embeddings/onnx/lpr_embedding.py@@ -34,11 +34,12 @@ class PaddleOCRDetection(BaseEmbedding):model_file = ("detection-large.onnx" if model_size == "large" else "detection-small.onnx")+ GITHUB_ENDPOINT = os.environ.get("GITHUB_ENDPOINT", "https://github.com")super().__init__(model_name="paddleocr-onnx",model_file=model_file,download_urls={- model_file: f"https://github.com/hawkeye217/paddleocr-onnx/raw/refs/heads/master/models/{model_file}"+ model_file: f"{GITHUB_ENDPOINT}/hawkeye217/paddleocr-onnx/raw/refs/heads/master/models/{model_file}"},)self.requestor = requestor@@ -94,11 +95,12 @@ class PaddleOCRClassification(BaseEmbedding):requestor: InterProcessRequestor,device: str = "AUTO",):+ GITHUB_ENDPOINT = os.environ.get("GITHUB_ENDPOINT", "https://github.com")super().__init__(model_name="paddleocr-onnx",model_file="classification.onnx",download_urls={- "classification.onnx": "https://github.com/hawkeye217/paddleocr-onnx/raw/refs/heads/master/models/classification.onnx"+ "classification.onnx": f"{GITHUB_ENDPOINT}/hawkeye217/paddleocr-onnx/raw/refs/heads/master/models/classification.onnx"},)self.requestor = requestor@@ -154,11 +156,12 @@ class PaddleOCRRecognition(BaseEmbedding):requestor: InterProcessRequestor,device: str = "AUTO",):+ GITHUB_ENDPOINT = os.environ.get("GITHUB_ENDPOINT", "https://github.com")super().__init__(model_name="paddleocr-onnx",model_file="recognition.onnx",download_urls={- "recognition.onnx": "https://github.com/hawkeye217/paddleocr-onnx/raw/refs/heads/master/models/recognition.onnx"+ "recognition.onnx": f"{GITHUB_ENDPOINT}/hawkeye217/paddleocr-onnx/raw/refs/heads/master/models/recognition.onnx"},)self.requestor = requestor@@ -214,11 +217,12 @@ class LicensePlateDetector(BaseEmbedding):requestor: InterProcessRequestor,device: str = "AUTO",):+ GITHUB_ENDPOINT = os.environ.get("GITHUB_ENDPOINT", "https://github.com")super().__init__(model_name="yolov9_license_plate",model_file="yolov9-256-license-plates.onnx",download_urls={- "yolov9-256-license-plates.onnx": "https://github.com/hawkeye217/yolov9-license-plates/raw/refs/heads/master/models/yolov9-256-license-plates.onnx"+ "yolov9-256-license-plates.onnx": f"{GITHUB_ENDPOINT}/hawkeye217/yolov9-license-plates/raw/refs/heads/master/models/yolov9-256-license-plates.onnx"},)