forked from AI-performance/embedded-ai.bench
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbench.py
36 lines (25 loc) · 797 Bytes
/
bench.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/python3
# -*- coding: UTF-8 -*-
from core.engine import Engine
from core.global_config import create_config
def bench(name):
if name is None:
return
config_dict = create_config(name)
engine = Engine(config_dict)
model_dict = engine.prepare_models()
device_dict = engine.prepare_devices()
engine.set_config("model_dict", model_dict)
engine.set_config("device_dict", device_dict)
engine.prepare_models_for_devices()
engine.prepare_benchmark_assets_for_devices()
bench_dict = engine.run_bench()
bench_str_list = engine.generate_benchmark_summary(bench_dict)
engine.write_list_to_file(bench_str_list)
def main():
bench("tnn")
bench("ncnn")
bench("mnn")
bench("tflite")
if __name__ == "__main__":
main()