From a3e6844b16d040a839e190364dea0b5afa1346bf Mon Sep 17 00:00:00 2001 From: SCZwangxiao <31362395+SCZwangxiao@users.noreply.github.com> Date: Wed, 31 Jan 2024 11:31:41 +0800 Subject: [PATCH] Fix the bug of overflow in AutoContrast --- lavis/processors/randaugment.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lavis/processors/randaugment.py b/lavis/processors/randaugment.py index 5c6a9e6d..736d5373 100644 --- a/lavis/processors/randaugment.py +++ b/lavis/processors/randaugment.py @@ -23,6 +23,7 @@ def autocontrast_func(img, cutoff=0): n_bins = 256 def tune_channel(ch): + ch = ch.astype(np.int16) n = ch.size cut = cutoff * n // 100 if cut == 0: