mirror of
				https://github.com/blakeblackshear/frigate.git
				synced 2025-10-27 10:52:11 +01:00 
			
		
		
		
	sort imports
This commit is contained in:
		
							parent
							
								
									eac81136d2
								
							
						
					
					
						commit
						8b8f5b5c40
					
				@ -1,6 +1,7 @@
 | 
			
		||||
import faulthandler; faulthandler.enable()
 | 
			
		||||
import sys
 | 
			
		||||
import threading
 | 
			
		||||
 | 
			
		||||
threading.current_thread().name = "frigate"
 | 
			
		||||
 | 
			
		||||
from frigate.app import FrigateApp
 | 
			
		||||
 | 
			
		||||
@ -1,14 +1,13 @@
 | 
			
		||||
import base64
 | 
			
		||||
import json
 | 
			
		||||
import os
 | 
			
		||||
import yaml
 | 
			
		||||
 | 
			
		||||
from typing import Dict
 | 
			
		||||
 | 
			
		||||
import cv2
 | 
			
		||||
import matplotlib.pyplot as plt
 | 
			
		||||
import numpy as np
 | 
			
		||||
import voluptuous as vol
 | 
			
		||||
import yaml
 | 
			
		||||
 | 
			
		||||
DETECTORS_SCHEMA = vol.Schema(
 | 
			
		||||
    {
 | 
			
		||||
@ -593,4 +592,4 @@ class FrigateConfig():
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
    def cameras(self) -> Dict[str, CameraConfig]:
 | 
			
		||||
        return self._cameras
 | 
			
		||||
        return self._cameras
 | 
			
		||||
 | 
			
		||||
@ -1,13 +1,14 @@
 | 
			
		||||
import os
 | 
			
		||||
import time
 | 
			
		||||
import psutil
 | 
			
		||||
import threading
 | 
			
		||||
import logging
 | 
			
		||||
from collections import defaultdict
 | 
			
		||||
import json
 | 
			
		||||
import datetime
 | 
			
		||||
import subprocess as sp
 | 
			
		||||
import json
 | 
			
		||||
import logging
 | 
			
		||||
import os
 | 
			
		||||
import queue
 | 
			
		||||
import subprocess as sp
 | 
			
		||||
import threading
 | 
			
		||||
import time
 | 
			
		||||
from collections import defaultdict
 | 
			
		||||
 | 
			
		||||
import psutil
 | 
			
		||||
 | 
			
		||||
from frigate.models import Event
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -3,10 +3,8 @@ import time
 | 
			
		||||
 | 
			
		||||
import cv2
 | 
			
		||||
import numpy as np
 | 
			
		||||
 | 
			
		||||
from flask import (
 | 
			
		||||
    Flask, Blueprint, jsonify, request, Response, current_app, make_response
 | 
			
		||||
)
 | 
			
		||||
from flask import (Blueprint, Flask, Response, current_app, jsonify,
 | 
			
		||||
                   make_response, request)
 | 
			
		||||
from peewee import SqliteDatabase
 | 
			
		||||
from playhouse.shortcuts import model_to_dict
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -3,6 +3,7 @@ import logging
 | 
			
		||||
import threading
 | 
			
		||||
from logging import handlers
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def listener_configurer():
 | 
			
		||||
    root = logging.getLogger()
 | 
			
		||||
    console_handler = logging.StreamHandler()
 | 
			
		||||
 | 
			
		||||
@ -1,6 +1,7 @@
 | 
			
		||||
from peewee import *
 | 
			
		||||
from playhouse.sqlite_ext import *
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Event(Model):
 | 
			
		||||
    id = CharField(null=False, primary_key=True, max_length=30)
 | 
			
		||||
    label = CharField(index=True, max_length=20)
 | 
			
		||||
@ -9,4 +10,4 @@ class Event(Model):
 | 
			
		||||
    end_time = DateTimeField()
 | 
			
		||||
    top_score = FloatField()
 | 
			
		||||
    false_positive = BooleanField()
 | 
			
		||||
    zones = JSONField()
 | 
			
		||||
    zones = JSONField()
 | 
			
		||||
 | 
			
		||||
@ -2,6 +2,7 @@ import cv2
 | 
			
		||||
import imutils
 | 
			
		||||
import numpy as np
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class MotionDetector():
 | 
			
		||||
    def __init__(self, frame_shape, mask, resize_factor=4):
 | 
			
		||||
        self.frame_shape = frame_shape
 | 
			
		||||
@ -79,4 +80,4 @@ class MotionDetector():
 | 
			
		||||
            cv2.accumulateWeighted(resized_frame, self.avg_frame, 0.2)
 | 
			
		||||
            self.motion_frame_count = 0
 | 
			
		||||
 | 
			
		||||
        return motion_boxes
 | 
			
		||||
        return motion_boxes
 | 
			
		||||
 | 
			
		||||
@ -1,7 +1,8 @@
 | 
			
		||||
import logging
 | 
			
		||||
import paho.mqtt.client as mqtt
 | 
			
		||||
import threading
 | 
			
		||||
 | 
			
		||||
import paho.mqtt.client as mqtt
 | 
			
		||||
 | 
			
		||||
from frigate.config import MqttConfig
 | 
			
		||||
 | 
			
		||||
logger = logging.getLogger(__name__)
 | 
			
		||||
@ -28,4 +29,4 @@ def create_mqtt_client(config: MqttConfig):
 | 
			
		||||
        client.username_pw_set(config.user, password=config.password)
 | 
			
		||||
    client.connect(config.host, config.port, 60)
 | 
			
		||||
    client.loop_start()
 | 
			
		||||
    return client
 | 
			
		||||
    return client
 | 
			
		||||
 | 
			
		||||
@ -1,22 +1,23 @@
 | 
			
		||||
import json
 | 
			
		||||
import hashlib
 | 
			
		||||
import datetime
 | 
			
		||||
import time
 | 
			
		||||
import copy
 | 
			
		||||
import cv2
 | 
			
		||||
import threading
 | 
			
		||||
import datetime
 | 
			
		||||
import hashlib
 | 
			
		||||
import itertools
 | 
			
		||||
import json
 | 
			
		||||
import logging
 | 
			
		||||
import queue
 | 
			
		||||
import copy
 | 
			
		||||
import numpy as np
 | 
			
		||||
import threading
 | 
			
		||||
import time
 | 
			
		||||
from collections import Counter, defaultdict
 | 
			
		||||
import itertools
 | 
			
		||||
import matplotlib.pyplot as plt
 | 
			
		||||
from frigate.util import draw_box_with_label, SharedMemoryFrameManager
 | 
			
		||||
from frigate.edgetpu import load_labels
 | 
			
		||||
from frigate.config import CameraConfig
 | 
			
		||||
from typing import Callable, Dict
 | 
			
		||||
from statistics import mean, median
 | 
			
		||||
from typing import Callable, Dict
 | 
			
		||||
 | 
			
		||||
import cv2
 | 
			
		||||
import matplotlib.pyplot as plt
 | 
			
		||||
import numpy as np
 | 
			
		||||
 | 
			
		||||
from frigate.config import CameraConfig
 | 
			
		||||
from frigate.edgetpu import load_labels
 | 
			
		||||
from frigate.util import SharedMemoryFrameManager, draw_box_with_label
 | 
			
		||||
 | 
			
		||||
logger = logging.getLogger(__name__)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,16 +1,19 @@
 | 
			
		||||
import time
 | 
			
		||||
import datetime
 | 
			
		||||
import threading
 | 
			
		||||
import cv2
 | 
			
		||||
import itertools
 | 
			
		||||
import copy
 | 
			
		||||
import numpy as np
 | 
			
		||||
import datetime
 | 
			
		||||
import itertools
 | 
			
		||||
import multiprocessing as mp
 | 
			
		||||
import random
 | 
			
		||||
import string
 | 
			
		||||
import multiprocessing as mp
 | 
			
		||||
import threading
 | 
			
		||||
import time
 | 
			
		||||
from collections import defaultdict
 | 
			
		||||
 | 
			
		||||
import cv2
 | 
			
		||||
import numpy as np
 | 
			
		||||
from scipy.spatial import distance as dist
 | 
			
		||||
from frigate.util import draw_box_with_label, calculate_region
 | 
			
		||||
 | 
			
		||||
from frigate.util import calculate_region, draw_box_with_label
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class ObjectTracker():
 | 
			
		||||
    def __init__(self, max_disappeared):
 | 
			
		||||
 | 
			
		||||
@ -1,19 +1,21 @@
 | 
			
		||||
from abc import ABC, abstractmethod
 | 
			
		||||
import datetime
 | 
			
		||||
import time
 | 
			
		||||
import signal
 | 
			
		||||
import traceback
 | 
			
		||||
import collections
 | 
			
		||||
import json
 | 
			
		||||
import numpy as np
 | 
			
		||||
import subprocess as sp
 | 
			
		||||
import cv2
 | 
			
		||||
import threading
 | 
			
		||||
import matplotlib.pyplot as plt
 | 
			
		||||
import datetime
 | 
			
		||||
import hashlib
 | 
			
		||||
import json
 | 
			
		||||
import signal
 | 
			
		||||
import subprocess as sp
 | 
			
		||||
import threading
 | 
			
		||||
import time
 | 
			
		||||
import traceback
 | 
			
		||||
from abc import ABC, abstractmethod
 | 
			
		||||
from multiprocessing import shared_memory
 | 
			
		||||
from typing import AnyStr
 | 
			
		||||
 | 
			
		||||
import cv2
 | 
			
		||||
import matplotlib.pyplot as plt
 | 
			
		||||
import numpy as np
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def draw_box_with_label(frame, x_min, y_min, x_max, y_max, label, info, thickness=2, color=None, position='ul'):
 | 
			
		||||
    if color is None:
 | 
			
		||||
        color = (0,0,255)
 | 
			
		||||
@ -243,4 +245,4 @@ class SharedMemoryFrameManager(FrameManager):
 | 
			
		||||
        if name in self.shm_store:
 | 
			
		||||
            self.shm_store[name].close()
 | 
			
		||||
            self.shm_store[name].unlink()
 | 
			
		||||
            del self.shm_store[name]
 | 
			
		||||
            del self.shm_store[name]
 | 
			
		||||
 | 
			
		||||
@ -1,25 +1,30 @@
 | 
			
		||||
import os
 | 
			
		||||
import time
 | 
			
		||||
import datetime
 | 
			
		||||
import cv2
 | 
			
		||||
import queue
 | 
			
		||||
import threading
 | 
			
		||||
import logging
 | 
			
		||||
import ctypes
 | 
			
		||||
import multiprocessing as mp
 | 
			
		||||
import subprocess as sp
 | 
			
		||||
import numpy as np
 | 
			
		||||
import base64
 | 
			
		||||
import copy
 | 
			
		||||
import ctypes
 | 
			
		||||
import datetime
 | 
			
		||||
import itertools
 | 
			
		||||
import json
 | 
			
		||||
import base64
 | 
			
		||||
from typing import Dict, List
 | 
			
		||||
import logging
 | 
			
		||||
import multiprocessing as mp
 | 
			
		||||
import os
 | 
			
		||||
import queue
 | 
			
		||||
import subprocess as sp
 | 
			
		||||
import threading
 | 
			
		||||
import time
 | 
			
		||||
from collections import defaultdict
 | 
			
		||||
from typing import Dict, List
 | 
			
		||||
 | 
			
		||||
import cv2
 | 
			
		||||
import numpy as np
 | 
			
		||||
 | 
			
		||||
from frigate.config import CameraConfig
 | 
			
		||||
from frigate.util import draw_box_with_label, yuv_region_2_rgb, area, calculate_region, clipped, intersection_over_union, intersection, EventsPerSecond, listen, FrameManager, SharedMemoryFrameManager
 | 
			
		||||
from frigate.objects import ObjectTracker
 | 
			
		||||
from frigate.edgetpu import RemoteObjectDetector
 | 
			
		||||
from frigate.motion import MotionDetector
 | 
			
		||||
from frigate.objects import ObjectTracker
 | 
			
		||||
from frigate.util import (EventsPerSecond, FrameManager,
 | 
			
		||||
                          SharedMemoryFrameManager, area, calculate_region,
 | 
			
		||||
                          clipped, draw_box_with_label, intersection,
 | 
			
		||||
                          intersection_over_union, listen, yuv_region_2_rgb)
 | 
			
		||||
 | 
			
		||||
logger = logging.getLogger(__name__)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,7 +1,7 @@
 | 
			
		||||
import datetime
 | 
			
		||||
import logging
 | 
			
		||||
import time
 | 
			
		||||
import threading
 | 
			
		||||
import time
 | 
			
		||||
 | 
			
		||||
logger = logging.getLogger(__name__)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user