sort imports

This commit is contained in:
Blake Blackshear 2020-11-04 06:31:25 -06:00
parent 3a3cb24631
commit 03c855ecbe
13 changed files with 83 additions and 69 deletions

View File

@ -1,6 +1,7 @@
import faulthandler; faulthandler.enable() import faulthandler; faulthandler.enable()
import sys import sys
import threading import threading
threading.current_thread().name = "frigate" threading.current_thread().name = "frigate"
from frigate.app import FrigateApp from frigate.app import FrigateApp

View File

@ -1,14 +1,13 @@
import base64 import base64
import json import json
import os import os
import yaml
from typing import Dict from typing import Dict
import cv2 import cv2
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import numpy as np import numpy as np
import voluptuous as vol import voluptuous as vol
import yaml
DETECTORS_SCHEMA = vol.Schema( DETECTORS_SCHEMA = vol.Schema(
{ {
@ -593,4 +592,4 @@ class FrigateConfig():
@property @property
def cameras(self) -> Dict[str, CameraConfig]: def cameras(self) -> Dict[str, CameraConfig]:
return self._cameras return self._cameras

View File

@ -1,13 +1,14 @@
import os
import time
import psutil
import threading
import logging
from collections import defaultdict
import json
import datetime import datetime
import subprocess as sp import json
import logging
import os
import queue import queue
import subprocess as sp
import threading
import time
from collections import defaultdict
import psutil
from frigate.models import Event from frigate.models import Event

View File

@ -3,10 +3,8 @@ import time
import cv2 import cv2
import numpy as np import numpy as np
from flask import (Blueprint, Flask, Response, current_app, jsonify,
from flask import ( make_response, request)
Flask, Blueprint, jsonify, request, Response, current_app, make_response
)
from peewee import SqliteDatabase from peewee import SqliteDatabase
from playhouse.shortcuts import model_to_dict from playhouse.shortcuts import model_to_dict

View File

@ -3,6 +3,7 @@ import logging
import threading import threading
from logging import handlers from logging import handlers
def listener_configurer(): def listener_configurer():
root = logging.getLogger() root = logging.getLogger()
console_handler = logging.StreamHandler() console_handler = logging.StreamHandler()

View File

@ -1,6 +1,7 @@
from peewee import * from peewee import *
from playhouse.sqlite_ext import * from playhouse.sqlite_ext import *
class Event(Model): class Event(Model):
id = CharField(null=False, primary_key=True, max_length=30) id = CharField(null=False, primary_key=True, max_length=30)
label = CharField(index=True, max_length=20) label = CharField(index=True, max_length=20)
@ -9,4 +10,4 @@ class Event(Model):
end_time = DateTimeField() end_time = DateTimeField()
top_score = FloatField() top_score = FloatField()
false_positive = BooleanField() false_positive = BooleanField()
zones = JSONField() zones = JSONField()

View File

@ -2,6 +2,7 @@ import cv2
import imutils import imutils
import numpy as np import numpy as np
class MotionDetector(): class MotionDetector():
def __init__(self, frame_shape, mask, resize_factor=4): def __init__(self, frame_shape, mask, resize_factor=4):
self.frame_shape = frame_shape self.frame_shape = frame_shape
@ -79,4 +80,4 @@ class MotionDetector():
cv2.accumulateWeighted(resized_frame, self.avg_frame, 0.2) cv2.accumulateWeighted(resized_frame, self.avg_frame, 0.2)
self.motion_frame_count = 0 self.motion_frame_count = 0
return motion_boxes return motion_boxes

View File

@ -1,7 +1,8 @@
import logging import logging
import paho.mqtt.client as mqtt
import threading import threading
import paho.mqtt.client as mqtt
from frigate.config import MqttConfig from frigate.config import MqttConfig
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -28,4 +29,4 @@ def create_mqtt_client(config: MqttConfig):
client.username_pw_set(config.user, password=config.password) client.username_pw_set(config.user, password=config.password)
client.connect(config.host, config.port, 60) client.connect(config.host, config.port, 60)
client.loop_start() client.loop_start()
return client return client

View File

@ -1,22 +1,23 @@
import json
import hashlib
import datetime
import time
import copy import copy
import cv2 import datetime
import threading import hashlib
import itertools
import json
import logging import logging
import queue import queue
import copy import threading
import numpy as np import time
from collections import Counter, defaultdict 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 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__) logger = logging.getLogger(__name__)

View File

@ -1,16 +1,19 @@
import time
import datetime
import threading
import cv2
import itertools
import copy import copy
import numpy as np import datetime
import itertools
import multiprocessing as mp
import random import random
import string import string
import multiprocessing as mp import threading
import time
from collections import defaultdict from collections import defaultdict
import cv2
import numpy as np
from scipy.spatial import distance as dist 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(): class ObjectTracker():
def __init__(self, max_disappeared): def __init__(self, max_disappeared):

View File

@ -1,19 +1,21 @@
from abc import ABC, abstractmethod
import datetime
import time
import signal
import traceback
import collections import collections
import json import datetime
import numpy as np
import subprocess as sp
import cv2
import threading
import matplotlib.pyplot as plt
import hashlib 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 multiprocessing import shared_memory
from typing import AnyStr 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'): 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: if color is None:
color = (0,0,255) color = (0,0,255)
@ -243,4 +245,4 @@ class SharedMemoryFrameManager(FrameManager):
if name in self.shm_store: if name in self.shm_store:
self.shm_store[name].close() self.shm_store[name].close()
self.shm_store[name].unlink() self.shm_store[name].unlink()
del self.shm_store[name] del self.shm_store[name]

View File

@ -1,25 +1,30 @@
import os import base64
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 copy import copy
import ctypes
import datetime
import itertools import itertools
import json import json
import base64 import logging
from typing import Dict, List import multiprocessing as mp
import os
import queue
import subprocess as sp
import threading
import time
from collections import defaultdict from collections import defaultdict
from typing import Dict, List
import cv2
import numpy as np
from frigate.config import CameraConfig 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.edgetpu import RemoteObjectDetector
from frigate.motion import MotionDetector 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__) logger = logging.getLogger(__name__)

View File

@ -1,7 +1,7 @@
import datetime import datetime
import logging import logging
import time
import threading import threading
import time
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)