From 357b6f9b07fe1be8ed8c507588da8f76ff9cfbe7 Mon Sep 17 00:00:00 2001 From: Ibrahim Abdelkader Date: Sun, 14 Jul 2024 23:44:37 +0200 Subject: [PATCH] modules/py_ml: Fix model kwargs. (#2280) * modules/py_ml: Fix model kwargs. --- scripts/libraries/ml/ml/model.py | 2 +- src/omv/modules/py_ml.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/libraries/ml/ml/model.py b/scripts/libraries/ml/ml/model.py index 2b7f638c1..5b85e88c1 100644 --- a/scripts/libraries/ml/ml/model.py +++ b/scripts/libraries/ml/ml/model.py @@ -11,7 +11,7 @@ from ml.preprocessing import Normalization class Model(uml.Model): def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) + super().__init__(*args, kwargs.get("load_to_fb", False)) def predict(self, args, **kwargs): args = [Normalization()(x) if isinstance(x, image.Image) else x for x in args] diff --git a/src/omv/modules/py_ml.c b/src/omv/modules/py_ml.c index c3264b003..c400b61fb 100644 --- a/src/omv/modules/py_ml.c +++ b/src/omv/modules/py_ml.c @@ -266,7 +266,7 @@ mp_obj_t py_ml_model_make_new(const mp_obj_type_t *type, size_t n_args, size_t n enum { ARG_path, ARG_load_to_fb }; static const mp_arg_t allowed_args[] = { { MP_QSTR_path, MP_ARG_REQUIRED | MP_ARG_OBJ }, - { MP_QSTR_load_to_fb, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_bool = false } }, + { MP_QSTR_load_to_fb, MP_ARG_REQUIRED | MP_ARG_BOOL }, }; // Parse args.