forked from Github/frigate
Compare commits
38 Commits
v0.5.0
...
v0.5.0-rc6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0f66a8cb41 | ||
|
|
04ef6ac30e | ||
|
|
ab42a9625d | ||
|
|
30ad0e30f8 | ||
|
|
7bad89c9bf | ||
|
|
f077c397f4 | ||
|
|
cc729d83a8 | ||
|
|
c520b81e49 | ||
|
|
9c304391c0 | ||
|
|
9a12b02d22 | ||
|
|
7686c510b3 | ||
|
|
2f5e322d3c | ||
|
|
1cd4c12104 | ||
|
|
1a8b034685 | ||
|
|
da6dc03a57 | ||
|
|
7fa3b70d2d | ||
|
|
1fc5a2bfd4 | ||
|
|
7e84da7dad | ||
|
|
128be72e28 | ||
|
|
aaddedc95c | ||
|
|
ba919fb439 | ||
|
|
b1d563f3c4 | ||
|
|
204d8af5df | ||
|
|
b507a73d79 | ||
|
|
66eeb8b5cb | ||
|
|
efa67067c6 | ||
|
|
aeb036f1a4 | ||
|
|
74c528f9dc | ||
|
|
f2d54bec43 | ||
|
|
f07d57741e | ||
|
|
2c1ec19f98 | ||
|
|
6a9027c002 | ||
|
|
60c15e4419 | ||
|
|
03dbf600aa | ||
|
|
fbbb79b31b | ||
|
|
496c6bc6c4 | ||
|
|
869a81c944 | ||
|
|
5b1884cfb3 |
@@ -38,9 +38,9 @@ RUN apt -qq update && apt -qq install --no-install-recommends -y \
|
||||
&& apt -qq install --no-install-recommends -y \
|
||||
libedgetpu1-max \
|
||||
## Tensorflow lite (python 3.7 only)
|
||||
&& wget -q https://dl.google.com/coral/python/tflite_runtime-2.1.0.post1-cp37-cp37m-linux_x86_64.whl \
|
||||
&& python3.7 -m pip install tflite_runtime-2.1.0.post1-cp37-cp37m-linux_x86_64.whl \
|
||||
&& rm tflite_runtime-2.1.0.post1-cp37-cp37m-linux_x86_64.whl \
|
||||
&& wget -q https://dl.google.com/coral/python/tflite_runtime-2.1.0-cp37-cp37m-linux_x86_64.whl \
|
||||
&& python3.7 -m pip install tflite_runtime-2.1.0-cp37-cp37m-linux_x86_64.whl \
|
||||
&& rm tflite_runtime-2.1.0-cp37-cp37m-linux_x86_64.whl \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& (apt-get autoremove -y; apt-get autoclean -y)
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import multiprocessing as mp
|
||||
import subprocess as sp
|
||||
import numpy as np
|
||||
import logging
|
||||
from flask import Flask, Response, make_response, jsonify, request
|
||||
from flask import Flask, Response, make_response, jsonify
|
||||
import paho.mqtt.client as mqtt
|
||||
|
||||
from frigate.video import track_camera
|
||||
@@ -218,26 +218,21 @@ def main():
|
||||
|
||||
@app.route('/<camera_name>')
|
||||
def mjpeg_feed(camera_name):
|
||||
fps = int(request.args.get('fps', '3'))
|
||||
height = int(request.args.get('h', '360'))
|
||||
if camera_name in CONFIG['cameras']:
|
||||
# return a multipart response
|
||||
return Response(imagestream(camera_name, fps, height),
|
||||
return Response(imagestream(camera_name),
|
||||
mimetype='multipart/x-mixed-replace; boundary=frame')
|
||||
else:
|
||||
return "Camera named {} not found".format(camera_name), 404
|
||||
|
||||
def imagestream(camera_name, fps, height):
|
||||
def imagestream(camera_name):
|
||||
while True:
|
||||
# max out at specified FPS
|
||||
time.sleep(1/fps)
|
||||
# max out at 1 FPS
|
||||
time.sleep(1)
|
||||
frame = object_processor.get_current_frame(camera_name)
|
||||
if frame is None:
|
||||
frame = np.zeros((height,int(height*16/9),3), np.uint8)
|
||||
|
||||
frame = cv2.resize(frame, dsize=(int(height*16/9), height), interpolation=cv2.INTER_LINEAR)
|
||||
frame = np.zeros((720,1280,3), np.uint8)
|
||||
frame = cv2.cvtColor(frame, cv2.COLOR_RGB2BGR)
|
||||
|
||||
ret, jpg = cv2.imencode('.jpg', frame)
|
||||
yield (b'--frame\r\n'
|
||||
b'Content-Type: image/jpeg\r\n\r\n' + jpg.tobytes() + b'\r\n\r\n')
|
||||
|
||||
@@ -75,6 +75,7 @@ def run_detector(detection_queue, avg_speed, start):
|
||||
input_frame = plasma_client.get(object_id, timeout_ms=0)
|
||||
|
||||
if input_frame is plasma.ObjectNotAvailable:
|
||||
plasma_client.put(np.zeros((20,6), np.float32), object_id_out)
|
||||
continue
|
||||
|
||||
# detect and put the output in the plasma store
|
||||
@@ -123,11 +124,7 @@ class RemoteObjectDetector():
|
||||
object_id_detections = plasma.ObjectID(hashlib.sha1(str.encode(f"out-{now}")).digest())
|
||||
self.plasma_client.put(tensor_input, object_id_frame)
|
||||
self.detection_queue.put(now)
|
||||
raw_detections = self.plasma_client.get(object_id_detections, timeout_ms=10000)
|
||||
|
||||
if raw_detections is plasma.ObjectNotAvailable:
|
||||
self.plasma_client.delete([object_id_frame])
|
||||
return detections
|
||||
raw_detections = self.plasma_client.get(object_id_detections)
|
||||
|
||||
for d in raw_detections:
|
||||
if d[1] < threshold:
|
||||
|
||||
Reference in New Issue
Block a user