Skip to content

Commit

Permalink
introduce new feature: GenRefLabels
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippvK committed May 27, 2024
1 parent d040b1b commit 71e7280
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions mlonmcu/feature/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -2307,6 +2307,47 @@ def get_frontend_config(self, frontend):
}


@register_feature("gen_ref_labels", depends=["gen_data"])
class GenRefLabels(FrontendFeature): # TODO: use custom stage instead of LOAD
"""TODO"""

DEFAULTS = {
**FeatureBase.DEFAULTS,
"mode": "file", # Allowed: file, model
"file": "auto", # Only relevant if mode=file
"fmt": "npy", # Allowed: npy, npz, txt
}

def __init__(self, features=None, config=None):
super().__init__("gen_ref_labels", features=features, config=config)

@property
def mode(self):
value = self.config["mode"]
assert value in ["file", "model"]
return value

@property
def file(self):
value = self.config["file"]
return value

@property
def fmt(self):
value = self.config["fmt"]
assert value in ["npy", "npz"]
return value

def get_frontend_config(self, frontend):
assert frontend in ["tflite"]
return {
f"{frontend}.gen_ref_labels": self.enabled,
f"{frontend}.gen_ref_labels_mode": self.mode,
f"{frontend}.gen_ref_labels_file": self.file,
f"{frontend}.gen_ref_labels_fmt": self.fmt,
}


@register_feature("set_inputs")
class SetInputs(PlatformFeature): # TODO: use custom stage instead of LOAD
"""TODO"""
Expand Down

0 comments on commit 71e7280

Please sign in to comment.