From a8556a729b94f534466a4f52b85ad4be7cd7da81 Mon Sep 17 00:00:00 2001 From: Carl Elkins Date: Sat, 29 Aug 2020 22:42:41 +0000 Subject: [PATCH] Added support for PCIe TPU, as well as USB Also added message showing which found --- frigate/edgetpu.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/frigate/edgetpu.py b/frigate/edgetpu.py index a5a216deb..dd3592441 100644 --- a/frigate/edgetpu.py +++ b/frigate/edgetpu.py @@ -31,9 +31,14 @@ class ObjectDetector(): def __init__(self): edge_tpu_delegate = None try: - edge_tpu_delegate = load_delegate('libedgetpu.so.1.0') + edge_tpu_delegate = load_delegate('libedgetpu.so.1.0', {"device": "usb"}) + print("USB TPU found") except ValueError: - print("No EdgeTPU detected. Falling back to CPU.") + try: + edge_tpu_delegate = load_delegate('libedgetpu.so.1.0', {"device": "pci:0"}) + print("PCIe TPU found") + except ValueError: + print("No EdgeTPU detected. Falling back to CPU.") if edge_tpu_delegate is None: self.interpreter = tflite.Interpreter( @@ -139,4 +144,4 @@ class RemoteObjectDetector(): )) self.plasma_client.delete([object_id_frame, object_id_detections]) self.fps.update() - return detections \ No newline at end of file + return detections