2019-06-05 04:38:41 +02:00
|
|
|
import statistics
|
|
|
|
import numpy as np
|
2020-02-22 15:59:16 +01:00
|
|
|
import time
|
|
|
|
from frigate.edgetpu import ObjectDetector
|
2019-06-05 04:38:41 +02:00
|
|
|
|
2020-02-22 15:59:16 +01:00
|
|
|
object_detector = ObjectDetector()
|
2019-06-05 04:38:41 +02:00
|
|
|
|
|
|
|
frame = np.zeros((300,300,3), np.uint8)
|
2020-02-22 15:59:16 +01:00
|
|
|
input_frame = np.expand_dims(frame, axis=0)
|
2019-06-05 04:38:41 +02:00
|
|
|
|
|
|
|
detection_times = []
|
|
|
|
|
2020-02-22 15:59:16 +01:00
|
|
|
for x in range(0, 100):
|
|
|
|
start = time.monotonic()
|
|
|
|
object_detector.detect_raw(input_frame)
|
|
|
|
detection_times.append(time.monotonic()-start)
|
2019-06-05 04:38:41 +02:00
|
|
|
|
2020-02-22 15:59:16 +01:00
|
|
|
print(f"Average inference time: {statistics.mean(detection_times)*1000:.2f}ms")
|