diff --git a/.github/lychee.toml b/.github/lychee.toml index 6efd5df8..024de3ab 100644 --- a/.github/lychee.toml +++ b/.github/lychee.toml @@ -4,6 +4,10 @@ include_verbatim = true retry_wait_time = 3 max_concurrency = 10 cache = false +accept = [ + 200, # OK + 408, # Request Timeout +] exclude = [ "https://github.com/YOUR_USERNAME/supervision.git", # hint for forking contributors diff --git a/docs/how_to/count_in_zone.md b/docs/how_to/count_in_zone.md index e0609070..01ddfab1 100644 --- a/docs/how_to/count_in_zone.md +++ b/docs/how_to/count_in_zone.md @@ -21,7 +21,7 @@ import cv2 from ultralytics import YOLO -model = YOLO('yolov8s.pt') +model = YOLO("yolov8s.pt") VIDEO = str(VideoAssets.VEHICLES_2) @@ -56,12 +56,8 @@ Save the coordinates in an array: ```python polygons = [ - np.array([ - [718, 595],[927, 592],[851, 1062],[42, 1059] - ]), - np.array([ - [987, 595],[1199, 595],[1893, 1056],[1015, 1062] - ]) + np.array([[718, 595], [927, 592], [851, 1062], [42, 1059]]), + np.array([[987, 595], [1199, 595], [1893, 1056], [1015, 1062]]), ] ``` @@ -71,12 +67,8 @@ With the coordinates of the zones to draw ready, we can set up our zones: ```python zones = [ - sv.PolygonZone( - polygon=polygon, - frame_resolution_wh=video_info.resolution_wh - ) - for polygon - in polygons + sv.PolygonZone(polygon=polygon, frame_resolution_wh=video_info.resolution_wh) + for polygon in polygons ] zone_annotators = [ sv.PolygonZoneAnnotator( @@ -84,10 +76,9 @@ zone_annotators = [ color=colors.by_idx(index), thickness=4, text_thickness=8, - text_scale=4 + text_scale=4, ) - for index, zone - in enumerate(zones) + for index, zone in enumerate(zones) ] box_annotators = [ sv.BoxAnnotator( @@ -95,9 +86,8 @@ box_annotators = [ thickness=4, text_thickness=4, text_scale=2, - ) - for index - in range(len(polygons)) + ) + for index in range(len(polygons)) ] ``` @@ -112,14 +102,19 @@ def process_frame(frame: np.ndarray, i) -> np.ndarray: results = model(frame, imgsz=1280, verbose=False)[0] detections = sv.Detections.from_ultralytics(results) - for zone, zone_annotator, box_annotator in zip(zones, zone_annotators, box_annotators): + for zone, zone_annotator, box_annotator in zip( + zones, zone_annotators, box_annotators + ): mask = zone.trigger(detections=detections) detections_filtered = detections[mask] - frame = box_annotator.annotate(scene=frame, detections=detections_filtered, skip_label=True) + frame = box_annotator.annotate( + scene=frame, detections=detections_filtered, skip_label=True + ) frame = zone_annotator.annotate(scene=frame) return frame + sv.process_video(source_path=VIDEO, target_path="result.mp4", callback=process_frame) ```