mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
add a benchmark script
This commit is contained in:
parent
2d22a04391
commit
7028b05856
@ -102,5 +102,6 @@ RUN (apt-get autoremove -y; \
|
|||||||
WORKDIR /opt/frigate/
|
WORKDIR /opt/frigate/
|
||||||
ADD frigate frigate/
|
ADD frigate frigate/
|
||||||
COPY detect_objects.py .
|
COPY detect_objects.py .
|
||||||
|
COPY benchmark.py .
|
||||||
|
|
||||||
CMD ["python3", "-u", "detect_objects.py"]
|
CMD ["python3", "-u", "detect_objects.py"]
|
||||||
|
20
benchmark.py
Normal file
20
benchmark.py
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import statistics
|
||||||
|
import numpy as np
|
||||||
|
from edgetpu.detection.engine import DetectionEngine
|
||||||
|
|
||||||
|
# Path to frozen detection graph. This is the actual model that is used for the object detection.
|
||||||
|
PATH_TO_CKPT = '/frozen_inference_graph.pb'
|
||||||
|
|
||||||
|
# Load the edgetpu engine and labels
|
||||||
|
engine = DetectionEngine(PATH_TO_CKPT)
|
||||||
|
|
||||||
|
frame = np.zeros((300,300,3), np.uint8)
|
||||||
|
flattened_frame = np.expand_dims(frame, axis=0).flatten()
|
||||||
|
|
||||||
|
detection_times = []
|
||||||
|
|
||||||
|
for x in range(0, 1000):
|
||||||
|
objects = engine.DetectWithInputTensor(flattened_frame, threshold=0.1, top_k=3)
|
||||||
|
detection_times.append(engine.get_inference_time())
|
||||||
|
|
||||||
|
print("Average inference time: " + str(statistics.mean(detection_times)))
|
Loading…
Reference in New Issue
Block a user