mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-05 10:45:21 +03:00
treewide: optimize imports
This commit is contained in:
parent
bea7c8239a
commit
3fc4e7be0a
10
benchmark.py
10
benchmark.py
@ -1,11 +1,11 @@
|
|||||||
import os
|
|
||||||
from statistics import mean
|
|
||||||
import multiprocessing as mp
|
|
||||||
import numpy as np
|
|
||||||
import datetime
|
import datetime
|
||||||
|
import multiprocessing as mp
|
||||||
|
from statistics import mean
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
from frigate.config import DetectorTypeEnum
|
from frigate.config import DetectorTypeEnum
|
||||||
from frigate.object_detection import (
|
from frigate.object_detection import (
|
||||||
LocalObjectDetector,
|
|
||||||
ObjectDetectProcess,
|
ObjectDetectProcess,
|
||||||
RemoteObjectDetector,
|
RemoteObjectDetector,
|
||||||
load_labels,
|
load_labels,
|
||||||
|
|||||||
@ -3,11 +3,14 @@
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
sys.path.insert(0, "/opt/frigate")
|
sys.path.insert(0, "/opt/frigate")
|
||||||
from frigate.const import BIRDSEYE_PIPE, BTBN_PATH
|
from frigate.const import BIRDSEYE_PIPE, BTBN_PATH # noqa: E402
|
||||||
from frigate.ffmpeg_presets import parse_preset_hardware_acceleration_encode
|
from frigate.ffmpeg_presets import ( # noqa: E402
|
||||||
|
parse_preset_hardware_acceleration_encode,
|
||||||
|
)
|
||||||
|
|
||||||
sys.path.remove("/opt/frigate")
|
sys.path.remove("/opt/frigate")
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,6 @@ from flask import cli
|
|||||||
|
|
||||||
from frigate.app import FrigateApp
|
from frigate.app import FrigateApp
|
||||||
|
|
||||||
|
|
||||||
faulthandler.enable()
|
faulthandler.enable()
|
||||||
|
|
||||||
threading.current_thread().name = "frigate"
|
threading.current_thread().name = "frigate"
|
||||||
|
|||||||
@ -1,16 +1,16 @@
|
|||||||
import logging
|
import logging
|
||||||
import multiprocessing as mp
|
import multiprocessing as mp
|
||||||
from multiprocessing.queues import Queue
|
|
||||||
from multiprocessing.synchronize import Event as MpEvent
|
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import signal
|
import signal
|
||||||
import sys
|
import sys
|
||||||
from typing import Optional
|
|
||||||
from types import FrameType
|
|
||||||
import psutil
|
|
||||||
|
|
||||||
import traceback
|
import traceback
|
||||||
|
from multiprocessing.queues import Queue
|
||||||
|
from multiprocessing.synchronize import Event as MpEvent
|
||||||
|
from types import FrameType
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
|
import psutil
|
||||||
from peewee_migrate import Router
|
from peewee_migrate import Router
|
||||||
from playhouse.sqlite_ext import SqliteExtDatabase
|
from playhouse.sqlite_ext import SqliteExtDatabase
|
||||||
from playhouse.sqliteq import SqliteQueueDatabase
|
from playhouse.sqliteq import SqliteQueueDatabase
|
||||||
@ -27,13 +27,13 @@ from frigate.const import (
|
|||||||
MODEL_CACHE_DIR,
|
MODEL_CACHE_DIR,
|
||||||
RECORD_DIR,
|
RECORD_DIR,
|
||||||
)
|
)
|
||||||
from frigate.object_detection import ObjectDetectProcess
|
|
||||||
from frigate.events.cleanup import EventCleanup
|
from frigate.events.cleanup import EventCleanup
|
||||||
from frigate.events.external import ExternalEventProcessor
|
from frigate.events.external import ExternalEventProcessor
|
||||||
from frigate.events.maintainer import EventProcessor
|
from frigate.events.maintainer import EventProcessor
|
||||||
from frigate.http import create_app
|
from frigate.http import create_app
|
||||||
from frigate.log import log_process, root_configurer
|
from frigate.log import log_process, root_configurer
|
||||||
from frigate.models import Event, Recordings, Timeline
|
from frigate.models import Event, Recordings, Timeline
|
||||||
|
from frigate.object_detection import ObjectDetectProcess
|
||||||
from frigate.object_processing import TrackedObjectProcessor
|
from frigate.object_processing import TrackedObjectProcessor
|
||||||
from frigate.output import output_frames
|
from frigate.output import output_frames
|
||||||
from frigate.plus import PlusApi
|
from frigate.plus import PlusApi
|
||||||
@ -42,10 +42,10 @@ from frigate.record.record import manage_recordings
|
|||||||
from frigate.stats import StatsEmitter, stats_init
|
from frigate.stats import StatsEmitter, stats_init
|
||||||
from frigate.storage import StorageMaintainer
|
from frigate.storage import StorageMaintainer
|
||||||
from frigate.timeline import TimelineProcessor
|
from frigate.timeline import TimelineProcessor
|
||||||
|
from frigate.types import CameraMetricsTypes, RecordMetricsTypes
|
||||||
from frigate.version import VERSION
|
from frigate.version import VERSION
|
||||||
from frigate.video import capture_camera, track_camera
|
from frigate.video import capture_camera, track_camera
|
||||||
from frigate.watchdog import FrigateWatchdog
|
from frigate.watchdog import FrigateWatchdog
|
||||||
from frigate.types import CameraMetricsTypes, RecordMetricsTypes
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|||||||
@ -1,17 +1,14 @@
|
|||||||
"""Handle communication between Frigate and other applications."""
|
"""Handle communication between Frigate and other applications."""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
from abc import ABC, abstractmethod
|
||||||
from typing import Any, Callable
|
from typing import Any, Callable
|
||||||
|
|
||||||
from abc import ABC, abstractmethod
|
|
||||||
|
|
||||||
from frigate.config import FrigateConfig
|
from frigate.config import FrigateConfig
|
||||||
from frigate.ptz import OnvifController, OnvifCommandEnum
|
from frigate.ptz import OnvifCommandEnum, OnvifController
|
||||||
from frigate.types import CameraMetricsTypes, RecordMetricsTypes
|
from frigate.types import CameraMetricsTypes, RecordMetricsTypes
|
||||||
from frigate.util import restart_frigate
|
from frigate.util import restart_frigate
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
import logging
|
import logging
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
from typing import Any, Callable
|
from typing import Any, Callable
|
||||||
|
|
||||||
import paho.mqtt.client as mqtt
|
import paho.mqtt.client as mqtt
|
||||||
@ -8,7 +7,6 @@ import paho.mqtt.client as mqtt
|
|||||||
from frigate.comms.dispatcher import Communicator
|
from frigate.comms.dispatcher import Communicator
|
||||||
from frigate.config import FrigateConfig
|
from frigate.config import FrigateConfig
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -3,10 +3,9 @@
|
|||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
from typing import Callable
|
from typing import Callable
|
||||||
|
|
||||||
from wsgiref.simple_server import make_server
|
from wsgiref.simple_server import make_server
|
||||||
|
|
||||||
from ws4py.server.wsgirefserver import (
|
from ws4py.server.wsgirefserver import (
|
||||||
WebSocketWSGIHandler,
|
WebSocketWSGIHandler,
|
||||||
WebSocketWSGIRequestHandler,
|
WebSocketWSGIRequestHandler,
|
||||||
@ -18,7 +17,6 @@ from ws4py.websocket import WebSocket
|
|||||||
from frigate.comms.dispatcher import Communicator
|
from frigate.comms.dispatcher import Communicator
|
||||||
from frigate.config import FrigateConfig
|
from frigate.config import FrigateConfig
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -8,24 +8,14 @@ from typing import Dict, List, Optional, Tuple, Union
|
|||||||
|
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from pydantic import BaseModel, Extra, Field, validator, parse_obj_as
|
from pydantic import BaseModel, Extra, Field, parse_obj_as, validator
|
||||||
from pydantic.fields import PrivateAttr
|
from pydantic.fields import PrivateAttr
|
||||||
|
|
||||||
from frigate.const import (
|
from frigate.const import CACHE_DIR, DEFAULT_DB_PATH, REGEX_CAMERA_NAME, YAML_EXT
|
||||||
CACHE_DIR,
|
from frigate.detectors import DetectorConfig, ModelConfig
|
||||||
DEFAULT_DB_PATH,
|
from frigate.detectors.detector_config import InputTensorEnum # noqa: F401
|
||||||
REGEX_CAMERA_NAME,
|
from frigate.detectors.detector_config import PixelFormatEnum # noqa: F401
|
||||||
YAML_EXT,
|
|
||||||
)
|
|
||||||
from frigate.detectors.detector_config import BaseDetectorConfig
|
from frigate.detectors.detector_config import BaseDetectorConfig
|
||||||
from frigate.plus import PlusApi
|
|
||||||
from frigate.util import (
|
|
||||||
create_mask,
|
|
||||||
deep_merge,
|
|
||||||
get_ffmpeg_arg_list,
|
|
||||||
escape_special_characters,
|
|
||||||
load_config_with_no_duplicates,
|
|
||||||
)
|
|
||||||
from frigate.ffmpeg_presets import (
|
from frigate.ffmpeg_presets import (
|
||||||
parse_preset_hardware_acceleration_decode,
|
parse_preset_hardware_acceleration_decode,
|
||||||
parse_preset_hardware_acceleration_scale,
|
parse_preset_hardware_acceleration_scale,
|
||||||
@ -33,12 +23,15 @@ from frigate.ffmpeg_presets import (
|
|||||||
parse_preset_output_record,
|
parse_preset_output_record,
|
||||||
parse_preset_output_rtmp,
|
parse_preset_output_rtmp,
|
||||||
)
|
)
|
||||||
from frigate.detectors import (
|
from frigate.plus import PlusApi
|
||||||
ModelConfig,
|
from frigate.util import (
|
||||||
DetectorConfig,
|
create_mask,
|
||||||
|
deep_merge,
|
||||||
|
escape_special_characters,
|
||||||
|
get_ffmpeg_arg_list,
|
||||||
|
load_config_with_no_duplicates,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
# TODO: Identify what the default format to display timestamps is
|
# TODO: Identify what the default format to display timestamps is
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
from .detector_types import DetectorTypeEnum, api_types, DetectorConfig
|
from .detector_config import InputTensorEnum, ModelConfig, PixelFormatEnum # noqa: F401
|
||||||
|
from .detector_types import DetectorConfig, DetectorTypeEnum, api_types # noqa: F401
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
import logging
|
import logging
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,20 +1,18 @@
|
|||||||
import hashlib
|
import hashlib
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
from enum import Enum
|
|
||||||
import os
|
import os
|
||||||
|
from enum import Enum
|
||||||
from typing import Dict, Optional, Tuple
|
from typing import Dict, Optional, Tuple
|
||||||
|
|
||||||
|
|
||||||
import requests
|
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
|
import requests
|
||||||
from pydantic import BaseModel, Extra, Field
|
from pydantic import BaseModel, Extra, Field
|
||||||
from pydantic.fields import PrivateAttr
|
from pydantic.fields import PrivateAttr
|
||||||
|
|
||||||
from frigate.plus import PlusApi
|
from frigate.plus import PlusApi
|
||||||
|
|
||||||
from frigate.util import load_labels
|
from frigate.util import load_labels
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,16 +1,16 @@
|
|||||||
import logging
|
|
||||||
import importlib
|
import importlib
|
||||||
|
import logging
|
||||||
import pkgutil
|
import pkgutil
|
||||||
from typing import Union
|
|
||||||
from typing_extensions import Annotated
|
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
from pydantic import Field
|
from pydantic import Field
|
||||||
|
from typing_extensions import Annotated
|
||||||
|
|
||||||
from . import plugins
|
from . import plugins
|
||||||
from .detection_api import DetectionApi
|
from .detection_api import DetectionApi
|
||||||
from .detector_config import BaseDetectorConfig
|
from .detector_config import BaseDetectorConfig
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
from pydantic import Field
|
||||||
|
from typing_extensions import Literal
|
||||||
|
|
||||||
from frigate.detectors.detection_api import DetectionApi
|
from frigate.detectors.detection_api import DetectionApi
|
||||||
from frigate.detectors.detector_config import BaseDetectorConfig
|
from frigate.detectors.detector_config import BaseDetectorConfig
|
||||||
|
|
||||||
from typing_extensions import Literal
|
|
||||||
from pydantic import Field
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from tflite_runtime.interpreter import Interpreter
|
from tflite_runtime.interpreter import Interpreter
|
||||||
except ModuleNotFoundError:
|
except ModuleNotFoundError:
|
||||||
|
|||||||
@ -1,14 +1,14 @@
|
|||||||
|
import io
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import requests
|
import requests
|
||||||
import io
|
from PIL import Image
|
||||||
|
from pydantic import Field
|
||||||
|
from typing_extensions import Literal
|
||||||
|
|
||||||
from frigate.detectors.detection_api import DetectionApi
|
from frigate.detectors.detection_api import DetectionApi
|
||||||
from frigate.detectors.detector_config import BaseDetectorConfig
|
from frigate.detectors.detector_config import BaseDetectorConfig
|
||||||
from typing_extensions import Literal
|
|
||||||
from pydantic import Field
|
|
||||||
from PIL import Image
|
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
from pydantic import Field
|
||||||
|
from typing_extensions import Literal
|
||||||
|
|
||||||
from frigate.detectors.detection_api import DetectionApi
|
from frigate.detectors.detection_api import DetectionApi
|
||||||
from frigate.detectors.detector_config import BaseDetectorConfig
|
from frigate.detectors.detector_config import BaseDetectorConfig
|
||||||
from typing_extensions import Literal
|
|
||||||
from pydantic import Field
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from tflite_runtime.interpreter import Interpreter, load_delegate
|
from tflite_runtime.interpreter import Interpreter, load_delegate
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import openvino.runtime as ov
|
import openvino.runtime as ov
|
||||||
|
from pydantic import Field
|
||||||
|
from typing_extensions import Literal
|
||||||
|
|
||||||
from frigate.detectors.detection_api import DetectionApi
|
from frigate.detectors.detection_api import DetectionApi
|
||||||
from frigate.detectors.detector_config import BaseDetectorConfig, ModelTypeEnum
|
from frigate.detectors.detector_config import BaseDetectorConfig, ModelTypeEnum
|
||||||
from typing_extensions import Literal
|
|
||||||
from pydantic import Field
|
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
|
import ctypes
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import ctypes
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -11,10 +11,11 @@ try:
|
|||||||
except ModuleNotFoundError:
|
except ModuleNotFoundError:
|
||||||
TRT_SUPPORT = False
|
TRT_SUPPORT = False
|
||||||
|
|
||||||
|
from pydantic import Field
|
||||||
|
from typing_extensions import Literal
|
||||||
|
|
||||||
from frigate.detectors.detection_api import DetectionApi
|
from frigate.detectors.detection_api import DetectionApi
|
||||||
from frigate.detectors.detector_config import BaseDetectorConfig
|
from frigate.detectors.detector_config import BaseDetectorConfig
|
||||||
from typing_extensions import Literal
|
|
||||||
from pydantic import Field
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|||||||
@ -4,16 +4,13 @@ import datetime
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import threading
|
import threading
|
||||||
|
from multiprocessing.synchronize import Event as MpEvent
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
from frigate.config import FrigateConfig
|
from frigate.config import FrigateConfig
|
||||||
from frigate.const import CLIPS_DIR
|
from frigate.const import CLIPS_DIR
|
||||||
from frigate.models import Event
|
from frigate.models import Event
|
||||||
|
|
||||||
from multiprocessing.synchronize import Event as MpEvent
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,16 +1,15 @@
|
|||||||
"""Handle external events created by the user."""
|
"""Handle external events created by the user."""
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
import cv2
|
|
||||||
import datetime
|
import datetime
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
import string
|
import string
|
||||||
|
from multiprocessing.queues import Queue
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from multiprocessing.queues import Queue
|
import cv2
|
||||||
|
|
||||||
from frigate.config import CameraConfig, FrigateConfig
|
from frigate.config import CameraConfig, FrigateConfig
|
||||||
from frigate.const import CLIPS_DIR
|
from frigate.const import CLIPS_DIR
|
||||||
|
|||||||
@ -2,19 +2,16 @@ import datetime
|
|||||||
import logging
|
import logging
|
||||||
import queue
|
import queue
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
|
from multiprocessing.queues import Queue
|
||||||
|
from multiprocessing.synchronize import Event as MpEvent
|
||||||
|
from typing import Dict
|
||||||
|
|
||||||
from frigate.config import EventsConfig, FrigateConfig
|
from frigate.config import EventsConfig, FrigateConfig
|
||||||
from frigate.models import Event
|
from frigate.models import Event
|
||||||
from frigate.types import CameraMetricsTypes
|
from frigate.types import CameraMetricsTypes
|
||||||
from frigate.util import to_relative_box
|
from frigate.util import to_relative_box
|
||||||
|
|
||||||
from multiprocessing.queues import Queue
|
|
||||||
from multiprocessing.synchronize import Event as MpEvent
|
|
||||||
from typing import Dict
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,13 +2,11 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from frigate.version import VERSION
|
|
||||||
from frigate.const import BTBN_PATH
|
from frigate.const import BTBN_PATH
|
||||||
from frigate.util import vainfo_hwaccel
|
from frigate.util import vainfo_hwaccel
|
||||||
|
from frigate.version import VERSION
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|||||||
@ -1,23 +1,20 @@
|
|||||||
import base64
|
import base64
|
||||||
from datetime import datetime, timedelta, timezone
|
|
||||||
import copy
|
import copy
|
||||||
import logging
|
|
||||||
import glob
|
import glob
|
||||||
import json
|
import json
|
||||||
|
import logging
|
||||||
import os
|
import os
|
||||||
import subprocess as sp
|
import subprocess as sp
|
||||||
import pytz
|
|
||||||
import time
|
import time
|
||||||
import traceback
|
import traceback
|
||||||
|
from datetime import datetime, timedelta, timezone
|
||||||
from functools import reduce
|
from functools import reduce
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from tzlocal import get_localzone_name
|
|
||||||
from urllib.parse import unquote
|
from urllib.parse import unquote
|
||||||
|
|
||||||
import cv2
|
import cv2
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
import pytz
|
||||||
from flask import (
|
from flask import (
|
||||||
Blueprint,
|
Blueprint,
|
||||||
Flask,
|
Flask,
|
||||||
@ -27,26 +24,26 @@ from flask import (
|
|||||||
make_response,
|
make_response,
|
||||||
request,
|
request,
|
||||||
)
|
)
|
||||||
|
from peewee import DoesNotExist, SqliteDatabase, fn, operator
|
||||||
from peewee import SqliteDatabase, operator, fn, DoesNotExist
|
|
||||||
from playhouse.shortcuts import model_to_dict
|
from playhouse.shortcuts import model_to_dict
|
||||||
|
from tzlocal import get_localzone_name
|
||||||
|
|
||||||
from frigate.config import FrigateConfig
|
from frigate.config import FrigateConfig
|
||||||
from frigate.const import CLIPS_DIR, MAX_SEGMENT_DURATION, RECORD_DIR
|
from frigate.const import CLIPS_DIR, MAX_SEGMENT_DURATION, RECORD_DIR
|
||||||
from frigate.models import Event, Recordings, Timeline
|
|
||||||
from frigate.events.external import ExternalEventProcessor
|
from frigate.events.external import ExternalEventProcessor
|
||||||
|
from frigate.models import Event, Recordings, Timeline
|
||||||
from frigate.object_processing import TrackedObject
|
from frigate.object_processing import TrackedObject
|
||||||
from frigate.plus import PlusApi
|
from frigate.plus import PlusApi
|
||||||
from frigate.ptz import OnvifController
|
from frigate.ptz import OnvifController
|
||||||
from frigate.stats import stats_snapshot
|
from frigate.stats import stats_snapshot
|
||||||
|
from frigate.storage import StorageMaintainer
|
||||||
from frigate.util import (
|
from frigate.util import (
|
||||||
clean_camera_user_pass,
|
clean_camera_user_pass,
|
||||||
ffprobe_stream,
|
ffprobe_stream,
|
||||||
|
get_tz_modifiers,
|
||||||
restart_frigate,
|
restart_frigate,
|
||||||
vainfo_hwaccel,
|
vainfo_hwaccel,
|
||||||
get_tz_modifiers,
|
|
||||||
)
|
)
|
||||||
from frigate.storage import StorageMaintainer
|
|
||||||
from frigate.version import VERSION
|
from frigate.version import VERSION
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|||||||
@ -1,17 +1,17 @@
|
|||||||
# adapted from https://medium.com/@jonathonbao/python3-logging-with-multiprocessing-f51f460b8778
|
# adapted from https://medium.com/@jonathonbao/python3-logging-with-multiprocessing-f51f460b8778
|
||||||
import logging
|
import logging
|
||||||
import threading
|
|
||||||
import os
|
|
||||||
import signal
|
|
||||||
import queue
|
|
||||||
import multiprocessing as mp
|
import multiprocessing as mp
|
||||||
from multiprocessing.queues import Queue
|
import os
|
||||||
from logging import handlers
|
import queue
|
||||||
from typing import Optional
|
import signal
|
||||||
from types import FrameType
|
import threading
|
||||||
from setproctitle import setproctitle
|
|
||||||
from typing import Deque
|
|
||||||
from collections import deque
|
from collections import deque
|
||||||
|
from logging import handlers
|
||||||
|
from multiprocessing.queues import Queue
|
||||||
|
from types import FrameType
|
||||||
|
from typing import Deque, Optional
|
||||||
|
|
||||||
|
from setproctitle import setproctitle
|
||||||
|
|
||||||
from frigate.util import clean_camera_user_pass
|
from frigate.util import clean_camera_user_pass
|
||||||
|
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
from peewee import (
|
from peewee import (
|
||||||
Model,
|
BooleanField,
|
||||||
CharField,
|
CharField,
|
||||||
DateTimeField,
|
DateTimeField,
|
||||||
FloatField,
|
FloatField,
|
||||||
BooleanField,
|
|
||||||
TextField,
|
|
||||||
IntegerField,
|
IntegerField,
|
||||||
|
Model,
|
||||||
|
TextField,
|
||||||
)
|
)
|
||||||
from playhouse.sqlite_ext import JSONField
|
from playhouse.sqlite_ext import JSONField
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import cv2
|
import cv2
|
||||||
import imutils
|
import imutils
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from frigate.config import MotionConfig
|
from frigate.config import MotionConfig
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -12,7 +12,6 @@ from setproctitle import setproctitle
|
|||||||
|
|
||||||
from frigate.config import InputTensorEnum
|
from frigate.config import InputTensorEnum
|
||||||
from frigate.detectors import create_detector
|
from frigate.detectors import create_detector
|
||||||
|
|
||||||
from frigate.util import EventsPerSecond, SharedMemoryFrameManager, listen, load_labels
|
from frigate.util import EventsPerSecond, SharedMemoryFrameManager, listen, load_labels
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|||||||
@ -15,10 +15,10 @@ import numpy as np
|
|||||||
from frigate.comms.dispatcher import Dispatcher
|
from frigate.comms.dispatcher import Dispatcher
|
||||||
from frigate.config import (
|
from frigate.config import (
|
||||||
CameraConfig,
|
CameraConfig,
|
||||||
MqttConfig,
|
|
||||||
SnapshotsConfig,
|
|
||||||
RecordConfig,
|
|
||||||
FrigateConfig,
|
FrigateConfig,
|
||||||
|
MqttConfig,
|
||||||
|
RecordConfig,
|
||||||
|
SnapshotsConfig,
|
||||||
)
|
)
|
||||||
from frigate.const import CLIPS_DIR
|
from frigate.const import CLIPS_DIR
|
||||||
from frigate.events.maintainer import EventTypeEnum
|
from frigate.events.maintainer import EventTypeEnum
|
||||||
|
|||||||
@ -4,11 +4,13 @@ import logging
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
from typing import Any, List
|
from typing import Any, List
|
||||||
import requests
|
|
||||||
from frigate.const import PLUS_ENV_VAR, PLUS_API_HOST
|
|
||||||
from requests.models import Response
|
|
||||||
import cv2
|
import cv2
|
||||||
|
import requests
|
||||||
from numpy import ndarray
|
from numpy import ndarray
|
||||||
|
from requests.models import Response
|
||||||
|
|
||||||
|
from frigate.const import PLUS_API_HOST, PLUS_ENV_VAR
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|||||||
@ -2,13 +2,12 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
import site
|
import site
|
||||||
|
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
|
|
||||||
from onvif import ONVIFCamera, ONVIFError
|
from onvif import ONVIFCamera, ONVIFError
|
||||||
|
|
||||||
from frigate.config import FrigateConfig
|
from frigate.config import FrigateConfig
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -5,12 +5,12 @@ import itertools
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import threading
|
import threading
|
||||||
|
from multiprocessing.synchronize import Event as MpEvent
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from peewee import DoesNotExist
|
from peewee import DoesNotExist
|
||||||
from multiprocessing.synchronize import Event as MpEvent
|
|
||||||
|
|
||||||
from frigate.config import RetainModeEnum, FrigateConfig
|
from frigate.config import FrigateConfig, RetainModeEnum
|
||||||
from frigate.const import RECORD_DIR, SECONDS_IN_DAY
|
from frigate.const import RECORD_DIR, SECONDS_IN_DAY
|
||||||
from frigate.models import Event, Recordings, Timeline
|
from frigate.models import Event, Recordings, Timeline
|
||||||
from frigate.record.util import remove_empty_directories
|
from frigate.record.util import remove_empty_directories
|
||||||
|
|||||||
@ -9,14 +9,14 @@ import random
|
|||||||
import string
|
import string
|
||||||
import subprocess as sp
|
import subprocess as sp
|
||||||
import threading
|
import threading
|
||||||
import psutil
|
|
||||||
|
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from multiprocessing.synchronize import Event as MpEvent
|
from multiprocessing.synchronize import Event as MpEvent
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, Tuple
|
from typing import Any, Tuple
|
||||||
|
|
||||||
from frigate.config import RetainModeEnum, FrigateConfig
|
import psutil
|
||||||
|
|
||||||
|
from frigate.config import FrigateConfig, RetainModeEnum
|
||||||
from frigate.const import CACHE_DIR, MAX_SEGMENT_DURATION, RECORD_DIR
|
from frigate.const import CACHE_DIR, MAX_SEGMENT_DURATION, RECORD_DIR
|
||||||
from frigate.models import Event, Recordings
|
from frigate.models import Event, Recordings
|
||||||
from frigate.types import RecordMetricsTypes
|
from frigate.types import RecordMetricsTypes
|
||||||
|
|||||||
@ -4,12 +4,11 @@ import logging
|
|||||||
import multiprocessing as mp
|
import multiprocessing as mp
|
||||||
import signal
|
import signal
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
from setproctitle import setproctitle
|
|
||||||
from types import FrameType
|
from types import FrameType
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from playhouse.sqliteq import SqliteQueueDatabase
|
from playhouse.sqliteq import SqliteQueueDatabase
|
||||||
|
from setproctitle import setproctitle
|
||||||
|
|
||||||
from frigate.config import FrigateConfig
|
from frigate.config import FrigateConfig
|
||||||
from frigate.models import Event, Recordings, Timeline
|
from frigate.models import Event, Recordings, Timeline
|
||||||
|
|||||||
@ -1,24 +1,30 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
import psutil
|
|
||||||
import shutil
|
|
||||||
import os
|
|
||||||
import requests
|
|
||||||
from typing import Optional, Any
|
|
||||||
from multiprocessing.synchronize import Event as MpEvent
|
from multiprocessing.synchronize import Event as MpEvent
|
||||||
|
from typing import Any, Optional
|
||||||
|
|
||||||
|
import psutil
|
||||||
|
import requests
|
||||||
from requests.exceptions import RequestException
|
from requests.exceptions import RequestException
|
||||||
|
|
||||||
from frigate.comms.dispatcher import Dispatcher
|
from frigate.comms.dispatcher import Dispatcher
|
||||||
from frigate.config import FrigateConfig
|
from frigate.config import FrigateConfig
|
||||||
from frigate.const import DRIVER_AMD, DRIVER_ENV_VAR, RECORD_DIR, CLIPS_DIR, CACHE_DIR
|
from frigate.const import CACHE_DIR, CLIPS_DIR, DRIVER_AMD, DRIVER_ENV_VAR, RECORD_DIR
|
||||||
from frigate.types import StatsTrackingTypes, CameraMetricsTypes
|
|
||||||
from frigate.util import get_amd_gpu_stats, get_intel_gpu_stats, get_nvidia_gpu_stats
|
|
||||||
from frigate.version import VERSION
|
|
||||||
from frigate.util import get_cpu_stats, get_bandwidth_stats
|
|
||||||
from frigate.object_detection import ObjectDetectProcess
|
from frigate.object_detection import ObjectDetectProcess
|
||||||
|
from frigate.types import CameraMetricsTypes, StatsTrackingTypes
|
||||||
|
from frigate.util import (
|
||||||
|
get_amd_gpu_stats,
|
||||||
|
get_bandwidth_stats,
|
||||||
|
get_cpu_stats,
|
||||||
|
get_intel_gpu_stats,
|
||||||
|
get_nvidia_gpu_stats,
|
||||||
|
)
|
||||||
|
from frigate.version import VERSION
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
"""Handle storage retention and usage."""
|
"""Handle storage retention and usage."""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from pathlib import Path
|
|
||||||
import shutil
|
import shutil
|
||||||
import threading
|
import threading
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
from peewee import fn
|
from peewee import fn
|
||||||
|
|
||||||
|
|||||||
@ -1,13 +1,11 @@
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from pydantic import ValidationError
|
from pydantic import ValidationError
|
||||||
|
|
||||||
from frigate.config import (
|
from frigate.config import BirdseyeModeEnum, FrigateConfig
|
||||||
BirdseyeModeEnum,
|
|
||||||
FrigateConfig,
|
|
||||||
)
|
|
||||||
from frigate.const import MODEL_CACHE_DIR
|
from frigate.const import MODEL_CACHE_DIR
|
||||||
from frigate.detectors import DetectorTypeEnum
|
from frigate.detectors import DetectorTypeEnum
|
||||||
from frigate.plus import PlusApi
|
from frigate.plus import PlusApi
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
|
from unittest import TestCase, main
|
||||||
|
|
||||||
import cv2
|
import cv2
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from unittest import TestCase, main
|
|
||||||
from frigate.util import get_yuv_crop, copy_yuv_to_position
|
from frigate.util import copy_yuv_to_position, get_yuv_crop
|
||||||
|
|
||||||
|
|
||||||
class TestCopyYuvToPosition(TestCase):
|
class TestCopyYuvToPosition(TestCase):
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from frigate.config import FFMPEG_INPUT_ARGS_DEFAULT, FrigateConfig
|
from frigate.config import FFMPEG_INPUT_ARGS_DEFAULT, FrigateConfig
|
||||||
from frigate.ffmpeg_presets import parse_preset_input
|
from frigate.ffmpeg_presets import parse_preset_input
|
||||||
|
|
||||||
|
|||||||
@ -6,15 +6,14 @@ import unittest
|
|||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
from peewee_migrate import Router
|
from peewee_migrate import Router
|
||||||
|
from playhouse.shortcuts import model_to_dict
|
||||||
from playhouse.sqlite_ext import SqliteExtDatabase
|
from playhouse.sqlite_ext import SqliteExtDatabase
|
||||||
from playhouse.sqliteq import SqliteQueueDatabase
|
from playhouse.sqliteq import SqliteQueueDatabase
|
||||||
from playhouse.shortcuts import model_to_dict
|
|
||||||
|
|
||||||
from frigate.config import FrigateConfig
|
from frigate.config import FrigateConfig
|
||||||
from frigate.http import create_app
|
from frigate.http import create_app
|
||||||
from frigate.models import Event, Recordings
|
from frigate.models import Event, Recordings
|
||||||
from frigate.plus import PlusApi
|
from frigate.plus import PlusApi
|
||||||
|
|
||||||
from frigate.test.const import TEST_DB, TEST_DB_CLEANUPS
|
from frigate.test.const import TEST_DB, TEST_DB_CLEANUPS
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -4,10 +4,10 @@ from unittest.mock import Mock, patch
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
from pydantic import parse_obj_as
|
from pydantic import parse_obj_as
|
||||||
|
|
||||||
from frigate.config import DetectorConfig, InputTensorEnum, ModelConfig
|
|
||||||
from frigate.detectors import DetectorTypeEnum
|
|
||||||
import frigate.detectors as detectors
|
import frigate.detectors as detectors
|
||||||
import frigate.object_detection
|
import frigate.object_detection
|
||||||
|
from frigate.config import DetectorConfig, InputTensorEnum, ModelConfig
|
||||||
|
from frigate.detectors import DetectorTypeEnum
|
||||||
|
|
||||||
|
|
||||||
class TestLocalObjectDetector(unittest.TestCase):
|
class TestLocalObjectDetector(unittest.TestCase):
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
from unittest import TestCase, main
|
from unittest import TestCase, main
|
||||||
|
|
||||||
from frigate.video import box_overlaps, reduce_boxes
|
from frigate.video import box_overlaps, reduce_boxes
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -12,7 +12,6 @@ from playhouse.sqliteq import SqliteQueueDatabase
|
|||||||
from frigate.config import FrigateConfig
|
from frigate.config import FrigateConfig
|
||||||
from frigate.models import Event, Recordings
|
from frigate.models import Event, Recordings
|
||||||
from frigate.storage import StorageMaintainer
|
from frigate.storage import StorageMaintainer
|
||||||
|
|
||||||
from frigate.test.const import TEST_DB, TEST_DB_CLEANUPS
|
from frigate.test.const import TEST_DB, TEST_DB_CLEANUPS
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
|
from unittest import TestCase, main
|
||||||
|
|
||||||
import cv2
|
import cv2
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from unittest import TestCase, main
|
|
||||||
from frigate.util import yuv_region_2_rgb
|
from frigate.util import yuv_region_2_rgb
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,16 +1,14 @@
|
|||||||
"""Record events for object, audio, etc. detections."""
|
"""Record events for object, audio, etc. detections."""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import threading
|
|
||||||
import queue
|
import queue
|
||||||
|
import threading
|
||||||
|
from multiprocessing.queues import Queue
|
||||||
|
from multiprocessing.synchronize import Event as MpEvent
|
||||||
|
|
||||||
from frigate.config import FrigateConfig
|
from frigate.config import FrigateConfig
|
||||||
from frigate.events.maintainer import EventTypeEnum
|
from frigate.events.maintainer import EventTypeEnum
|
||||||
from frigate.models import Timeline
|
from frigate.models import Timeline
|
||||||
|
|
||||||
from multiprocessing.queues import Queue
|
|
||||||
from multiprocessing.synchronize import Event as MpEvent
|
|
||||||
|
|
||||||
from frigate.util import to_relative_box
|
from frigate.util import to_relative_box
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
from typing import Optional, TypedDict
|
from multiprocessing.context import Process
|
||||||
from multiprocessing.queues import Queue
|
from multiprocessing.queues import Queue
|
||||||
from multiprocessing.sharedctypes import Synchronized
|
from multiprocessing.sharedctypes import Synchronized
|
||||||
from multiprocessing.context import Process
|
from typing import Optional, TypedDict
|
||||||
|
|
||||||
from frigate.object_detection import ObjectDetectProcess
|
from frigate.object_detection import ObjectDetectProcess
|
||||||
|
|
||||||
|
|||||||
@ -1,27 +1,26 @@
|
|||||||
import copy
|
import copy
|
||||||
import datetime
|
import datetime
|
||||||
import logging
|
|
||||||
import shlex
|
|
||||||
import subprocess as sp
|
|
||||||
import json
|
import json
|
||||||
|
import logging
|
||||||
|
import os
|
||||||
import re
|
import re
|
||||||
|
import shlex
|
||||||
import signal
|
import signal
|
||||||
|
import subprocess as sp
|
||||||
import traceback
|
import traceback
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
import yaml
|
|
||||||
import os
|
|
||||||
|
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
from collections import Counter
|
from collections import Counter
|
||||||
from collections.abc import Mapping
|
from collections.abc import Mapping
|
||||||
from multiprocessing import shared_memory
|
from multiprocessing import shared_memory
|
||||||
from typing import Any, AnyStr, Optional, Tuple
|
from typing import Any, AnyStr, Optional, Tuple
|
||||||
import py3nvml.py3nvml as nvml
|
|
||||||
|
|
||||||
import cv2
|
import cv2
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import psutil
|
import psutil
|
||||||
|
import py3nvml.py3nvml as nvml
|
||||||
import pytz
|
import pytz
|
||||||
|
import yaml
|
||||||
|
|
||||||
from frigate.const import REGEX_HTTP_CAMERA_USER_PASS, REGEX_RTSP_CAMERA_USER_PASS
|
from frigate.const import REGEX_HTTP_CAMERA_USER_PASS, REGEX_RTSP_CAMERA_USER_PASS
|
||||||
|
|
||||||
|
|||||||
@ -10,15 +10,15 @@ import threading
|
|||||||
import time
|
import time
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
import numpy as np
|
|
||||||
import cv2
|
import cv2
|
||||||
|
import numpy as np
|
||||||
from setproctitle import setproctitle
|
from setproctitle import setproctitle
|
||||||
|
|
||||||
from frigate.config import CameraConfig, DetectConfig, PixelFormatEnum
|
from frigate.config import CameraConfig, DetectConfig, PixelFormatEnum
|
||||||
from frigate.const import CACHE_DIR
|
from frigate.const import CACHE_DIR
|
||||||
from frigate.object_detection import RemoteObjectDetector
|
|
||||||
from frigate.log import LogPipe
|
from frigate.log import LogPipe
|
||||||
from frigate.motion import MotionDetector
|
from frigate.motion import MotionDetector
|
||||||
|
from frigate.object_detection import RemoteObjectDetector
|
||||||
from frigate.objects import ObjectTracker
|
from frigate.objects import ObjectTracker
|
||||||
from frigate.util import (
|
from frigate.util import (
|
||||||
EventsPerSecond,
|
EventsPerSecond,
|
||||||
@ -30,8 +30,8 @@ from frigate.util import (
|
|||||||
intersection,
|
intersection,
|
||||||
intersection_over_union,
|
intersection_over_union,
|
||||||
listen,
|
listen,
|
||||||
yuv_region_2_rgb,
|
|
||||||
yuv_region_2_bgr,
|
yuv_region_2_bgr,
|
||||||
|
yuv_region_2_rgb,
|
||||||
yuv_region_2_yuv,
|
yuv_region_2_yuv,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -2,10 +2,10 @@ import datetime
|
|||||||
import logging
|
import logging
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
|
from multiprocessing.synchronize import Event as MpEvent
|
||||||
|
|
||||||
from frigate.object_detection import ObjectDetectProcess
|
from frigate.object_detection import ObjectDetectProcess
|
||||||
from frigate.util import restart_frigate
|
from frigate.util import restart_frigate
|
||||||
from multiprocessing.synchronize import Event as MpEvent
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|||||||
@ -21,14 +21,7 @@ Some examples (model - class or model name)::
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import datetime as dt
|
|
||||||
import peewee as pw
|
import peewee as pw
|
||||||
from decimal import ROUND_HALF_EVEN
|
|
||||||
|
|
||||||
try:
|
|
||||||
import playhouse.postgres_ext as pw_pext
|
|
||||||
except ImportError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
SQL = pw.SQL
|
SQL = pw.SQL
|
||||||
|
|
||||||
|
|||||||
@ -21,15 +21,9 @@ Some examples (model - class or model name)::
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import datetime as dt
|
|
||||||
import peewee as pw
|
import peewee as pw
|
||||||
from decimal import ROUND_HALF_EVEN
|
|
||||||
from frigate.models import Event
|
|
||||||
|
|
||||||
try:
|
from frigate.models import Event
|
||||||
import playhouse.postgres_ext as pw_pext
|
|
||||||
except ImportError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
SQL = pw.SQL
|
SQL = pw.SQL
|
||||||
|
|
||||||
|
|||||||
@ -22,8 +22,6 @@ Some examples (model - class or model name)::
|
|||||||
"""
|
"""
|
||||||
import peewee as pw
|
import peewee as pw
|
||||||
|
|
||||||
from frigate.models import Recordings
|
|
||||||
|
|
||||||
SQL = pw.SQL
|
SQL = pw.SQL
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -21,16 +21,10 @@ Some examples (model - class or model name)::
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import datetime as dt
|
|
||||||
import peewee as pw
|
import peewee as pw
|
||||||
from playhouse.sqlite_ext import *
|
from playhouse.sqlite_ext import JSONField
|
||||||
from decimal import ROUND_HALF_EVEN
|
|
||||||
from frigate.models import Event
|
|
||||||
|
|
||||||
try:
|
from frigate.models import Event
|
||||||
import playhouse.postgres_ext as pw_pext
|
|
||||||
except ImportError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
SQL = pw.SQL
|
SQL = pw.SQL
|
||||||
|
|
||||||
|
|||||||
@ -21,16 +21,9 @@ Some examples (model - class or model name)::
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import datetime as dt
|
|
||||||
import peewee as pw
|
import peewee as pw
|
||||||
from playhouse.sqlite_ext import *
|
|
||||||
from decimal import ROUND_HALF_EVEN
|
|
||||||
from frigate.models import Event
|
|
||||||
|
|
||||||
try:
|
from frigate.models import Event
|
||||||
import playhouse.postgres_ext as pw_pext
|
|
||||||
except ImportError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
SQL = pw.SQL
|
SQL = pw.SQL
|
||||||
|
|
||||||
|
|||||||
@ -21,16 +21,9 @@ Some examples (model - class or model name)::
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import datetime as dt
|
|
||||||
import peewee as pw
|
import peewee as pw
|
||||||
from playhouse.sqlite_ext import *
|
|
||||||
from decimal import ROUND_HALF_EVEN
|
|
||||||
from frigate.models import Recordings
|
|
||||||
|
|
||||||
try:
|
from frigate.models import Recordings
|
||||||
import playhouse.postgres_ext as pw_pext
|
|
||||||
except ImportError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
SQL = pw.SQL
|
SQL = pw.SQL
|
||||||
|
|
||||||
|
|||||||
@ -21,16 +21,9 @@ Some examples (model - class or model name)::
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import datetime as dt
|
|
||||||
import peewee as pw
|
import peewee as pw
|
||||||
from playhouse.sqlite_ext import *
|
|
||||||
from decimal import ROUND_HALF_EVEN
|
|
||||||
from frigate.models import Event
|
|
||||||
|
|
||||||
try:
|
from frigate.models import Event
|
||||||
import playhouse.postgres_ext as pw_pext
|
|
||||||
except ImportError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
SQL = pw.SQL
|
SQL = pw.SQL
|
||||||
|
|
||||||
|
|||||||
@ -21,16 +21,9 @@ Some examples (model - class or model name)::
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import datetime as dt
|
|
||||||
import peewee as pw
|
import peewee as pw
|
||||||
from playhouse.sqlite_ext import *
|
|
||||||
from decimal import ROUND_HALF_EVEN
|
|
||||||
from frigate.models import Event
|
|
||||||
|
|
||||||
try:
|
from frigate.models import Event
|
||||||
import playhouse.postgres_ext as pw_pext
|
|
||||||
except ImportError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
SQL = pw.SQL
|
SQL = pw.SQL
|
||||||
|
|
||||||
|
|||||||
@ -22,6 +22,7 @@ Some examples (model - class or model name)::
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import peewee as pw
|
import peewee as pw
|
||||||
|
|
||||||
from frigate.models import Event
|
from frigate.models import Event
|
||||||
|
|
||||||
SQL = pw.SQL
|
SQL = pw.SQL
|
||||||
|
|||||||
@ -21,16 +21,9 @@ Some examples (model - class or model name)::
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import datetime as dt
|
|
||||||
import peewee as pw
|
import peewee as pw
|
||||||
from playhouse.sqlite_ext import *
|
|
||||||
from decimal import ROUND_HALF_EVEN
|
|
||||||
from frigate.models import Event
|
|
||||||
|
|
||||||
try:
|
from frigate.models import Event
|
||||||
import playhouse.postgres_ext as pw_pext
|
|
||||||
except ImportError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
SQL = pw.SQL
|
SQL = pw.SQL
|
||||||
|
|
||||||
|
|||||||
@ -21,16 +21,9 @@ Some examples (model - class or model name)::
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import datetime as dt
|
|
||||||
import peewee as pw
|
import peewee as pw
|
||||||
from playhouse.sqlite_ext import *
|
|
||||||
from decimal import ROUND_HALF_EVEN
|
|
||||||
from frigate.models import Recordings
|
|
||||||
|
|
||||||
try:
|
from frigate.models import Recordings
|
||||||
import playhouse.postgres_ext as pw_pext
|
|
||||||
except ImportError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
SQL = pw.SQL
|
SQL = pw.SQL
|
||||||
|
|
||||||
|
|||||||
@ -21,16 +21,7 @@ Some examples (model - class or model name)::
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import datetime as dt
|
|
||||||
import peewee as pw
|
import peewee as pw
|
||||||
from playhouse.sqlite_ext import *
|
|
||||||
from decimal import ROUND_HALF_EVEN
|
|
||||||
from frigate.models import Recordings
|
|
||||||
|
|
||||||
try:
|
|
||||||
import playhouse.postgres_ext as pw_pext
|
|
||||||
except ImportError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
SQL = pw.SQL
|
SQL = pw.SQL
|
||||||
|
|
||||||
|
|||||||
@ -21,16 +21,9 @@ Some examples (model - class or model name)::
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import datetime as dt
|
|
||||||
import peewee as pw
|
import peewee as pw
|
||||||
from playhouse.sqlite_ext import *
|
|
||||||
from decimal import ROUND_HALF_EVEN
|
|
||||||
from frigate.models import Event
|
|
||||||
|
|
||||||
try:
|
from frigate.models import Event
|
||||||
import playhouse.postgres_ext as pw_pext
|
|
||||||
except ImportError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
SQL = pw.SQL
|
SQL = pw.SQL
|
||||||
|
|
||||||
|
|||||||
@ -21,16 +21,10 @@ Some examples (model - class or model name)::
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import datetime as dt
|
|
||||||
import peewee as pw
|
import peewee as pw
|
||||||
from playhouse.sqlite_ext import *
|
from playhouse.sqlite_ext import JSONField
|
||||||
from decimal import ROUND_HALF_EVEN
|
|
||||||
from frigate.models import Event
|
|
||||||
|
|
||||||
try:
|
from frigate.models import Event
|
||||||
import playhouse.postgres_ext as pw_pext
|
|
||||||
except ImportError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
SQL = pw.SQL
|
SQL = pw.SQL
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
import peewee as pw
|
import peewee as pw
|
||||||
from playhouse.migrate import *
|
|
||||||
from playhouse.sqlite_ext import *
|
|
||||||
from frigate.models import Event
|
from frigate.models import Event
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,4 @@
|
|||||||
import sys
|
import csv
|
||||||
from typing_extensions import runtime
|
|
||||||
|
|
||||||
sys.path.append("/lab/frigate")
|
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import multiprocessing as mp
|
import multiprocessing as mp
|
||||||
@ -11,21 +7,26 @@ import subprocess as sp
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
import click
|
import click
|
||||||
import csv
|
|
||||||
import cv2
|
import cv2
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from frigate.config import FrigateConfig
|
sys.path.append("/lab/frigate")
|
||||||
from frigate.object_detection import LocalObjectDetector
|
|
||||||
from frigate.motion import MotionDetector
|
from frigate.config import FrigateConfig # noqa: E402
|
||||||
from frigate.object_processing import CameraState
|
from frigate.motion import MotionDetector # noqa: E402
|
||||||
from frigate.objects import ObjectTracker
|
from frigate.object_detection import LocalObjectDetector # noqa: E402
|
||||||
from frigate.util import (
|
from frigate.object_processing import CameraState # noqa: E402
|
||||||
|
from frigate.objects import ObjectTracker # noqa: E402
|
||||||
|
from frigate.util import ( # noqa: E402
|
||||||
EventsPerSecond,
|
EventsPerSecond,
|
||||||
SharedMemoryFrameManager,
|
SharedMemoryFrameManager,
|
||||||
draw_box_with_label,
|
draw_box_with_label,
|
||||||
)
|
)
|
||||||
from frigate.video import capture_frames, process_frames, start_or_restart_ffmpeg
|
from frigate.video import ( # noqa: E402
|
||||||
|
capture_frames,
|
||||||
|
process_frames,
|
||||||
|
start_or_restart_ffmpeg,
|
||||||
|
)
|
||||||
|
|
||||||
logging.basicConfig()
|
logging.basicConfig()
|
||||||
logging.root.setLevel(logging.DEBUG)
|
logging.root.setLevel(logging.DEBUG)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user