downgrade to python3.6

This commit is contained in:
YS 2021-12-15 22:44:03 +03:00
parent 93edf4eee3
commit d90f239747
8 changed files with 20 additions and 17 deletions

View File

@ -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 = {}
@ -163,20 +164,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)

View File

@ -1,5 +1,3 @@
from __future__ import annotations
import json
import logging
import os
@ -868,7 +866,7 @@ class FrigateConfig(FrigateBaseModel):
)
@property
def runtime_config(self) -> FrigateConfig:
def runtime_config(self):
"""Merge camera config with globals."""
config = self.copy(deep=True)

View File

@ -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
@ -139,7 +141,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}
@ -228,11 +230,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)

View File

@ -610,7 +610,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)

View File

@ -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)

View File

@ -502,7 +502,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()

View File

@ -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

View File

@ -44,7 +44,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]