From 007f778b72153365cd37fc9d61494e49c5f525d4 Mon Sep 17 00:00:00 2001 From: Charles Ollion Date: Sat, 30 Mar 2024 23:13:03 +0100 Subject: [PATCH] Fix TFLite Segment mask rows 1-4 normalization (#9405) Co-authored-by: Glenn Jocher --- ultralytics/nn/autobackend.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ultralytics/nn/autobackend.py b/ultralytics/nn/autobackend.py index 896f89b9..93c5fa07 100644 --- a/ultralytics/nn/autobackend.py +++ b/ultralytics/nn/autobackend.py @@ -543,7 +543,7 @@ class AutoBackend(nn.Module): if integer: scale, zero_point = output["quantization"] x = (x.astype(np.float32) - zero_point) * scale # re-scale - if x.ndim > 2: # if task is not classification + if x.ndim == 3: # if task is not classification, excluding masks (ndim=4) as well # Denormalize xywh by image size. See https://github.com/ultralytics/ultralytics/pull/1695 # xywh are normalized in TFLite/EdgeTPU to mitigate quantization error of integer models x[:, [0, 2]] *= w