mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-02-14 00:17:05 +01:00
use dictionary for detectors for sensors
This commit is contained in:
parent
76befc1249
commit
623d138d60
@ -6,7 +6,8 @@ web_port: 5000
|
|||||||
## EdgeTPU requires device as defined here: https://coral.ai/docs/edgetpu/multiple-edgetpu/#using-the-tensorflow-lite-python-api
|
## EdgeTPU requires device as defined here: https://coral.ai/docs/edgetpu/multiple-edgetpu/#using-the-tensorflow-lite-python-api
|
||||||
################
|
################
|
||||||
detectors:
|
detectors:
|
||||||
- type: edgetpu
|
coral:
|
||||||
|
type: edgetpu
|
||||||
device: usb
|
device: usb
|
||||||
|
|
||||||
mqtt:
|
mqtt:
|
||||||
|
@ -86,7 +86,7 @@ class CameraWatchdog(threading.Thread):
|
|||||||
now = datetime.datetime.now().timestamp()
|
now = datetime.datetime.now().timestamp()
|
||||||
|
|
||||||
# check the detection processes
|
# check the detection processes
|
||||||
for detector in self.detectors:
|
for detector in self.detectors.values():
|
||||||
detection_start = detector.detection_start.value
|
detection_start = detector.detection_start.value
|
||||||
if (detection_start > 0.0 and
|
if (detection_start > 0.0 and
|
||||||
now - detection_start > 10):
|
now - detection_start > 10):
|
||||||
@ -186,12 +186,12 @@ def main():
|
|||||||
|
|
||||||
detection_queue = mp.Queue()
|
detection_queue = mp.Queue()
|
||||||
|
|
||||||
detectors = []
|
detectors = {}
|
||||||
for detector in DETECTORS:
|
for name, detector in DETECTORS.items():
|
||||||
if detector['type'] == 'cpu':
|
if detector['type'] == 'cpu':
|
||||||
detectors.append(EdgeTPUProcess(detection_queue, out_events=out_events, tf_device='cpu'))
|
detectors[name] = EdgeTPUProcess(detection_queue, out_events=out_events, tf_device='cpu')
|
||||||
if detector['type'] == 'edgetpu':
|
if detector['type'] == 'edgetpu':
|
||||||
detectors.append(EdgeTPUProcess(detection_queue, out_events=out_events, tf_device=detector['device']))
|
detectors[name] = EdgeTPUProcess(detection_queue, out_events=out_events, tf_device=detector['device'])
|
||||||
|
|
||||||
# create the camera processes
|
# create the camera processes
|
||||||
camera_processes = {}
|
camera_processes = {}
|
||||||
@ -373,13 +373,13 @@ def main():
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stats['detectors'] = []
|
stats['detectors'] = {}
|
||||||
for detector in detectors:
|
for name, detector in detectors.items():
|
||||||
stats['detectors'].append({
|
stats['detectors'][name] = {
|
||||||
'inference_speed': round(detector.avg_inference_speed.value*1000, 2),
|
'inference_speed': round(detector.avg_inference_speed.value*1000, 2),
|
||||||
'detection_start': detector.detection_start.value,
|
'detection_start': detector.detection_start.value,
|
||||||
'pid': detector.detect_process.pid
|
'pid': detector.detect_process.pid
|
||||||
})
|
}
|
||||||
stats['detection_fps'] = round(total_detection_fps, 2)
|
stats['detection_fps'] = round(total_detection_fps, 2)
|
||||||
|
|
||||||
return jsonify(stats)
|
return jsonify(stats)
|
||||||
|
Loading…
Reference in New Issue
Block a user