Merge pull request #2263 from kwagyeman/kwabena/fix_ml_scaling

modules/py_image: Change scale argument to (min,max) range.
This commit is contained in:
Ibrahim Abdelkader 2024-07-13 18:50:45 +02:00 committed by GitHub
commit e9a6cbac34
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -50,7 +50,7 @@ def fomo_post_process(model, inputs, outputs):
n, oh, ow, oc = model.output_shape[0]
nms = NMS(ow, oh, inputs[0].roi)
for i in range(oc):
img = image.Image(outputs[0], shape=(oh, ow, 1), strides=(i, oc), scale=(255, 0))
img = image.Image(outputs[0], shape=(oh, ow, 1), strides=(i, oc), scale=(0, 1))
blobs = img.find_blobs(
threshold_list, x_stride=1, area_threshold=1, pixels_threshold=1
)

View File

@ -6379,8 +6379,8 @@ mp_obj_t py_image_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw
mp_obj_t *scale;
mp_obj_get_array_fixed_n(args[ARG_scale].u_obj, 2, &scale);
float fscale = mp_obj_get_float(scale[0]);
float fadd = mp_obj_get_float(scale[1]);
float fscale = 255.0f / (mp_obj_get_float(scale[1]) - mp_obj_get_float(scale[0]));
float fadd = -mp_obj_get_float(scale[0]) * fscale;
if (args[ARG_copy_to_fb].u_bool) {
py_helper_set_to_framebuffer(&image);