mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-02 01:05:20 +03:00
downgrade to python3.6
This commit is contained in:
parent
ec47141c82
commit
ef5f69ecda
@ -1,6 +1,7 @@
|
||||
import json
|
||||
import logging
|
||||
import multiprocessing as mp
|
||||
import shared_memory
|
||||
import os
|
||||
import signal
|
||||
import sys
|
||||
@ -41,7 +42,7 @@ class FrigateApp:
|
||||
self.detection_queue = mp.Queue()
|
||||
self.detectors: Dict[str, EdgeTPUProcess] = {}
|
||||
self.detection_out_events: Dict[str, mp.Event] = {}
|
||||
self.detection_shms: List[mp.shared_memory.SharedMemory] = []
|
||||
self.detection_shms: List[shared_memory.SharedMemory] = []
|
||||
self.log_queue = mp.Queue()
|
||||
self.camera_metrics = {}
|
||||
|
||||
@ -154,20 +155,20 @@ class FrigateApp:
|
||||
self.detection_out_events[name] = mp.Event()
|
||||
|
||||
try:
|
||||
shm_in = mp.shared_memory.SharedMemory(
|
||||
shm_in = shared_memory.SharedMemory(
|
||||
name=name,
|
||||
create=True,
|
||||
size=self.config.model.height * self.config.model.width * 3,
|
||||
)
|
||||
except FileExistsError:
|
||||
shm_in = mp.shared_memory.SharedMemory(name=name)
|
||||
shm_in = shared_memory.SharedMemory(name=name)
|
||||
|
||||
try:
|
||||
shm_out = mp.shared_memory.SharedMemory(
|
||||
shm_out = shared_memory.SharedMemory(
|
||||
name=f"out-{name}", create=True, size=20 * 6 * 4
|
||||
)
|
||||
except FileExistsError:
|
||||
shm_out = mp.shared_memory.SharedMemory(name=f"out-{name}")
|
||||
shm_out = shared_memory.SharedMemory(name=f"out-{name}")
|
||||
|
||||
self.detection_shms.append(shm_in)
|
||||
self.detection_shms.append(shm_out)
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
@ -761,7 +759,7 @@ class ModelConfig(FrigateBaseModel):
|
||||
return self._merged_labelmap
|
||||
|
||||
@property
|
||||
def colormap(self) -> Dict[int, tuple[int, int, int]]:
|
||||
def colormap(self) -> Dict[int, Tuple[int, int, int]]:
|
||||
return self._colormap
|
||||
|
||||
def __init__(self, **config):
|
||||
@ -850,7 +848,7 @@ class FrigateConfig(FrigateBaseModel):
|
||||
)
|
||||
|
||||
@property
|
||||
def runtime_config(self) -> FrigateConfig:
|
||||
def runtime_config(self):
|
||||
"""Merge camera config with globals."""
|
||||
config = self.copy(deep=True)
|
||||
|
||||
|
||||
@ -7,8 +7,10 @@ import signal
|
||||
import threading
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import Dict
|
||||
import shared_memory
|
||||
|
||||
import numpy as np
|
||||
# TensorRT https://github.com/NobuoTsukamoto/tensorrt-examples/blob/main/python/detection/README.md
|
||||
import tflite_runtime.interpreter as tflite
|
||||
from setproctitle import setproctitle
|
||||
from tflite_runtime.interpreter import load_delegate
|
||||
@ -159,7 +161,7 @@ def run_detector(
|
||||
|
||||
outputs = {}
|
||||
for name in out_events.keys():
|
||||
out_shm = mp.shared_memory.SharedMemory(name=f"out-{name}", create=False)
|
||||
out_shm = shared_memory.SharedMemory(name=f"out-{name}", create=False)
|
||||
out_np = np.ndarray((20, 6), dtype=np.float32, buffer=out_shm.buf)
|
||||
outputs[name] = {"shm": out_shm, "np": out_np}
|
||||
|
||||
@ -248,11 +250,11 @@ class RemoteObjectDetector:
|
||||
self.fps = EventsPerSecond()
|
||||
self.detection_queue = detection_queue
|
||||
self.event = event
|
||||
self.shm = mp.shared_memory.SharedMemory(name=self.name, create=False)
|
||||
self.shm = shared_memory.SharedMemory(name=self.name, create=False)
|
||||
self.np_shm = np.ndarray(
|
||||
(1, model_shape[0], model_shape[1], 3), dtype=np.uint8, buffer=self.shm.buf
|
||||
)
|
||||
self.out_shm = mp.shared_memory.SharedMemory(
|
||||
self.out_shm = shared_memory.SharedMemory(
|
||||
name=f"out-{self.name}", create=False
|
||||
)
|
||||
self.out_np_shm = np.ndarray((20, 6), dtype=np.float32, buffer=self.out_shm.buf)
|
||||
|
||||
@ -608,7 +608,8 @@ def recording_clip(camera, start_ts, end_ts):
|
||||
ffmpeg_cmd,
|
||||
input="\n".join(playlist_lines),
|
||||
encoding="ascii",
|
||||
capture_output=True,
|
||||
stdout=sp.PIPE,
|
||||
stderr=sp.PIPE,
|
||||
)
|
||||
if p.returncode != 0:
|
||||
logger.error(p.stderr)
|
||||
|
||||
@ -7,7 +7,6 @@ import queue
|
||||
import signal
|
||||
import subprocess as sp
|
||||
import threading
|
||||
from multiprocessing import shared_memory
|
||||
from wsgiref.simple_server import make_server
|
||||
from frigate.log import LogPipe
|
||||
|
||||
@ -37,7 +36,7 @@ class FFMpegConverter:
|
||||
# ffmpeg_cmd = f"gst-launch-1.0 fdsrc ! video/x-raw, width={in_width}, height={in_height}, format=I420 ! nvvideoconvert ! omxh264enc ! h264parse ! mpegtsmux ! fdsink".split(
|
||||
# " "
|
||||
# )
|
||||
|
||||
|
||||
|
||||
self.logpipe = LogPipe(
|
||||
"ffmpeg.converter", logging.ERROR)
|
||||
|
||||
@ -41,7 +41,7 @@ def get_frame_shape(source):
|
||||
"json",
|
||||
source,
|
||||
]
|
||||
p = sp.run(ffprobe_cmd, capture_output=True)
|
||||
p = sp.run(ffprobe_cmd, stdout=sp.PIPE, stderr=sp.PIPE)
|
||||
info = json.loads(p.stdout)
|
||||
|
||||
video_info = [s for s in info["streams"] if s["codec_type"] == "video"][0]
|
||||
|
||||
@ -94,7 +94,7 @@ class RecordingMaintainer(threading.Thread):
|
||||
"default=noprint_wrappers=1:nokey=1",
|
||||
f"{cache_path}",
|
||||
]
|
||||
p = sp.run(ffprobe_cmd, capture_output=True)
|
||||
p = sp.run(ffprobe_cmd, stdout=sp.PIPE, stderr=sp.PIPE)
|
||||
if p.returncode == 0:
|
||||
duration = float(p.stdout.decode().strip())
|
||||
end_time = start_time + datetime.timedelta(seconds=duration)
|
||||
@ -284,7 +284,8 @@ class RecordingCleanup(threading.Thread):
|
||||
logger.debug(f"Oldest recording in the db: {oldest_timestamp}")
|
||||
process = sp.run(
|
||||
["find", RECORD_DIR, "-type", "f", "!", "-newermt", f"@{oldest_timestamp}"],
|
||||
capture_output=True,
|
||||
stdout=sp.PIPE,
|
||||
stderr=sp.PIPE,
|
||||
text=True,
|
||||
)
|
||||
files_to_check = process.stdout.splitlines()
|
||||
|
||||
@ -11,7 +11,8 @@ import threading
|
||||
import time
|
||||
import traceback
|
||||
from abc import ABC, abstractmethod
|
||||
from multiprocessing import shared_memory
|
||||
#from multiprocessing import shared_memory
|
||||
import shared_memory
|
||||
from typing import AnyStr
|
||||
|
||||
import cv2
|
||||
|
||||
Loading…
Reference in New Issue
Block a user