tum-ei-eda / mlonmcu

Tool for the deployment and analysis of TinyML applications on TFLM and MicroTVM backends
Apache License 2.0
29 stars 12 forks source link

Implement postprocesses #6

Closed PhilippvK closed 2 years ago

PhilippvK commented 2 years ago

Postprocesses are intended to run after a session to do i.e. one of the following things on the resulting dataframe:

PhilippvK commented 2 years ago

I drafted a bit of markdown for the Postprocess documentation to show my ideas:

Postprocesses

Postprocesses are a feature which was recently added to MLonMCU which is intended to help with automating common tasks for benchmarking and visualizations. These processes mainly operate on the Rows and columns of the report generated after a completed run or session. Their complexity can vary from very minimal utilities to powerful evaluation scripts.

Stages

Currently postprocesses can be applied at two different stages:

In the future it might be possible to also insert postprocesses at earlier stages.

Examples

Base Types

There are a few abstract base classes integrated in MLonMCU:

Usage of Postprocesses

Implement custom postprocesses

To extend the list of predefined post-processes with a custom implementation a Python class has to be developed as follows:

TODO

from mlonmcu.postproces import Postprocess, ProcessStage

class MyPostprocess(Postprocess):

    def __init__(self, features=None, config=None):
        super().__init__("foo", stage=ProcessStage.SESSION, features=features, config=config)

    def process(self, data):
        pass

It is also possible to inherit another base-class such "AggregatePostprocess" to reuse some of their functionalities.

To use the newly implemented process, it needs to be registered. There are two approaches to do so:

PhilippvK commented 2 years ago

Done. I just forgot to add POSTRROCESS.md to the docs...