From a83d3b4c7e454b61843cebca1fe333990903fa36 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 7 Oct 2023 20:12:29 +0000 Subject: [PATCH] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20auto=20form?= =?UTF-8?q?at=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/annotators/core.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index 3a5e86e2..e2aa0db7 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -215,10 +215,10 @@ class HaloAnnotator(BaseAnnotator): if detections.mask is None: return scene colored_mask = np.zeros_like(scene, dtype=np.uint8) - fmask = np.array( - [False]*scene.shape[0]*scene.shape[1] - ).reshape(scene.shape[0],scene.shape[1]) - + fmask = np.array([False] * scene.shape[0] * scene.shape[1]).reshape( + scene.shape[0], scene.shape[1] + ) + for detection_idx in np.flip(np.argsort(detections.area)): idx = resolve_color_idx( detections=detections, @@ -234,9 +234,9 @@ class HaloAnnotator(BaseAnnotator): colored_mask = cv2.blur(colored_mask, (self.kernel_size, self.kernel_size)) colored_mask[fmask] = [0, 0, 0] gray = cv2.cvtColor(colored_mask, cv2.COLOR_BGR2GRAY) - alpha = self.opacity*gray/gray.max() - alpha_mask = alpha[:,:,np.newaxis] - scene= np.uint8(scene*(1-alpha_mask)+colored_mask*self.opacity) + alpha = self.opacity * gray / gray.max() + alpha_mask = alpha[:, :, np.newaxis] + scene = np.uint8(scene * (1 - alpha_mask) + colored_mask * self.opacity) return scene