🖤 make black happy
This commit is contained in:
parent
e04c531c05
commit
b91bc91897
|
|
@ -1,11 +1,11 @@
|
|||
from typing import Optional, Tuple
|
||||
from dataclasses import replace
|
||||
from typing import Optional, Tuple
|
||||
|
||||
import cv2
|
||||
import numpy as np
|
||||
|
||||
from supervision import Detections
|
||||
from supervision.detection.utils import generate_2d_mask, clip_boxes
|
||||
from supervision.detection.utils import clip_boxes, generate_2d_mask
|
||||
from supervision.draw.color import Color
|
||||
from supervision.draw.utils import draw_polygon, draw_text
|
||||
from supervision.geometry.core import Position
|
||||
|
|
@ -25,10 +25,14 @@ class PolygonZone:
|
|||
self.current_count = 0
|
||||
|
||||
width, height = frame_resolution_wh
|
||||
self.mask = generate_2d_mask(polygon=polygon, resolution_wh=(width + 1, height + 1))
|
||||
self.mask = generate_2d_mask(
|
||||
polygon=polygon, resolution_wh=(width + 1, height + 1)
|
||||
)
|
||||
|
||||
def trigger(self, detections: Detections) -> np.ndarray:
|
||||
clipped_xyxy = clip_boxes(boxes_xyxy=detections.xyxy, frame_resolution_wh=self.frame_resolution_wh)
|
||||
clipped_xyxy = clip_boxes(
|
||||
boxes_xyxy=detections.xyxy, frame_resolution_wh=self.frame_resolution_wh
|
||||
)
|
||||
clipped_detections = replace(detections, xyxy=clipped_xyxy)
|
||||
clipped_anchors = np.ceil(
|
||||
clipped_detections.get_anchor_coordinates(anchor=self.triggering_position)
|
||||
|
|
|
|||
|
|
@ -94,7 +94,9 @@ def non_max_suppression(
|
|||
return keep[sort_index.argsort()]
|
||||
|
||||
|
||||
def clip_boxes(boxes_xyxy: np.ndarray, frame_resolution_wh: Tuple[int, int]) -> np.ndarray:
|
||||
def clip_boxes(
|
||||
boxes_xyxy: np.ndarray, frame_resolution_wh: Tuple[int, int]
|
||||
) -> np.ndarray:
|
||||
"""
|
||||
Clips bounding boxes coordinates to fit within the frame resolution.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue