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