-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfull_model_to_code_test.py
More file actions
27 lines (27 loc) · 2.21 KB
/
full_model_to_code_test.py
File metadata and controls
27 lines (27 loc) · 2.21 KB
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
import subprocess
# This file is a step by step guide of training, exporting and evaluating a model
# %% First train a model
print("**********************************************************************************************************************************")
print("Starting training...")
print("**********************************************************************************************************************************")
subprocess.run("python train_sc.py", shell=True,executable="/bin/bash", stderr=subprocess.STDOUT)
# This will train a model and save it in the results_journal folder
# %% Now export the model
print("**********************************************************************************************************************************")
print("Starting exporting...")
print("**********************************************************************************************************************************")
subprocess.run("python model_export.py", shell=True, executable="/bin/bash", stderr=subprocess.STDOUT)
# This will export the model to the export_model folder
# %% Now convert the model to C++ code
print("**********************************************************************************************************************************")
print("Starting conversion...")
print("**********************************************************************************************************************************")
subprocess.run("python model_cpp_convert.py", shell=True, executable="/bin/bash", stderr=subprocess.STDOUT)
# This will convert the model to C++ code and save it in the cpp_code folder, and then compile it
# %% Now evaluate the cpp model
print("**********************************************************************************************************************************")
print("Starting evaluation...")
print("**********************************************************************************************************************************")
subprocess.run("python test_sc_cpp_impl.py", shell=True, executable="/bin/bash", stderr=subprocess.STDOUT)
# This will evaluate the cpp model and save the results in the results folder
# Finally, the confusion matrix will be saved in the root folder as a png file