diart icon indicating copy to clipboard operation
diart copied to clipboard

Add inference lifecycle hooks

Open juanmc2005 opened this issue 3 years ago • 0 comments

Problem

When writing custom models or pipelines, one may want to react to specific inference events, for example before/after benchmarking on a file.

Idea

Add classes RealTimeInferenceHook and BenchmarkHook to define listener interfaces. This can also be used to implement other behavior like progress bars, writing results, etc.

Example

class MyHook(BenchmarkHook):
    def on_finished(results):
        print("Finished!")

benchmark = Benchmark(..., hooks=[MyHook()])

juanmc2005 avatar Oct 04 '22 14:10 juanmc2005