Added support for PCIe TPU, as well as USB

Also added message showing which found
This commit is contained in:
Carl Elkins 2020-08-29 22:42:41 +00:00 committed by Blake Blackshear
parent 068df3ef2d
commit a8556a729b

View File

@ -31,7 +31,12 @@ class ObjectDetector():
def __init__(self): def __init__(self):
edge_tpu_delegate = None edge_tpu_delegate = None
try: 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:
try:
edge_tpu_delegate = load_delegate('libedgetpu.so.1.0', {"device": "pci:0"})
print("PCIe TPU found")
except ValueError: except ValueError:
print("No EdgeTPU detected. Falling back to CPU.") print("No EdgeTPU detected. Falling back to CPU.")