From 112e76d3cd82b6c9c12520fd8d35f0572d1db021 Mon Sep 17 00:00:00 2001 From: PENGUINLIONG Date: Thu, 24 Apr 2025 09:01:18 +0800 Subject: [PATCH] Update base.py --- rembg/sessions/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rembg/sessions/base.py b/rembg/sessions/base.py index 470159d..c932ff7 100644 --- a/rembg/sessions/base.py +++ b/rembg/sessions/base.py @@ -41,7 +41,7 @@ class BaseSession: im = img.convert("RGB").resize(size, Image.Resampling.LANCZOS) im_ary = np.array(im) - im_ary = im_ary / np.max(im_ary) + im_ary = im_ary / max(np.max(im_ary), 1e-6) tmpImg = np.zeros((im_ary.shape[0], im_ary.shape[1], 3)) tmpImg[:, :, 0] = (im_ary[:, :, 0] - mean[0]) / std[0]