26 lines
981 B
Python
26 lines
981 B
Python
"""
|
|
Runs the simulator to test an input image.
|
|
"""
|
|
import python_flow.emulator as emu
|
|
import python_flow.postprocess as post
|
|
import python_flow.preprocess as pre
|
|
|
|
def run_simulator(user_config, input_image, pre_input=None):
|
|
"""Performs testing on the list of input images.
|
|
|
|
Runs the user's desired preprocess function, inference on the user's model,
|
|
and the user's desired postprocess function.
|
|
|
|
Arguments:
|
|
user_config: TestConfig class that holds the user's input config and options
|
|
input_image: List of paths to the test images (multiple for fusion)
|
|
pre_input: Output passed in from a previous stage needed for this preprocess
|
|
"""
|
|
user_config.update_paths(input_image)
|
|
|
|
pre_results, other_data = pre.preprocess_main(user_config.config, pre_input)
|
|
inf_results = emu.emulator_main(user_config.config, pre_results)
|
|
post_results = post.postprocess_main(user_config.config, other_data, inf_results)
|
|
|
|
return post_results
|