Created
May 4, 2019 07:45
-
-
Save Tony607/05e74058dedfcfb5f4e8e025552207e5 to your computer and use it in GitHub Desktop.
How to run Keras model on RK3399Pro | DLology
This file contains hidden or 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
import time | |
times = [] | |
# Run inference 20 times and do the average. | |
for i in range(20): | |
start_time = time.time() | |
# Use the API internal call directly. | |
results = rknn.rknn_base.inference( | |
inputs=[img], data_type="uint8", data_format="nhwc", outputs=None | |
) | |
# Alternatively, use the external API call. | |
# outputs = rknn.inference(inputs=[img]) | |
delta = time.time() - start_time | |
times.append(delta) | |
# Calculate the average time for inference. | |
mean_delta = np.array(times).mean() | |
fps = 1 / mean_delta | |
print("average(sec):{:.3f},fps:{:.2f}".format(mean_delta, fps)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment