-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2d22a04
commit 7028b05
Showing
2 changed files
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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))) |