From 082f2481594e87da189dd3a77e950429dbf0ebed Mon Sep 17 00:00:00 2001 From: mario-dg Date: Mon, 9 Oct 2023 15:42:54 +0200 Subject: [PATCH 001/164] =?UTF-8?q?feat:=20=F0=9F=9A=80=20watermarking=20i?= =?UTF-8?q?mages=20and=20videos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/draw/utils.py | 62 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/supervision/draw/utils.py b/supervision/draw/utils.py index 9d75690d..eb61f0ac 100644 --- a/supervision/draw/utils.py +++ b/supervision/draw/utils.py @@ -1,4 +1,5 @@ -from typing import Optional +from typing import Optional, Union +import os import cv2 import numpy as np @@ -168,3 +169,62 @@ def draw_text( lineType=cv2.LINE_AA, ) return scene + +def draw_image( + scene: np.ndarray, image: Union[str, np.ndarray], opacity: float, rect: Rect +) -> np.ndarray: + """ + Draws an image onto a given scene with specified opacity and dimensions. + + Args: + scene (np.ndarray): The background image onto which the image will be drawn. + image (Union[str, np.ndarray]): The image to be drawn. Can be either a file path or a NumPy array. + opacity (float): The opacity level of the image to be drawn, ranging from 0.0 to 1.0. + rect (Rect): A Rect object specifying the dimensions and position where the image will be drawn. + + Returns: + np.ndarray: The scene with the image drawn onto it. + + Example: + >>> scene = np.zeros((400, 400, 3), dtype=np.uint8) + >>> image_path = "path/to/image.jpg" + >>> opacity = 0.5 + >>> rect = Rect(x=50, y=50, width=200, height=200) + >>> new_scene = draw_image(scene, image_path, opacity, rect) + """ + if isinstance(image, str): + assert os.path.exists(image), f'The specified path ("{image}") does not exist.' + image = cv2.imread(image, cv2.IMREAD_UNCHANGED) + + assert 0.0 <= opacity <= 1.0, "The opacity has to be between 0.0 and 1.0." + + assert ( + rect.x >= 0 and rect.y >= 0 + ), "The top left coordinates of the rectangle have to be positive." + assert ( + rect.x + rect.width <= scene.shape[1] and rect.y + rect.height <= scene.shape[0] + ), "The image you are trying to draw exceeds the bounds of the scene." + + image = cv2.resize(image, (rect.width, rect.height)) + + # watermark with transparent background + if image.shape[2] == 4: + b, g, r, a = cv2.split(image) + b = cv2.bitwise_and(b, b, mask=a) + g = cv2.bitwise_and(g, g, mask=a) + r = cv2.bitwise_and(r, r, mask=a) + image = cv2.merge([b, g, r, a]) + del b, g, r, a # immediately free up memory + + if scene.shape[2] == 3: + scene = np.dstack([scene, np.ones(scene.shape[:2], dtype=np.uint8) * 255]) + + scene_h, scene_w, channels = scene.shape[:3] + water_h, water_w = image.shape[:2] + + overlay = np.zeros((scene_h, scene_w, channels), dtype="uint8") + overlay[rect.y : rect.y + water_h, rect.x : rect.x + water_w] = image + + cv2.addWeighted(overlay, opacity, scene, 1.0, 0, scene) + + return scene[:, :, :3] \ No newline at end of file From 6a0482ded5d2005484b4d116fc228155f50ab228 Mon Sep 17 00:00:00 2001 From: Mario da Graca Date: Tue, 10 Oct 2023 08:24:29 +0200 Subject: [PATCH 002/164] Fixed pre-commit issues --- supervision/draw/utils.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/supervision/draw/utils.py b/supervision/draw/utils.py index eb61f0ac..73844fbd 100644 --- a/supervision/draw/utils.py +++ b/supervision/draw/utils.py @@ -1,5 +1,5 @@ -from typing import Optional, Union import os +from typing import Optional, Union import cv2 import numpy as np @@ -170,6 +170,7 @@ def draw_text( ) return scene + def draw_image( scene: np.ndarray, image: Union[str, np.ndarray], opacity: float, rect: Rect ) -> np.ndarray: @@ -178,9 +179,12 @@ def draw_image( Args: scene (np.ndarray): The background image onto which the image will be drawn. - image (Union[str, np.ndarray]): The image to be drawn. Can be either a file path or a NumPy array. - opacity (float): The opacity level of the image to be drawn, ranging from 0.0 to 1.0. - rect (Rect): A Rect object specifying the dimensions and position where the image will be drawn. + image (Union[str, np.ndarray]): The image to be drawn. + Can be either a file path or a NumPy array. + opacity (float): The opacity level of the image to be drawn, + ranging from 0.0 to 1.0. + rect (Rect): A Rect object specifying the dimensions and + position where the image will be drawn. Returns: np.ndarray: The scene with the image drawn onto it. @@ -227,4 +231,4 @@ def draw_image( cv2.addWeighted(overlay, opacity, scene, 1.0, 0, scene) - return scene[:, :, :3] \ No newline at end of file + return scene[:, :, :3] From 9a2a87a170e4b5506fbbd04dc80c121fb5ed5c29 Mon Sep 17 00:00:00 2001 From: Rajarshi Misra <72802594+Rajarshi-Misra@users.noreply.github.com> Date: Thu, 12 Oct 2023 19:58:11 +0530 Subject: [PATCH 003/164] Just writing the title --- docs/how_to/track_objects.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/how_to/track_objects.md b/docs/how_to/track_objects.md index c9497945..8477a4a5 100644 --- a/docs/how_to/track_objects.md +++ b/docs/how_to/track_objects.md @@ -1 +1 @@ -🚧 Page under construction. +## How To: Track Object From f82f297f2e1f2c79f46acd281bc34f48c8e9fb61 Mon Sep 17 00:00:00 2001 From: Rajarshi Misra <72802594+Rajarshi-Misra@users.noreply.github.com> Date: Thu, 12 Oct 2023 19:58:55 +0530 Subject: [PATCH 004/164] Update track_objects.md Typo --- docs/how_to/track_objects.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/how_to/track_objects.md b/docs/how_to/track_objects.md index 8477a4a5..b5b13caa 100644 --- a/docs/how_to/track_objects.md +++ b/docs/how_to/track_objects.md @@ -1 +1 @@ -## How To: Track Object +## How To: Track Objects From b1f207f2ee307aafb28a2b99b75a704ffc70e2ec Mon Sep 17 00:00:00 2001 From: Rajarshi Misra <72802594+Rajarshi-Misra@users.noreply.github.com> Date: Thu, 12 Oct 2023 22:47:16 +0530 Subject: [PATCH 005/164] Update track_objects.md Added all the subtopics and 'what is tracking' --- docs/how_to/track_objects.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/how_to/track_objects.md b/docs/how_to/track_objects.md index b5b13caa..d714ec69 100644 --- a/docs/how_to/track_objects.md +++ b/docs/how_to/track_objects.md @@ -1 +1,9 @@ ## How To: Track Objects +This is a tutorial to track object in a video using [ByteTrack](https://supervision.roboflow.com/trackers/#supervision.tracker.byte_tracker.core.ByteTrack). +### What is Tracking? +Tracking is an essential application of computer vision, which is used in mainly in videos or set of images which contain a sequence of events(the set of images could be simply frames of a video). It takes an initial set of detections from a video as per the requirement of the project, provides some unique identification to the detections and tracks as the position changes with time in a video. Supervision provides some powerful tools to track object in videos. This tutorial would cover how to make detections in a video, track those detections and then label them for unique identification using Supervision. Further, it would also cover how to trace the path covered by the detections. +### Step 1:Building a detection pipeline for videos +### Step 2:Tracking the detections +### Step 3:Labels the detections being tracked +### Step 4:Tracing the path of the detections +### Conclusion and further ideas From c51159b598c9490d8e288fdb9ef6e13c4f8e7c04 Mon Sep 17 00:00:00 2001 From: kapter Date: Thu, 12 Oct 2023 23:44:26 +0300 Subject: [PATCH 006/164] added HeatmapAnnotator --- supervision/annotators/core.py | 108 +++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index 8edca92b..ae61d27c 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -84,6 +84,114 @@ class BoundingBoxAnnotator(BaseAnnotator): ) return scene +class HeatmapAnnotator: + """ + A class for drawing heatmap on an image using provided detections. + Heat is accumulated over time. Drawn as a semi-transparent overlay as blured circles. + """ + def __init__( + self, + position: Optional[Position] = Position.BOTTOM_CENTER, + opacity: float = 0.2, + radius: int = 40, + kernel_size: Optional[int] = 25, + + ): + """ + Args: + position (Optional[Position]): The position of the heatmap. + Defaults to `BOTTOM_CENTER`. + opacity (float): Opacity of the overlay mask. Must be between `0` and `1`. + radius (int): Radius of the heat circle. + kernel_size (Optional[int]): Kernel size for blurring the heatmap. + """ + self.position = position + self.opacity = opacity + self.radius = radius + self.kernel_size = kernel_size + self.heatmask = None + + + def get_xy(self, xyxy: Tuple[int, int, int, int],position: Optional[Position]) -> Tuple[int, int, int, int]: + """ + Returns the xy coordinates of the heatmap based on the provided position. + """ + if (position is None) or (position == Position.TOP_LEFT): + return xyxy[0], xyxy[1] + elif position == Position.TOP_CENTER: + return int((xyxy[0]+xyxy[2])/2), int(xyxy[1]) + elif position == Position.TOP_RIGHT: + return int(xyxy[2]), int(xyxy[1]) + elif position == Position.CENTER_LEFT: + return int(xyxy[0]), int((xyxy[1]+xyxy[3])/2) + elif position == Position.CENTER: + return int((xyxy[0]+xyxy[2])/2), int((xyxy[1]+xyxy[3])/2) + elif position == Position.CENTER_RIGHT: + return int(xyxy[2]), int((xyxy[1]+xyxy[3])/2) + elif position == Position.BOTTOM_LEFT: + return int(xyxy[0]), int(xyxy[3]) + elif position == Position.BOTTOM_CENTER: + return (int((xyxy[0]+xyxy[2])/2), int(xyxy[3])) + elif position == Position.BOTTOM_RIGHT: + return int(xyxy[2]), int(xyxy[3]) + + def annotate(self, scene: np.ndarray, detections: Detections) -> np.ndarray: + """ + Annotates the given scene with heatmap based on the provided detections. + + Args: + scene (np.ndarray): The image where heatmap will be drawn. + detections (Detections): Object detections to annotate. + + Returns: + np.ndarray: The annotated image. + + Example: + ```python + >>> import supervision as sv + >>> model = YOLO('yolov8s.pt') + >>> video_info = sv.VideoInfo.from_video_path(video_path=video_path) + >>> hma = HeatmapAnnotator( + ... position=Position.BOTTOM_CENTER, + ... opacity=0.2, + ... radius=40, + ... kernel_size=25, + ...) + >>> with sv.VideoSink(target_path=target_path, video_info=video_info) as sink: + ... for result in tqdm(model(source=video_path, agnostic_nms=True, verbose=False), total=video_info.total_frames): + ... frame = result.orig_img + ... detections = sv.Detections.from_ultralytics(result) + ... detections = detections[detections.class_id == 0] + ... annotated_frame = hma.annotate( + ... scene=frame.copy(), + ... detections=detections) + ... sink.write_frame(frame=annotated_frame) + ``` + + ![heatmap-annotator-example](https://media.roboflow.com/ + supervision-annotator-examples/heatmap-annotator-example.png) + """ + + if self.heatmask is None: + self.heatmask = np.zeros(scene.shape[:2]) + mask = np.zeros(scene.shape[:2]) + for xyxy,_,_,_,_ in detections: + cv2.circle(mask, self.get_xy(xyxy,self.position), self.radius, 1, -1) + self.heatmask = mask+self.heatmask + temp = self.heatmask.copy() + temp = 100-temp/temp.max()*90 + temp = temp.astype(np.uint8) + if self.kernel_size is not None: + temp = cv2.GaussianBlur(temp,(self.kernel_size,self.kernel_size),0) + hsv = np.zeros(scene.shape) + hsv[...,0] = temp + hsv[...,1] = 255 + hsv[...,2] = 255 + mask = temp>0 + temp = cv2.cvtColor(hsv.astype(np.uint8), cv2.COLOR_HSV2BGR) + scene[mask] = cv2.addWeighted( temp, self.opacity,scene, 1-self.opacity, 0)[mask] + return scene + class MaskAnnotator(BaseAnnotator): """ From ae00a9d65f562ad1b96245dcf3abe0e2fffe2c5c Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 12 Oct 2023 20:48:19 +0000 Subject: [PATCH 007/164] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/annotators/core.py | 46 ++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index ae61d27c..e8fe785a 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -84,18 +84,19 @@ class BoundingBoxAnnotator(BaseAnnotator): ) return scene + class HeatmapAnnotator: """ A class for drawing heatmap on an image using provided detections. Heat is accumulated over time. Drawn as a semi-transparent overlay as blured circles. """ + def __init__( self, position: Optional[Position] = Position.BOTTOM_CENTER, opacity: float = 0.2, radius: int = 40, - kernel_size: Optional[int] = 25, - + kernel_size: Optional[int] = 25, ): """ Args: @@ -110,28 +111,29 @@ class HeatmapAnnotator: self.radius = radius self.kernel_size = kernel_size self.heatmask = None - - def get_xy(self, xyxy: Tuple[int, int, int, int],position: Optional[Position]) -> Tuple[int, int, int, int]: + def get_xy( + self, xyxy: Tuple[int, int, int, int], position: Optional[Position] + ) -> Tuple[int, int, int, int]: """ Returns the xy coordinates of the heatmap based on the provided position. """ if (position is None) or (position == Position.TOP_LEFT): return xyxy[0], xyxy[1] elif position == Position.TOP_CENTER: - return int((xyxy[0]+xyxy[2])/2), int(xyxy[1]) + return int((xyxy[0] + xyxy[2]) / 2), int(xyxy[1]) elif position == Position.TOP_RIGHT: return int(xyxy[2]), int(xyxy[1]) elif position == Position.CENTER_LEFT: - return int(xyxy[0]), int((xyxy[1]+xyxy[3])/2) + return int(xyxy[0]), int((xyxy[1] + xyxy[3]) / 2) elif position == Position.CENTER: - return int((xyxy[0]+xyxy[2])/2), int((xyxy[1]+xyxy[3])/2) + return int((xyxy[0] + xyxy[2]) / 2), int((xyxy[1] + xyxy[3]) / 2) elif position == Position.CENTER_RIGHT: - return int(xyxy[2]), int((xyxy[1]+xyxy[3])/2) + return int(xyxy[2]), int((xyxy[1] + xyxy[3]) / 2) elif position == Position.BOTTOM_LEFT: return int(xyxy[0]), int(xyxy[3]) elif position == Position.BOTTOM_CENTER: - return (int((xyxy[0]+xyxy[2])/2), int(xyxy[3])) + return (int((xyxy[0] + xyxy[2]) / 2), int(xyxy[3])) elif position == Position.BOTTOM_RIGHT: return int(xyxy[2]), int(xyxy[3]) @@ -142,7 +144,7 @@ class HeatmapAnnotator: Args: scene (np.ndarray): The image where heatmap will be drawn. detections (Detections): Object detections to annotate. - + Returns: np.ndarray: The annotated image. @@ -175,23 +177,25 @@ class HeatmapAnnotator: if self.heatmask is None: self.heatmask = np.zeros(scene.shape[:2]) mask = np.zeros(scene.shape[:2]) - for xyxy,_,_,_,_ in detections: - cv2.circle(mask, self.get_xy(xyxy,self.position), self.radius, 1, -1) - self.heatmask = mask+self.heatmask + for xyxy, _, _, _, _ in detections: + cv2.circle(mask, self.get_xy(xyxy, self.position), self.radius, 1, -1) + self.heatmask = mask + self.heatmask temp = self.heatmask.copy() - temp = 100-temp/temp.max()*90 + temp = 100 - temp / temp.max() * 90 temp = temp.astype(np.uint8) if self.kernel_size is not None: - temp = cv2.GaussianBlur(temp,(self.kernel_size,self.kernel_size),0) + temp = cv2.GaussianBlur(temp, (self.kernel_size, self.kernel_size), 0) hsv = np.zeros(scene.shape) - hsv[...,0] = temp - hsv[...,1] = 255 - hsv[...,2] = 255 - mask = temp>0 + hsv[..., 0] = temp + hsv[..., 1] = 255 + hsv[..., 2] = 255 + mask = temp > 0 temp = cv2.cvtColor(hsv.astype(np.uint8), cv2.COLOR_HSV2BGR) - scene[mask] = cv2.addWeighted( temp, self.opacity,scene, 1-self.opacity, 0)[mask] + scene[mask] = cv2.addWeighted(temp, self.opacity, scene, 1 - self.opacity, 0)[ + mask + ] return scene - + class MaskAnnotator(BaseAnnotator): """ From 1324cda60080884d8c867dd44288aca285f5a250 Mon Sep 17 00:00:00 2001 From: kapter Date: Fri, 13 Oct 2023 16:09:24 +0300 Subject: [PATCH 008/164] unnecessary function(get_xy) removed --- supervision/annotators/core.py | 29 ++--------------------------- 1 file changed, 2 insertions(+), 27 deletions(-) diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index e8fe785a..072e1026 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -112,31 +112,6 @@ class HeatmapAnnotator: self.kernel_size = kernel_size self.heatmask = None - def get_xy( - self, xyxy: Tuple[int, int, int, int], position: Optional[Position] - ) -> Tuple[int, int, int, int]: - """ - Returns the xy coordinates of the heatmap based on the provided position. - """ - if (position is None) or (position == Position.TOP_LEFT): - return xyxy[0], xyxy[1] - elif position == Position.TOP_CENTER: - return int((xyxy[0] + xyxy[2]) / 2), int(xyxy[1]) - elif position == Position.TOP_RIGHT: - return int(xyxy[2]), int(xyxy[1]) - elif position == Position.CENTER_LEFT: - return int(xyxy[0]), int((xyxy[1] + xyxy[3]) / 2) - elif position == Position.CENTER: - return int((xyxy[0] + xyxy[2]) / 2), int((xyxy[1] + xyxy[3]) / 2) - elif position == Position.CENTER_RIGHT: - return int(xyxy[2]), int((xyxy[1] + xyxy[3]) / 2) - elif position == Position.BOTTOM_LEFT: - return int(xyxy[0]), int(xyxy[3]) - elif position == Position.BOTTOM_CENTER: - return (int((xyxy[0] + xyxy[2]) / 2), int(xyxy[3])) - elif position == Position.BOTTOM_RIGHT: - return int(xyxy[2]), int(xyxy[3]) - def annotate(self, scene: np.ndarray, detections: Detections) -> np.ndarray: """ Annotates the given scene with heatmap based on the provided detections. @@ -177,8 +152,8 @@ class HeatmapAnnotator: if self.heatmask is None: self.heatmask = np.zeros(scene.shape[:2]) mask = np.zeros(scene.shape[:2]) - for xyxy, _, _, _, _ in detections: - cv2.circle(mask, self.get_xy(xyxy, self.position), self.radius, 1, -1) + for xy in detections.get_anchor_coordinates(self.position): + cv2.circle(mask, (int(xy[0]), int(xy[1])), self.radius, 1, -1) self.heatmask = mask + self.heatmask temp = self.heatmask.copy() temp = 100 - temp / temp.max() * 90 From 9572469f5feedf09b057a5014598d5824161eabe Mon Sep 17 00:00:00 2001 From: Rajarshi Misra <72802594+Rajarshi-Misra@users.noreply.github.com> Date: Fri, 13 Oct 2023 18:46:49 +0530 Subject: [PATCH 009/164] Final changes left --- docs/how_to/track_objects.md | 73 +++++++++++++++++++++++++++++++++++- 1 file changed, 72 insertions(+), 1 deletion(-) diff --git a/docs/how_to/track_objects.md b/docs/how_to/track_objects.md index d714ec69..e772f134 100644 --- a/docs/how_to/track_objects.md +++ b/docs/how_to/track_objects.md @@ -2,8 +2,79 @@ This is a tutorial to track object in a video using [ByteTrack](https://supervision.roboflow.com/trackers/#supervision.tracker.byte_tracker.core.ByteTrack). ### What is Tracking? Tracking is an essential application of computer vision, which is used in mainly in videos or set of images which contain a sequence of events(the set of images could be simply frames of a video). It takes an initial set of detections from a video as per the requirement of the project, provides some unique identification to the detections and tracks as the position changes with time in a video. Supervision provides some powerful tools to track object in videos. This tutorial would cover how to make detections in a video, track those detections and then label them for unique identification using Supervision. Further, it would also cover how to trace the path covered by the detections. +Before proceeding remember to install Supervision: +''' +pip install supervision +''' +and import it: +''' +import supervision as sv +''' ### Step 1:Building a detection pipeline for videos +First to track objects we need to load the data and make it usable. We are going to do it by generating the frames from the video and using an object detection model, using [sv.get_video_frames_generator()](https://supervision.roboflow.com/utils/video/#get_video_frames_generator). In this tutorial we are going to do it using YOLOv8. +First install ultralytics, import it and initialize the frame_generator. +''' +pip install ultralytics +''' +''' +from ultralytics import YOLO +model = YOLO(...) +frame_generator = sv.get_video_frames_generator(source_path=source_video_path) +''' +Replace '...' with the path of v8 model ### Step 2:Tracking the detections -### Step 3:Labels the detections being tracked +To track the detections we are going to use [ByteTrack](https://supervision.roboflow.com/trackers/#supervision.tracker.byte_tracker.core.ByteTrack). Further, the detections in each frame are going tbe passed into [sv.Detections.from_ultralytics()](https://supervision.roboflow.com/detection/core/), whose output would be passed on to ByteTrack. +''' +tracker = sv.ByteTrack() + +for frame in frame_generator: + results = model(frame)[0] + detections = sv.Detections.from_ultralytics(results) + detections = tracker.update_with_detections(detections) +''' +### Step 3:Label the detections being tracked +The objects being tracked can be annotated with any [annotator provided by supervision](https://supervision.roboflow.com/annotators/#labelannotator). But, we are going to use label annotator and label the object being tracked with their tracking ids. +''' +label_annotator = sv.LabelAnnotator(text_position=sv.Position.CENTER) +for frame in frame_generator: + results = model(frame)[0] + detections = sv.Detections.from_ultralytics(results) + detections = tracker.update_with_detections(detections) + labels = detections.tracker_id + annotator.annotate(scene=frame.copy(), detections=detections, labels=labels) +''' ### Step 4:Tracing the path of the detections +Further, the path of the tracked objects can be traced using [TraceAnnotator](https://supervision.roboflow.com/annotators/#traceannotator) of supervision. +''' + +label_annotator = sv.LabelAnnotator(text_position=sv.Position.CENTER) +trace_annotator = sv.TraceAnnotator() +for frame in frame_generator: + results = model(frame)[0] + detections = sv.Detections.from_ultralytics(results) + detections = tracker.update_with_detections(detections) + labels = detections.tracker_id + label_annotator.annotate(scene=frame.copy(), detections=detections, labels=labels) + trace_annotator.annotate(scene=frame.copy(), detections=detections) +### Step 5:Integrating the previous steps and processing the video +At the end, we want to see the output on our video. In order to do that, we'll be passing the annotations from previous iterations into a callback to be used by [sv.process_video](https://supervision.roboflow.com/utils/video/#process_video). +''' +from ultralytics import YOLO +model = YOLO(...) +frame_generator = sv.get_video_frames_generator(source_path=source_video_path) +tracker = sv.ByteTrack() +label_annotator = sv.LabelAnnotator(text_position=sv.Position.CENTER) +trace_annotator = sv.TraceAnnotator() +def callback(frame: np.ndarray, index: int) -> np.ndarray: + for frame in frame_generator: + results = model(frame)[0] + detections = sv.Detections.from_ultralytics(results) + detections = tracker.update_with_detections(detections) + labels = detections.tracker_id + label_annotator.annotate(scene=frame.copy(), detections=detections, labels=labels) + trace_annotator.annotate(scene=frame.copy(), detections=detections) +sv.process_video(source_path=VIDEO_PATH, target_path=f"result.mp4", callback=process_frame) +''' +Results with label annotator and trace annotator are show below in sequential frames from a video. ### Conclusion and further ideas +This brings us to the end of the tutorial. The users are strongly encouraged to try out other models for detection and play around with annotators. Check out this [post](https://blog.roboflow.com/yolov8-tracking-and-counting/#object-tracking-with-bytetrack)("Piotr Skalski." Roboflow Blog, Feb 1, 2023. https://blog.roboflow.com/yolov8-tracking-and-counting/) for some more cool stuff. The post was quite useful creation of this tutorial. From 377b3fdda70f22d4b53c574e30390e1eae72f10e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 13 Oct 2023 13:17:01 +0000 Subject: [PATCH 010/164] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/how_to/track_objects.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/how_to/track_objects.md b/docs/how_to/track_objects.md index e772f134..d9ae67f0 100644 --- a/docs/how_to/track_objects.md +++ b/docs/how_to/track_objects.md @@ -11,7 +11,7 @@ and import it: import supervision as sv ''' ### Step 1:Building a detection pipeline for videos -First to track objects we need to load the data and make it usable. We are going to do it by generating the frames from the video and using an object detection model, using [sv.get_video_frames_generator()](https://supervision.roboflow.com/utils/video/#get_video_frames_generator). In this tutorial we are going to do it using YOLOv8. +First to track objects we need to load the data and make it usable. We are going to do it by generating the frames from the video and using an object detection model, using [sv.get_video_frames_generator()](https://supervision.roboflow.com/utils/video/#get_video_frames_generator). In this tutorial we are going to do it using YOLOv8. First install ultralytics, import it and initialize the frame_generator. ''' pip install ultralytics @@ -35,7 +35,7 @@ for frame in frame_generator: ### Step 3:Label the detections being tracked The objects being tracked can be annotated with any [annotator provided by supervision](https://supervision.roboflow.com/annotators/#labelannotator). But, we are going to use label annotator and label the object being tracked with their tracking ids. ''' -label_annotator = sv.LabelAnnotator(text_position=sv.Position.CENTER) +label_annotator = sv.LabelAnnotator(text_position=sv.Position.CENTER) for frame in frame_generator: results = model(frame)[0] detections = sv.Detections.from_ultralytics(results) @@ -47,7 +47,7 @@ for frame in frame_generator: Further, the path of the tracked objects can be traced using [TraceAnnotator](https://supervision.roboflow.com/annotators/#traceannotator) of supervision. ''' -label_annotator = sv.LabelAnnotator(text_position=sv.Position.CENTER) +label_annotator = sv.LabelAnnotator(text_position=sv.Position.CENTER) trace_annotator = sv.TraceAnnotator() for frame in frame_generator: results = model(frame)[0] @@ -63,7 +63,7 @@ from ultralytics import YOLO model = YOLO(...) frame_generator = sv.get_video_frames_generator(source_path=source_video_path) tracker = sv.ByteTrack() -label_annotator = sv.LabelAnnotator(text_position=sv.Position.CENTER) +label_annotator = sv.LabelAnnotator(text_position=sv.Position.CENTER) trace_annotator = sv.TraceAnnotator() def callback(frame: np.ndarray, index: int) -> np.ndarray: for frame in frame_generator: From cd76b79ec5e3e6414f225e6d14d1d8d3e0f1bc1d Mon Sep 17 00:00:00 2001 From: Rajarshi Misra <72802594+Rajarshi-Misra@users.noreply.github.com> Date: Fri, 13 Oct 2023 18:51:53 +0530 Subject: [PATCH 011/164] Update track_objects.md --- docs/how_to/track_objects.md | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/docs/how_to/track_objects.md b/docs/how_to/track_objects.md index d9ae67f0..4d3462d4 100644 --- a/docs/how_to/track_objects.md +++ b/docs/how_to/track_objects.md @@ -3,38 +3,38 @@ This is a tutorial to track object in a video using [ByteTrack](https://supervis ### What is Tracking? Tracking is an essential application of computer vision, which is used in mainly in videos or set of images which contain a sequence of events(the set of images could be simply frames of a video). It takes an initial set of detections from a video as per the requirement of the project, provides some unique identification to the detections and tracks as the position changes with time in a video. Supervision provides some powerful tools to track object in videos. This tutorial would cover how to make detections in a video, track those detections and then label them for unique identification using Supervision. Further, it would also cover how to trace the path covered by the detections. Before proceeding remember to install Supervision: -''' +``` pip install supervision -''' +``` and import it: -''' +``` import supervision as sv -''' +``` ### Step 1:Building a detection pipeline for videos First to track objects we need to load the data and make it usable. We are going to do it by generating the frames from the video and using an object detection model, using [sv.get_video_frames_generator()](https://supervision.roboflow.com/utils/video/#get_video_frames_generator). In this tutorial we are going to do it using YOLOv8. First install ultralytics, import it and initialize the frame_generator. -''' +``` pip install ultralytics -''' -''' +``` +``` from ultralytics import YOLO model = YOLO(...) frame_generator = sv.get_video_frames_generator(source_path=source_video_path) -''' +``` Replace '...' with the path of v8 model ### Step 2:Tracking the detections To track the detections we are going to use [ByteTrack](https://supervision.roboflow.com/trackers/#supervision.tracker.byte_tracker.core.ByteTrack). Further, the detections in each frame are going tbe passed into [sv.Detections.from_ultralytics()](https://supervision.roboflow.com/detection/core/), whose output would be passed on to ByteTrack. -''' +``` tracker = sv.ByteTrack() for frame in frame_generator: results = model(frame)[0] detections = sv.Detections.from_ultralytics(results) detections = tracker.update_with_detections(detections) -''' +``` ### Step 3:Label the detections being tracked The objects being tracked can be annotated with any [annotator provided by supervision](https://supervision.roboflow.com/annotators/#labelannotator). But, we are going to use label annotator and label the object being tracked with their tracking ids. -''' +``` label_annotator = sv.LabelAnnotator(text_position=sv.Position.CENTER) for frame in frame_generator: results = model(frame)[0] @@ -42,10 +42,10 @@ for frame in frame_generator: detections = tracker.update_with_detections(detections) labels = detections.tracker_id annotator.annotate(scene=frame.copy(), detections=detections, labels=labels) -''' +``` ### Step 4:Tracing the path of the detections Further, the path of the tracked objects can be traced using [TraceAnnotator](https://supervision.roboflow.com/annotators/#traceannotator) of supervision. -''' +``` label_annotator = sv.LabelAnnotator(text_position=sv.Position.CENTER) trace_annotator = sv.TraceAnnotator() @@ -56,9 +56,10 @@ for frame in frame_generator: labels = detections.tracker_id label_annotator.annotate(scene=frame.copy(), detections=detections, labels=labels) trace_annotator.annotate(scene=frame.copy(), detections=detections) +``` ### Step 5:Integrating the previous steps and processing the video At the end, we want to see the output on our video. In order to do that, we'll be passing the annotations from previous iterations into a callback to be used by [sv.process_video](https://supervision.roboflow.com/utils/video/#process_video). -''' +``` from ultralytics import YOLO model = YOLO(...) frame_generator = sv.get_video_frames_generator(source_path=source_video_path) @@ -74,7 +75,7 @@ def callback(frame: np.ndarray, index: int) -> np.ndarray: label_annotator.annotate(scene=frame.copy(), detections=detections, labels=labels) trace_annotator.annotate(scene=frame.copy(), detections=detections) sv.process_video(source_path=VIDEO_PATH, target_path=f"result.mp4", callback=process_frame) -''' +``` Results with label annotator and trace annotator are show below in sequential frames from a video. ### Conclusion and further ideas This brings us to the end of the tutorial. The users are strongly encouraged to try out other models for detection and play around with annotators. Check out this [post](https://blog.roboflow.com/yolov8-tracking-and-counting/#object-tracking-with-bytetrack)("Piotr Skalski." Roboflow Blog, Feb 1, 2023. https://blog.roboflow.com/yolov8-tracking-and-counting/) for some more cool stuff. The post was quite useful creation of this tutorial. From 9c96180a74ade12fe76f612220aa52b306438a9d Mon Sep 17 00:00:00 2001 From: Rajarshi Misra <72802594+Rajarshi-Misra@users.noreply.github.com> Date: Fri, 13 Oct 2023 22:53:58 +0530 Subject: [PATCH 012/164] Update track_objects.md --- docs/how_to/track_objects.md | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/docs/how_to/track_objects.md b/docs/how_to/track_objects.md index 4d3462d4..8a5e0ca4 100644 --- a/docs/how_to/track_objects.md +++ b/docs/how_to/track_objects.md @@ -36,46 +36,33 @@ for frame in frame_generator: The objects being tracked can be annotated with any [annotator provided by supervision](https://supervision.roboflow.com/annotators/#labelannotator). But, we are going to use label annotator and label the object being tracked with their tracking ids. ``` label_annotator = sv.LabelAnnotator(text_position=sv.Position.CENTER) -for frame in frame_generator: - results = model(frame)[0] - detections = sv.Detections.from_ultralytics(results) - detections = tracker.update_with_detections(detections) - labels = detections.tracker_id - annotator.annotate(scene=frame.copy(), detections=detections, labels=labels) + ``` ### Step 4:Tracing the path of the detections -Further, the path of the tracked objects can be traced using [TraceAnnotator](https://supervision.roboflow.com/annotators/#traceannotator) of supervision. +Further, the path of the tracked objects can be traced using [TraceAnnotator](https://supervision.roboflow.com/annotators/#traceannotator) of supervision. To use tracce annotator ensure that the same detections remain in all the frames of the video. ``` label_annotator = sv.LabelAnnotator(text_position=sv.Position.CENTER) trace_annotator = sv.TraceAnnotator() -for frame in frame_generator: - results = model(frame)[0] - detections = sv.Detections.from_ultralytics(results) - detections = tracker.update_with_detections(detections) - labels = detections.tracker_id - label_annotator.annotate(scene=frame.copy(), detections=detections, labels=labels) - trace_annotator.annotate(scene=frame.copy(), detections=detections) ``` ### Step 5:Integrating the previous steps and processing the video At the end, we want to see the output on our video. In order to do that, we'll be passing the annotations from previous iterations into a callback to be used by [sv.process_video](https://supervision.roboflow.com/utils/video/#process_video). ``` from ultralytics import YOLO -model = YOLO(...) +model = YOLO(...) ##We YOLO('yolov8n.pt') frame_generator = sv.get_video_frames_generator(source_path=source_video_path) tracker = sv.ByteTrack() label_annotator = sv.LabelAnnotator(text_position=sv.Position.CENTER) trace_annotator = sv.TraceAnnotator() def callback(frame: np.ndarray, index: int) -> np.ndarray: - for frame in frame_generator: - results = model(frame)[0] - detections = sv.Detections.from_ultralytics(results) - detections = tracker.update_with_detections(detections) - labels = detections.tracker_id - label_annotator.annotate(scene=frame.copy(), detections=detections, labels=labels) - trace_annotator.annotate(scene=frame.copy(), detections=detections) + results = model(frame)[0] + detections = sv.Detections.from_ultralytics(results) + detections = tracker.update_with_detections(detections) + labels = f"{detections.tracker_id}" + label_annotator.annotate(scene=frame, detections=detections, labels=labels) + return trace_annotator.annotate(scene=frame, detections=detections) sv.process_video(source_path=VIDEO_PATH, target_path=f"result.mp4", callback=process_frame) ``` -Results with label annotator and trace annotator are show below in sequential frames from a video. +Check out this [video](https://drive.google.com/file/d/10xaHXz9rpdXkaRni9YzOihhF3S7-Zs4p/view?usp=sharing) to see the end results. ### Conclusion and further ideas This brings us to the end of the tutorial. The users are strongly encouraged to try out other models for detection and play around with annotators. Check out this [post](https://blog.roboflow.com/yolov8-tracking-and-counting/#object-tracking-with-bytetrack)("Piotr Skalski." Roboflow Blog, Feb 1, 2023. https://blog.roboflow.com/yolov8-tracking-and-counting/) for some more cool stuff. The post was quite useful creation of this tutorial. From 47dcb1982942ba7956f18732e244194466430ee2 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 13 Oct 2023 17:24:29 +0000 Subject: [PATCH 013/164] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/how_to/track_objects.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/how_to/track_objects.md b/docs/how_to/track_objects.md index 8a5e0ca4..8a2efbdf 100644 --- a/docs/how_to/track_objects.md +++ b/docs/how_to/track_objects.md @@ -63,6 +63,6 @@ def callback(frame: np.ndarray, index: int) -> np.ndarray: return trace_annotator.annotate(scene=frame, detections=detections) sv.process_video(source_path=VIDEO_PATH, target_path=f"result.mp4", callback=process_frame) ``` -Check out this [video](https://drive.google.com/file/d/10xaHXz9rpdXkaRni9YzOihhF3S7-Zs4p/view?usp=sharing) to see the end results. +Check out this [video](https://drive.google.com/file/d/10xaHXz9rpdXkaRni9YzOihhF3S7-Zs4p/view?usp=sharing) to see the end results. ### Conclusion and further ideas This brings us to the end of the tutorial. The users are strongly encouraged to try out other models for detection and play around with annotators. Check out this [post](https://blog.roboflow.com/yolov8-tracking-and-counting/#object-tracking-with-bytetrack)("Piotr Skalski." Roboflow Blog, Feb 1, 2023. https://blog.roboflow.com/yolov8-tracking-and-counting/) for some more cool stuff. The post was quite useful creation of this tutorial. From 3dbbcf79ae3d719bf1577208b09d54c1ff582bbf Mon Sep 17 00:00:00 2001 From: Rajarshi Misra <72802594+Rajarshi-Misra@users.noreply.github.com> Date: Fri, 13 Oct 2023 22:55:41 +0530 Subject: [PATCH 014/164] Final --- supervision/annotators/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index 895b8933..7aa4dab0 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -754,7 +754,7 @@ class BlurAnnotator(BaseAnnotator): >>> detections = sv.Detections(...) >>> blur_annotator = sv.BlurAnnotator() - >>> annotated_frame = blur_annotator.annotate( + >>> annotated_frame = circle_annotator.annotate( ... scene=image.copy(), ... detections=detections ... ) From 4baf570b288ebe02c98bd40237d0788aa7362048 Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Sat, 14 Oct 2023 01:12:16 +0300 Subject: [PATCH 015/164] =?UTF-8?q?docs(fix):=20=F0=9F=93=93=20poetry=20en?= =?UTF-8?q?v=20typo=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.md b/docs/index.md index 3019901f..ae3a425a 100644 --- a/docs/index.md +++ b/docs/index.md @@ -63,7 +63,7 @@ You can install `supervision` with pip in a cd supervision # setup python environment and activate it - poetry env use python 3.10 + poetry env use python3.10 poetry shell # headless install From 2ab5941cbcf04cc487efb1d123809e61b8ade5a4 Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Sat, 14 Oct 2023 01:00:26 +0300 Subject: [PATCH 016/164] =?UTF-8?q?feat(assets):=20=E2=9C=A8=20assets=20an?= =?UTF-8?q?d=20assets=20downloader=20add-on=20for=20supervision[assets]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Onuralp SEZER --- poetry.lock | 46 +++++++-------- pyproject.toml | 4 +- supervision/assets/__init__.py | 2 + supervision/assets/asset_list.py | 45 +++++++++++++++ supervision/assets/downloader.py | 99 ++++++++++++++++++++++++++++++++ 5 files changed, 170 insertions(+), 26 deletions(-) create mode 100644 supervision/assets/__init__.py create mode 100644 supervision/assets/asset_list.py create mode 100644 supervision/assets/downloader.py diff --git a/poetry.lock b/poetry.lock index e8f92e94..73270e69 100644 --- a/poetry.lock +++ b/poetry.lock @@ -493,7 +493,6 @@ files = [ {file = "contourpy-1.1.0-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:18a64814ae7bce73925131381603fff0116e2df25230dfc80d6d690aa6e20b37"}, {file = "contourpy-1.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:90c81f22b4f572f8a2110b0b741bb64e5a6427e0a198b2cdc1fbaf85f352a3aa"}, {file = "contourpy-1.1.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:53cc3a40635abedbec7f1bde60f8c189c49e84ac180c665f2cd7c162cc454baa"}, - {file = "contourpy-1.1.0-cp310-cp310-win32.whl", hash = "sha256:9b2dd2ca3ac561aceef4c7c13ba654aaa404cf885b187427760d7f7d4c57cff8"}, {file = "contourpy-1.1.0-cp310-cp310-win_amd64.whl", hash = "sha256:1f795597073b09d631782e7245016a4323cf1cf0b4e06eef7ea6627e06a37ff2"}, {file = "contourpy-1.1.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:0b7b04ed0961647691cfe5d82115dd072af7ce8846d31a5fac6c142dcce8b882"}, {file = "contourpy-1.1.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:27bc79200c742f9746d7dd51a734ee326a292d77e7d94c8af6e08d1e6c15d545"}, @@ -502,7 +501,6 @@ files = [ {file = "contourpy-1.1.0-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:e5cec36c5090e75a9ac9dbd0ff4a8cf7cecd60f1b6dc23a374c7d980a1cd710e"}, {file = "contourpy-1.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1f0cbd657e9bde94cd0e33aa7df94fb73c1ab7799378d3b3f902eb8eb2e04a3a"}, {file = "contourpy-1.1.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:181cbace49874f4358e2929aaf7ba84006acb76694102e88dd15af861996c16e"}, - {file = "contourpy-1.1.0-cp311-cp311-win32.whl", hash = "sha256:edb989d31065b1acef3828a3688f88b2abb799a7db891c9e282df5ec7e46221b"}, {file = "contourpy-1.1.0-cp311-cp311-win_amd64.whl", hash = "sha256:fb3b7d9e6243bfa1efb93ccfe64ec610d85cfe5aec2c25f97fbbd2e58b531256"}, {file = "contourpy-1.1.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:bcb41692aa09aeb19c7c213411854402f29f6613845ad2453d30bf421fe68fed"}, {file = "contourpy-1.1.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:5d123a5bc63cd34c27ff9c7ac1cd978909e9c71da12e05be0231c608048bb2ae"}, @@ -511,7 +509,6 @@ files = [ {file = "contourpy-1.1.0-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:317267d915490d1e84577924bd61ba71bf8681a30e0d6c545f577363157e5e94"}, {file = "contourpy-1.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d551f3a442655f3dcc1285723f9acd646ca5858834efeab4598d706206b09c9f"}, {file = "contourpy-1.1.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:e7a117ce7df5a938fe035cad481b0189049e8d92433b4b33aa7fc609344aafa1"}, - {file = "contourpy-1.1.0-cp38-cp38-win32.whl", hash = "sha256:108dfb5b3e731046a96c60bdc46a1a0ebee0760418951abecbe0fc07b5b93b27"}, {file = "contourpy-1.1.0-cp38-cp38-win_amd64.whl", hash = "sha256:d4f26b25b4f86087e7d75e63212756c38546e70f2a92d2be44f80114826e1cd4"}, {file = "contourpy-1.1.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:bc00bb4225d57bff7ebb634646c0ee2a1298402ec10a5fe7af79df9a51c1bfd9"}, {file = "contourpy-1.1.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:189ceb1525eb0655ab8487a9a9c41f42a73ba52d6789754788d1883fb06b2d8a"}, @@ -520,7 +517,6 @@ files = [ {file = "contourpy-1.1.0-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:143dde50520a9f90e4a2703f367cf8ec96a73042b72e68fcd184e1279962eb6f"}, {file = "contourpy-1.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e94bef2580e25b5fdb183bf98a2faa2adc5b638736b2c0a4da98691da641316a"}, {file = "contourpy-1.1.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:ed614aea8462735e7d70141374bd7650afd1c3f3cb0c2dbbcbe44e14331bf002"}, - {file = "contourpy-1.1.0-cp39-cp39-win32.whl", hash = "sha256:71551f9520f008b2950bef5f16b0e3587506ef4f23c734b71ffb7b89f8721999"}, {file = "contourpy-1.1.0-cp39-cp39-win_amd64.whl", hash = "sha256:438ba416d02f82b692e371858143970ed2eb6337d9cdbbede0d8ad9f3d7dd17d"}, {file = "contourpy-1.1.0-pp38-pypy38_pp73-macosx_10_9_x86_64.whl", hash = "sha256:a698c6a7a432789e587168573a864a7ea374c6be8d4f31f9d87c001d5a843493"}, {file = "contourpy-1.1.0-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:397b0ac8a12880412da3551a8cb5a187d3298a72802b45a3bd1805e204ad8439"}, @@ -1455,16 +1451,6 @@ files = [ {file = "MarkupSafe-2.1.3-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:5bbe06f8eeafd38e5d0a4894ffec89378b6c6a625ff57e3028921f8ff59318ac"}, {file = "MarkupSafe-2.1.3-cp311-cp311-win32.whl", hash = "sha256:dd15ff04ffd7e05ffcb7fe79f1b98041b8ea30ae9234aed2a9168b5797c3effb"}, {file = "MarkupSafe-2.1.3-cp311-cp311-win_amd64.whl", hash = "sha256:134da1eca9ec0ae528110ccc9e48041e0828d79f24121a1a146161103c76e686"}, - {file = "MarkupSafe-2.1.3-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:f698de3fd0c4e6972b92290a45bd9b1536bffe8c6759c62471efaa8acb4c37bc"}, - {file = "MarkupSafe-2.1.3-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:aa57bd9cf8ae831a362185ee444e15a93ecb2e344c8e52e4d721ea3ab6ef1823"}, - {file = "MarkupSafe-2.1.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ffcc3f7c66b5f5b7931a5aa68fc9cecc51e685ef90282f4a82f0f5e9b704ad11"}, - {file = "MarkupSafe-2.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:47d4f1c5f80fc62fdd7777d0d40a2e9dda0a05883ab11374334f6c4de38adffd"}, - {file = "MarkupSafe-2.1.3-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1f67c7038d560d92149c060157d623c542173016c4babc0c1913cca0564b9939"}, - {file = "MarkupSafe-2.1.3-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:9aad3c1755095ce347e26488214ef77e0485a3c34a50c5a5e2471dff60b9dd9c"}, - {file = "MarkupSafe-2.1.3-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:14ff806850827afd6b07a5f32bd917fb7f45b046ba40c57abdb636674a8b559c"}, - {file = "MarkupSafe-2.1.3-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8f9293864fe09b8149f0cc42ce56e3f0e54de883a9de90cd427f191c346eb2e1"}, - {file = "MarkupSafe-2.1.3-cp312-cp312-win32.whl", hash = "sha256:715d3562f79d540f251b99ebd6d8baa547118974341db04f5ad06d5ea3eb8007"}, - {file = "MarkupSafe-2.1.3-cp312-cp312-win_amd64.whl", hash = "sha256:1b8dd8c3fd14349433c79fa8abeb573a55fc0fdd769133baac1f5e07abf54aeb"}, {file = "MarkupSafe-2.1.3-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:8e254ae696c88d98da6555f5ace2279cf7cd5b3f52be2b5cf97feafe883b58d2"}, {file = "MarkupSafe-2.1.3-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cb0932dc158471523c9637e807d9bfb93e06a95cbf010f1a38b98623b929ef2b"}, {file = "MarkupSafe-2.1.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9402b03f1a1b4dc4c19845e5c749e3ab82d5078d16a2a4c2cd2df62d57bb0707"}, @@ -2582,7 +2568,6 @@ files = [ {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:69b023b2b4daa7548bcfbd4aa3da05b3a74b772db9e23b982788168117739938"}, {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:81e0b275a9ecc9c0c0c07b4b90ba548307583c125f54d5b6946cfee6360c733d"}, {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ba336e390cd8e4d1739f42dfe9bb83a3cc2e80f567d8805e11b46f4a943f5515"}, - {file = "PyYAML-6.0.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:326c013efe8048858a6d312ddd31d56e468118ad4cdeda36c719bf5bb6192290"}, {file = "PyYAML-6.0.1-cp310-cp310-win32.whl", hash = "sha256:bd4af7373a854424dabd882decdc5579653d7868b8fb26dc7d0e99f823aa5924"}, {file = "PyYAML-6.0.1-cp310-cp310-win_amd64.whl", hash = "sha256:fd1592b3fdf65fff2ad0004b5e363300ef59ced41c2e6b3a99d4089fa8c5435d"}, {file = "PyYAML-6.0.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:6965a7bc3cf88e5a1c3bd2e0b5c22f8d677dc88a455344035f03399034eb3007"}, @@ -2590,15 +2575,8 @@ files = [ {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:42f8152b8dbc4fe7d96729ec2b99c7097d656dc1213a3229ca5383f973a5ed6d"}, {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:062582fca9fabdd2c8b54a3ef1c978d786e0f6b3a1510e0ac93ef59e0ddae2bc"}, {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d2b04aac4d386b172d5b9692e2d2da8de7bfb6c387fa4f801fbf6fb2e6ba4673"}, - {file = "PyYAML-6.0.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:e7d73685e87afe9f3b36c799222440d6cf362062f78be1013661b00c5c6f678b"}, {file = "PyYAML-6.0.1-cp311-cp311-win32.whl", hash = "sha256:1635fd110e8d85d55237ab316b5b011de701ea0f29d07611174a1b42f1444741"}, {file = "PyYAML-6.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:bf07ee2fef7014951eeb99f56f39c9bb4af143d8aa3c21b1677805985307da34"}, - {file = "PyYAML-6.0.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:855fb52b0dc35af121542a76b9a84f8d1cd886ea97c84703eaa6d88e37a2ad28"}, - {file = "PyYAML-6.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:40df9b996c2b73138957fe23a16a4f0ba614f4c0efce1e9406a184b6d07fa3a9"}, - {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c22bec3fbe2524cde73d7ada88f6566758a8f7227bfbf93a408a9d86bcc12a0"}, - {file = "PyYAML-6.0.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8d4e9c88387b0f5c7d5f281e55304de64cf7f9c0021a3525bd3b1c542da3b0e4"}, - {file = "PyYAML-6.0.1-cp312-cp312-win32.whl", hash = "sha256:d483d2cdf104e7c9fa60c544d92981f12ad66a457afae824d146093b8c294c54"}, - {file = "PyYAML-6.0.1-cp312-cp312-win_amd64.whl", hash = "sha256:0d3304d8c0adc42be59c5f8a4d9e3d7379e6955ad754aa9d6ab7a398b59dd1df"}, {file = "PyYAML-6.0.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:50550eb667afee136e9a77d6dc71ae76a44df8b3e51e41b77f6de2932bfe0f47"}, {file = "PyYAML-6.0.1-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1fe35611261b29bd1de0070f0b2f47cb6ff71fa6595c077e42bd0c419fa27b98"}, {file = "PyYAML-6.0.1-cp36-cp36m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:704219a11b772aea0d8ecd7058d0082713c3562b4e271b849ad7dc4a5c90c13c"}, @@ -2615,7 +2593,6 @@ files = [ {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a0cd17c15d3bb3fa06978b4e8958dcdc6e0174ccea823003a106c7d4d7899ac5"}, {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:28c119d996beec18c05208a8bd78cbe4007878c6dd15091efb73a30e90539696"}, {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7e07cbde391ba96ab58e532ff4803f79c4129397514e1413a7dc761ccd755735"}, - {file = "PyYAML-6.0.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:49a183be227561de579b4a36efbb21b3eab9651dd81b1858589f796549873dd6"}, {file = "PyYAML-6.0.1-cp38-cp38-win32.whl", hash = "sha256:184c5108a2aca3c5b3d3bf9395d50893a7ab82a38004c8f61c258d4428e80206"}, {file = "PyYAML-6.0.1-cp38-cp38-win_amd64.whl", hash = "sha256:1e2722cc9fbb45d9b87631ac70924c11d3a401b2d7f410cc0e3bbf249f2dca62"}, {file = "PyYAML-6.0.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:9eb6caa9a297fc2c2fb8862bc5370d0303ddba53ba97e71f08023b6cd73d16a8"}, @@ -2623,7 +2600,6 @@ files = [ {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5773183b6446b2c99bb77e77595dd486303b4faab2b086e7b17bc6bef28865f6"}, {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b786eecbdf8499b9ca1d697215862083bd6d2a99965554781d0d8d1ad31e13a0"}, {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bc1bf2925a1ecd43da378f4db9e4f799775d6367bdb94671027b73b393a7c42c"}, - {file = "PyYAML-6.0.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:04ac92ad1925b2cff1db0cfebffb6ffc43457495c9b3c39d3fcae417d7125dc5"}, {file = "PyYAML-6.0.1-cp39-cp39-win32.whl", hash = "sha256:faca3bdcf85b2fc05d06ff3fbc1f83e1391b3e724afa3feba7d13eeab355484c"}, {file = "PyYAML-6.0.1-cp39-cp39-win_amd64.whl", hash = "sha256:510c9deebc5c0225e8c96813043e62b680ba2f9c50a08d3724c7f28a747d1486"}, {file = "PyYAML-6.0.1.tar.gz", hash = "sha256:bfdf460b1736c775f2ba9f6a92bca30bc2095067b8a9d77876d1fad6cc3b4a43"}, @@ -3294,6 +3270,26 @@ files = [ {file = "tornado-6.3.3.tar.gz", hash = "sha256:e7d8db41c0181c80d76c982aacc442c0783a2c54d6400fe028954201a2e032fe"}, ] +[[package]] +name = "tqdm" +version = "4.66.1" +description = "Fast, Extensible Progress Meter" +optional = false +python-versions = ">=3.7" +files = [ + {file = "tqdm-4.66.1-py3-none-any.whl", hash = "sha256:d302b3c5b53d47bce91fea46679d9c3c6508cf6332229aa1e7d8653723793386"}, + {file = "tqdm-4.66.1.tar.gz", hash = "sha256:d88e651f9db8d8551a62556d3cff9e3034274ca5d66e93197cf2490e2dcb69c7"}, +] + +[package.dependencies] +colorama = {version = "*", markers = "platform_system == \"Windows\""} + +[package.extras] +dev = ["pytest (>=6)", "pytest-cov", "pytest-timeout", "pytest-xdist"] +notebook = ["ipywidgets (>=6)"] +slack = ["slack-sdk"] +telegram = ["requests"] + [[package]] name = "traitlets" version = "5.9.0" @@ -3520,4 +3516,4 @@ desktop = ["opencv-python"] [metadata] lock-version = "2.0" python-versions = ">=3.8,<3.12.0" -content-hash = "beb692d89611ce85f8b2992f4e6da71fd14fa2ca75742ddae1a1c7b77df134f7" +content-hash = "88f2cd2cce563de66fa9ea5b877ff83a971047b33d2860dd9964e463fd4c1433" diff --git a/pyproject.toml b/pyproject.toml index d78a50b7..7c96ff69 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,11 +43,13 @@ pillow = ">=9.4,<11.0" opencv-python = { version = "^4.8.0.74", optional = true } opencv-python-headless = "^4.8.0.74" scipy = "^1.9.0" +requests = { version = "^2.31.0", optional = true } +tqdm = { version = "^4.66.1", optional = true } [tool.poetry.extras] desktop = ["opencv-python"] - +assets = ["requests","tqdm"] [tool.poetry.group.dev.dependencies] twine = "^4.0.2" diff --git a/supervision/assets/__init__.py b/supervision/assets/__init__.py new file mode 100644 index 00000000..17119d2e --- /dev/null +++ b/supervision/assets/__init__.py @@ -0,0 +1,2 @@ +from .asset_list import VideoAssets +from .downloader import download_assets diff --git a/supervision/assets/asset_list.py b/supervision/assets/asset_list.py new file mode 100644 index 00000000..588cdff3 --- /dev/null +++ b/supervision/assets/asset_list.py @@ -0,0 +1,45 @@ +from enum import Enum + +BASE_VIDEO_URL = "https://media.roboflow.com/supervision/video-examples/" + + +class VideoAssets(Enum): + VEHICLES = "vehicles.mp4" + MILK_1 = "milk-video-1.mp4" + VEHICLES_2 = "vehicles-2.mp4" + GROCERY_STORE = "grocery-store.mp4" + SUBWAY = "subway.mp4" + MARKET_SQUARE = "market-square.mp4" + PEOPLE_WALKING_BW = "people-walking-bw.mp4" + + +VIDEO_ASSETS: dict[str : tuple[str]] = { + VideoAssets.VEHICLES.value: ( + f"{BASE_VIDEO_URL}{VideoAssets.VEHICLES.value}", + "8155ff4e4de08cfa25f39de96483f918", + ), + VideoAssets.VEHICLES_2.value: ( + f"{BASE_VIDEO_URL}{VideoAssets.VEHICLES_2.value}", + "830af6fba21ffbf14867a7fea595937b", + ), + VideoAssets.MILK_1.value: ( + f"{BASE_VIDEO_URL}{VideoAssets.MILK_1.value}", + "9e8fb6e883f842a38b3d34267290bdc7", + ), + VideoAssets.GROCERY_STORE.value: ( + f"{BASE_VIDEO_URL}{VideoAssets.GROCERY_STORE.value}", + "11402e7b861c1980527d3d74cbe3b366", + ), + VideoAssets.SUBWAY.value: ( + f"{BASE_VIDEO_URL}{VideoAssets.SUBWAY.value}", + "453475750691fb23c56a0cffef089194", + ), + VideoAssets.MARKET_SQUARE.value: ( + f"{BASE_VIDEO_URL}{VideoAssets.MARKET_SQUARE.value}", + "859179bf4a21f80a8baabfdb2ed716dc", + ), + VideoAssets.PEOPLE_WALKING_BW.value: ( + f"{BASE_VIDEO_URL}{VideoAssets.PEOPLE_WALKING_BW.value}", + "0574c053c8686c3f1dc0aa3743e45cb9", + ), +} diff --git a/supervision/assets/downloader.py b/supervision/assets/downloader.py new file mode 100644 index 00000000..b5312d9c --- /dev/null +++ b/supervision/assets/downloader.py @@ -0,0 +1,99 @@ +from functools import partial +from hashlib import md5 +from os import remove as os_remove +from os.path import exists as path_exists +from pathlib import Path +from shutil import copyfileobj +from typing import Union + +from supervision.assets import VideoAssets +from supervision.assets.asset_list import VIDEO_ASSETS + +try: + from requests import Response, get + from tqdm.auto import tqdm +except ImportError: + raise ValueError( + "\n" + "Please install requests and tqdm to download assets \n" + "or install supervision with assets \n" + "pip install supervision[assets] \n" + "\n" + ) + + +# md5 check function +def _check_md5(filename: str, orig_md5: str) -> bool: + """ + filename: str, A string representing the path to the file. + orig_md5: str, A string representing the original md5 hash. + """ + if not path_exists(filename): + return False + with open(filename, "rb") as file_to_check: + # read contents of the file + data = file_to_check.read() + # pipe contents of the file through + md5_returned = md5(data).hexdigest() + # Return True if the computed hash matches the original one + if md5_returned == orig_md5: + return True + return False + + +def download_assets(asset_name: Union[VideoAssets, str]) -> str: + """ + asset_name: VIDEO_ASSETS, name of the file to download + """ + + filename = f"{asset_name}" + if not path_exists(filename) and asset_name in VIDEO_ASSETS: + print(f"Downloading {filename} assets \n") + res: Response = get( + VIDEO_ASSETS[asset_name][0], stream=True, allow_redirects=True + ) + if res.status_code != 200: + res.raise_for_status() + raise RuntimeError( + f"Request to {VIDEO_ASSETS[asset_name][0]} " + f"returned status code {res.status_code}" + ) + + file_size: int = int(res.headers.get("Content-Length", 0)) + folder_path: Path = Path(filename).expanduser().resolve() + folder_path.parent.mkdir(parents=True, exist_ok=True) + + desc = "(Unknown total file size)" if file_size == 0 else "" + res.raw.read = partial( + res.raw.read, decode_content=True + ) # Decompress if needed + with tqdm.wrapattr( + res.raw, + "read", + total=file_size, + desc=desc, + colour="a351fb", + ) as r_raw: + with folder_path.open("wb") as f: + copyfileobj(r_raw, f) + + elif path_exists(filename): + if not _check_md5(filename, VIDEO_ASSETS[asset_name][2]): + print("File corrupted. Re-downloading... \n") + os_remove(filename) + download_assets(asset_name) + + print(f"{filename} asset download complete. \n") + else: + raise ValueError( + "Invalid asset type. It should be one of the following: \n" + "vehicles.mp4 \n" + "vehicles-2.mp4 \n" + "milk-video-1.mp4 \n" + "grocery-store.mp4 \n" + "subway.mp4 \n" + "market-square.mp4 \n" + "people-walking-bw.mp4 \n" + ) + + return filename From f3b92163ad5a94244ad823692b94126229e9c506 Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Sat, 14 Oct 2023 18:08:46 +0300 Subject: [PATCH 017/164] =?UTF-8?q?ci(dependabot):=20=E2=AC=86=EF=B8=8F=20?= =?UTF-8?q?create=20dependabot.yml=20config=20for=20update=20github=20acti?= =?UTF-8?q?ons=20and=20python=20packages=20automatically?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/dependabot.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..6de587d1 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,16 @@ +version: 2 +updates: + # GitHub Actions + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" + commit-message: + prefix: ⬆️ + # Python + - package-ecosystem: "pip" + directory: "/" + schedule: + interval: "daily" + commit-message: + prefix: ⬆️ From 338c589032336ff51a93096182a5405d992f2598 Mon Sep 17 00:00:00 2001 From: abhishek7kalra Date: Sun, 15 Oct 2023 17:42:40 +0530 Subject: [PATCH 018/164] LineZone.trigger update to return info --- supervision/detection/line_counter.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/supervision/detection/line_counter.py b/supervision/detection/line_counter.py index ea97fcb8..db86e3f9 100644 --- a/supervision/detection/line_counter.py +++ b/supervision/detection/line_counter.py @@ -26,6 +26,7 @@ class LineZone: self.tracker_state: Dict[str, bool] = {} self.in_count: int = 0 self.out_count: int = 0 + self.crossed = [] def trigger(self, detections: Detections): """ @@ -33,9 +34,14 @@ class LineZone: Attributes: detections (Detections): The detections for which to update the counts. - + + Returns: + np.ndarray: A boolean array indicating + which detection has crossed the line on the either sides """ - for xyxy, _, confidence, class_id, tracker_id in detections: + self.crossed = [False] * len(detections) + + for i, (xyxy, _, confidence, class_id, tracker_id) in enumerate(detections): # handle detections with no tracker_id if tracker_id is None: continue @@ -67,8 +73,13 @@ class LineZone: self.tracker_state[tracker_id] = tracker_state if tracker_state: self.in_count += 1 + self.crossed[i] = True + else: self.out_count += 1 + self.crossed[i] = True + + return self.crossed class LineZoneAnnotator: From bf725ef0f72699079152d3630a5f27c6acf27311 Mon Sep 17 00:00:00 2001 From: abhishek7kalra Date: Sun, 15 Oct 2023 18:10:54 +0530 Subject: [PATCH 019/164] fix pre-commit --- supervision/detection/line_counter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/supervision/detection/line_counter.py b/supervision/detection/line_counter.py index db86e3f9..1c1fe770 100644 --- a/supervision/detection/line_counter.py +++ b/supervision/detection/line_counter.py @@ -34,7 +34,7 @@ class LineZone: Attributes: detections (Detections): The detections for which to update the counts. - + Returns: np.ndarray: A boolean array indicating which detection has crossed the line on the either sides From fe8a8260dcdf1181d28c0de4d748c3c557c08a90 Mon Sep 17 00:00:00 2001 From: abhishek7kalra Date: Sun, 15 Oct 2023 19:06:18 +0530 Subject: [PATCH 020/164] change return type from list to nparray --- supervision/detection/line_counter.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/supervision/detection/line_counter.py b/supervision/detection/line_counter.py index 1c1fe770..c668354e 100644 --- a/supervision/detection/line_counter.py +++ b/supervision/detection/line_counter.py @@ -26,9 +26,8 @@ class LineZone: self.tracker_state: Dict[str, bool] = {} self.in_count: int = 0 self.out_count: int = 0 - self.crossed = [] - def trigger(self, detections: Detections): + def trigger(self, detections: Detections) -> np.ndarray: """ Update the in_count and out_count for the detections that cross the line. @@ -39,7 +38,7 @@ class LineZone: np.ndarray: A boolean array indicating which detection has crossed the line on the either sides """ - self.crossed = [False] * len(detections) + crossed = np.full(len(detections), False) for i, (xyxy, _, confidence, class_id, tracker_id) in enumerate(detections): # handle detections with no tracker_id @@ -73,13 +72,13 @@ class LineZone: self.tracker_state[tracker_id] = tracker_state if tracker_state: self.in_count += 1 - self.crossed[i] = True + crossed[i] = True else: self.out_count += 1 - self.crossed[i] = True + crossed[i] = True - return self.crossed + return crossed class LineZoneAnnotator: From 75db51aa908d94f0befcbfc3c69605c3543b78ae Mon Sep 17 00:00:00 2001 From: James Gallagher Date: Mon, 16 Oct 2023 09:00:12 +0100 Subject: [PATCH 021/164] add 404 page --- custom_theme/404.html | 7 +++++++ mkdocs.yml | 1 + 2 files changed, 8 insertions(+) create mode 100644 custom_theme/404.html diff --git a/custom_theme/404.html b/custom_theme/404.html new file mode 100644 index 00000000..81639b40 --- /dev/null +++ b/custom_theme/404.html @@ -0,0 +1,7 @@ +{% extends "main.html" %} + +{% block content %} +

Page Not Found

+

The page you have requested was not found.

+

Go back to the documentation home.

+{% endblock %} \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index 6528b238..e3816bd8 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -76,6 +76,7 @@ theme: font: text: Roboto code: Roboto Mono + custom_dir: 'custom_theme' plugins: - mkdocstrings From 3d843d710dbf8154214d71ed9cf0c17fcc00f1b7 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 16 Oct 2023 08:04:16 +0000 Subject: [PATCH 022/164] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom_theme/404.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/custom_theme/404.html b/custom_theme/404.html index 81639b40..4ce71946 100644 --- a/custom_theme/404.html +++ b/custom_theme/404.html @@ -1,7 +1,7 @@ -{% extends "main.html" %} +{% extends "main.html" %} {% block content %} -

Page Not Found

+

Page Not Found

The page you have requested was not found.

Go back to the documentation home.

-{% endblock %} \ No newline at end of file +{% endblock %} From 1ab50cdb3c21661923a00f875f40c137acec59b7 Mon Sep 17 00:00:00 2001 From: James Gallagher Date: Mon, 16 Oct 2023 13:06:43 +0100 Subject: [PATCH 023/164] add / to mkdocs site_url --- mkdocs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkdocs.yml b/mkdocs.yml index e3816bd8..542a7ad5 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,5 +1,5 @@ site_name: Supervision -site_url: https://roboflow.github.io/supervision +site_url: https://roboflow.github.io/supervision/ site_author: Roboflow site_description: A set of easy-to-use utils that will come in handy in any Computer Vision project repo_name: roboflow/supervision From eda6909c91ccc53588095f48d34616bc1467d344 Mon Sep 17 00:00:00 2001 From: James Gallagher Date: Mon, 16 Oct 2023 13:10:52 +0100 Subject: [PATCH 024/164] change domain to supervision.roboflow.com in mkdocs --- mkdocs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkdocs.yml b/mkdocs.yml index 542a7ad5..276c85dc 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,5 +1,5 @@ site_name: Supervision -site_url: https://roboflow.github.io/supervision/ +site_url: https://supervision.roboflow.com/ site_author: Roboflow site_description: A set of easy-to-use utils that will come in handy in any Computer Vision project repo_name: roboflow/supervision From b2e9a668b2c9ae74b0e62926b4948f16506fd3c8 Mon Sep 17 00:00:00 2001 From: PankajKrana Date: Tue, 17 Oct 2023 01:48:54 +0530 Subject: [PATCH 025/164] Create sv.DotMarkerAnnotator #396 --- .../annotators/dot_marker_annotator.py | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 supervision/annotators/dot_marker_annotator.py diff --git a/supervision/annotators/dot_marker_annotator.py b/supervision/annotators/dot_marker_annotator.py new file mode 100644 index 00000000..4f931b5f --- /dev/null +++ b/supervision/annotators/dot_marker_annotator.py @@ -0,0 +1,46 @@ +from typing import Union +import numpy as np +import cv2 +from supervision import Color, ColorPalette, Position, Detections +from supervision.annotators.base import BaseAnnotator + + + +class DotMarkerAnnotator(BaseAnnotator): + def __init__( + self, + color: Union[Color, ColorPalette] = ColorPalette.default(), + radius: int = 4, + position: Position = Position.CENTER, + color_map: str = "class", + ): + self.color = color + self.radius = radius + self.position = position + self.color_map = color_map + + def annotate( + self, + scene: np.ndarray, + detections: Detections, + ) -> np.ndarray: + annotated_scene = scene.copy() + + for detection in detections: + dot_color = self._get_color(detection) + box_position = detection.bounding_box.get_position(self.position) + dot_position = (int(box_position[0]), int(box_position[1])) + cv2.circle(annotated_scene, dot_position, self.radius, dot_color, -1) + + return annotated_scene + + def _get_color(self, detection): + if self.color_map == "class": + return self.color[detection.class_id] + elif self.color_map == "index": + return self.color[detection.index % len(self.color)] + elif self.color_map == "track": + return self.color[detection.track_id % len(self.color)] + else: + raise ValueError("Invalid color mapping strategy") + From 72a780b74acd35ac5179f57ae95ac5c81e414097 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 17 Oct 2023 21:06:21 +0000 Subject: [PATCH 026/164] Bump urllib3 from 2.0.6 to 2.0.7 Bumps [urllib3](https://github.com/urllib3/urllib3) from 2.0.6 to 2.0.7. - [Release notes](https://github.com/urllib3/urllib3/releases) - [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst) - [Commits](https://github.com/urllib3/urllib3/compare/2.0.6...2.0.7) --- updated-dependencies: - dependency-name: urllib3 dependency-type: indirect ... Signed-off-by: dependabot[bot] --- poetry.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/poetry.lock b/poetry.lock index e8f92e94..7065eb8b 100644 --- a/poetry.lock +++ b/poetry.lock @@ -3358,13 +3358,13 @@ dev = ["flake8", "flake8-annotations", "flake8-bandit", "flake8-bugbear", "flake [[package]] name = "urllib3" -version = "2.0.6" +version = "2.0.7" description = "HTTP library with thread-safe connection pooling, file post, and more." optional = false python-versions = ">=3.7" files = [ - {file = "urllib3-2.0.6-py3-none-any.whl", hash = "sha256:7a7c7003b000adf9e7ca2a377c9688bbc54ed41b985789ed576570342a375cd2"}, - {file = "urllib3-2.0.6.tar.gz", hash = "sha256:b19e1a85d206b56d7df1d5e683df4a7725252a964e3993648dd0fb5a1c157564"}, + {file = "urllib3-2.0.7-py3-none-any.whl", hash = "sha256:fdb6d215c776278489906c2f8916e6e7d4f5a9b602ccbcfdf7f016fc8da0596e"}, + {file = "urllib3-2.0.7.tar.gz", hash = "sha256:c97dfde1f7bd43a71c8d2a58e369e9b2bf692d1334ea9f9cae55add7d0dd0f84"}, ] [package.extras] From db4afe98854e24fe646d9a35d1f8cbe7fa4a8843 Mon Sep 17 00:00:00 2001 From: James Gallagher Date: Wed, 18 Oct 2023 10:20:42 +0100 Subject: [PATCH 027/164] add how to detect and annotate guide --- docs/how_to/detect_and_annotate.md | 64 +++++++++++++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) diff --git a/docs/how_to/detect_and_annotate.md b/docs/how_to/detect_and_annotate.md index c9497945..987b311e 100644 --- a/docs/how_to/detect_and_annotate.md +++ b/docs/how_to/detect_and_annotate.md @@ -1 +1,63 @@ -🚧 Page under construction. +## How to Detect and Annotate + +Supervision enables you to annotate predictions from object detection and segmentation models in a few lines of code. + +The `sv.BoxAnnotator()` class lets you annotate images with bounding boxes, while the `sv.MaskAnnotator()` class lets you annotate images with segmentation masks. `sv.MaskAnnotator()` is a drop-in replacement for `sv.BoxAnnotator()`, so you don't need to update any other code if you want to switch between the two. + +In this guide, we run inference on an Ultralytics YOLOv8 object detection model and plot the predictions with the `sv.BoxAnnotator()` class. + +## Load a Model and Retrieve Predictions + +First, we need to retrieve predictions from a model. For this guide, we will retrieve predictions from a YOLOv8 model. See a list of all models from which you can load predictions into supervision. + +```python +import supervision as sv +from ultralytics import YOLO +import cv2 + +model = YOLO("yolov8n.pt") + +results = model("image.jpg") +``` + +In this code, we import `supervision`, `ultralytics`, and `cv2` (OpenCV). We then load a YOLOv8 object detection model, then run inference on an image called `image.jpg`. The `results` variable contains the predictions from the model. + +## Load Predictions into Supervision + +Now that we have predictions from a model, we can load them into supervision. + +We can do so using the `sv.Detections.from_ultralytics()` method, which accepts model results from Ultralytics models. See a list of other supported data loaders. + +```python +detections = sv.Detections.from_ultralytics(results) +``` + +## Annotate Image + +Next, we can annotate the image with the predictions returned by our model. Since we are working with an object detection model, we will use the `sv.BoxAnnotator()` class to annotate an image with predictions. + +```python +image = cv2.imread("image.jpg") + +annotator = sv.BoxAnnotator() + +annotated_image = annotator.annotate(image, detections) +``` + +In this code, we: + +1. Load the image to annotate. +2. Create a `sv.BoxAnnotator()` object to annotate the image. +3. Use the `annotate()` method to annotate the image with the predictions. + +## Display Annotated Image + +Finally, we can display the annotated image: + +```python +sv.plot_image(annotated_image) +``` + +Here is the result: + +![Predictions plotted on an image](https://media.roboflow.com/supervision_annotate.png) \ No newline at end of file From 1ddb78b662feb760a60b24bb7a9520328021155b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 18 Oct 2023 09:22:43 +0000 Subject: [PATCH 028/164] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/how_to/detect_and_annotate.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/how_to/detect_and_annotate.md b/docs/how_to/detect_and_annotate.md index 987b311e..a84f5e0e 100644 --- a/docs/how_to/detect_and_annotate.md +++ b/docs/how_to/detect_and_annotate.md @@ -60,4 +60,4 @@ sv.plot_image(annotated_image) Here is the result: -![Predictions plotted on an image](https://media.roboflow.com/supervision_annotate.png) \ No newline at end of file +![Predictions plotted on an image](https://media.roboflow.com/supervision_annotate.png) From a7449ba56fb99a91d7bd6b78c3b3465f61b1910e Mon Sep 17 00:00:00 2001 From: Piotr Skalski Date: Wed, 18 Oct 2023 12:42:26 +0200 Subject: [PATCH 029/164] Update README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index ffb88e98..78d8fbf0 100644 --- a/README.md +++ b/README.md @@ -364,5 +364,4 @@ We love your input! Please see our [contributing guide](https://github.com/robof - From a5a853e1415244e3d9f9d684cc9ab1b9af246674 Mon Sep 17 00:00:00 2001 From: James Gallagher Date: Wed, 18 Oct 2023 13:11:29 +0100 Subject: [PATCH 030/164] resolve conflict --- docs/how_to/detect_and_annotate.md | 36 +++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/docs/how_to/detect_and_annotate.md b/docs/how_to/detect_and_annotate.md index a84f5e0e..891e18df 100644 --- a/docs/how_to/detect_and_annotate.md +++ b/docs/how_to/detect_and_annotate.md @@ -2,9 +2,18 @@ Supervision enables you to annotate predictions from object detection and segmentation models in a few lines of code. -The `sv.BoxAnnotator()` class lets you annotate images with bounding boxes, while the `sv.MaskAnnotator()` class lets you annotate images with segmentation masks. `sv.MaskAnnotator()` is a drop-in replacement for `sv.BoxAnnotator()`, so you don't need to update any other code if you want to switch between the two. +The `sv.BoxAnnotator` class lets you annotate images with bounding boxes, while the `sv.MaskAnnotator` class lets you annotate images with segmentation masks. `sv.MaskAnnotator` is a drop-in replacement for `sv.BoxAnnotator`, so you don't need to update any other code if you want to switch between the two. -In this guide, we run inference on an Ultralytics YOLOv8 object detection model and plot the predictions with the `sv.BoxAnnotator()` class. +In this guide, we run inference on an Ultralytics YOLOv8 object detection model and plot the predictions with the `sv.BoxAnnotator` class. You can also load predictions using: + +- `from_deepsparse` (Deepsparse) +- `from_detectron2` (Detectron2) +- `from_mmdetection` (MMDetection) +- `from_ultralytics` (Ultralytics) +- `from_roboflow` (Roboflow) +- `from_sam` (Segment Anything Model) +- `from_transformers` (Hugging Face Transformers) +- `from_yolo_nas` (YOLO-NAS) ## Load a Model and Retrieve Predictions @@ -20,35 +29,42 @@ model = YOLO("yolov8n.pt") results = model("image.jpg") ``` -In this code, we import `supervision`, `ultralytics`, and `cv2` (OpenCV). We then load a YOLOv8 object detection model, then run inference on an image called `image.jpg`. The `results` variable contains the predictions from the model. +In this code, we import `supervision`, `ultralytics`, and `cv2` (OpenCV). We load then load a YOLOv8 object detection model, then run inference on an image called `image.jpg`. The image is loaded using OpenCV. The `results` variable contains the predictions from the model. ## Load Predictions into Supervision Now that we have predictions from a model, we can load them into supervision. -We can do so using the `sv.Detections.from_ultralytics()` method, which accepts model results from Ultralytics models. See a list of other supported data loaders. +We can do so using the `sv.Detections.from_ultralytics` method, which accepts model results from Ultralytics models. See a list of other supported data loaders. ```python -detections = sv.Detections.from_ultralytics(results) +detections = sv.Detections.from_ultralytics(results[0]) ``` ## Annotate Image -Next, we can annotate the image with the predictions returned by our model. Since we are working with an object detection model, we will use the `sv.BoxAnnotator()` class to annotate an image with predictions. +Next, we can annotate the image with the predictions returned by our model. Since we are working with an object detection model, we will use the `sv.BoxAnnotator` class to annotate an image with predictions. ```python image = cv2.imread("image.jpg") annotator = sv.BoxAnnotator() -annotated_image = annotator.annotate(image, detections) +labels = [ + results.names[class_id] + for class_id + in detections.class_id +] + +annotated_image = annotator.annotate(image, detections, labels) ``` In this code, we: 1. Load the image to annotate. -2. Create a `sv.BoxAnnotator()` object to annotate the image. -3. Use the `annotate()` method to annotate the image with the predictions. +2. Create a `sv.BoxAnnotator` object to annotate the image. +3. Create a list of labels for each prediction. In this example, we get the class name associated with each class ID using the `results[0].names` attribute available in the `results` object` +3. Use the `annotate` method to annotate the image with the predictions. ## Display Annotated Image @@ -60,4 +76,4 @@ sv.plot_image(annotated_image) Here is the result: -![Predictions plotted on an image](https://media.roboflow.com/supervision_annotate.png) +![Predictions plotted on an image](https://media.roboflow.com/supervision_annotate_example.png) From 8dcfb427511f800e67948fa7941d35a3a6311542 Mon Sep 17 00:00:00 2001 From: James Gallagher Date: Wed, 18 Oct 2023 13:13:09 +0100 Subject: [PATCH 031/164] add data loader link --- docs/how_to/detect_and_annotate.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/how_to/detect_and_annotate.md b/docs/how_to/detect_and_annotate.md index 891e18df..7c121fa2 100644 --- a/docs/how_to/detect_and_annotate.md +++ b/docs/how_to/detect_and_annotate.md @@ -35,7 +35,7 @@ In this code, we import `supervision`, `ultralytics`, and `cv2` (OpenCV). We loa Now that we have predictions from a model, we can load them into supervision. -We can do so using the `sv.Detections.from_ultralytics` method, which accepts model results from Ultralytics models. See a list of other supported data loaders. +We can do so using the `sv.Detections.from_ultralytics` method, which accepts model results from Ultralytics models. [See a list of other supported data loaders](https://supervision.roboflow.com/detection/core/#supervision.detection.core.Detections.from_deepsparse). ```python detections = sv.Detections.from_ultralytics(results[0]) From 00e209744fc89e0f9a235da333bd578dd5c47d5c Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Wed, 18 Oct 2023 14:42:59 +0200 Subject: [PATCH 032/164] Add documentation and improvements to "LineZone" functionality Descriptions for various attributes and functionalities have been added into LineZone class to aid developers in understanding their behaviour. Also, the trigger function was modified to return two separate boolean arrays - 'crossed_in' and 'crossed_out' to denote objects crossing the line in specific directions. Moreover, Line Zone documentation is added to the side navigation in mkdocs.yml. --- docs/detection/tools/line_zone.md | 3 ++ mkdocs.yml | 1 + supervision/detection/line_counter.py | 53 ++++++++++++++++----------- 3 files changed, 35 insertions(+), 22 deletions(-) create mode 100644 docs/detection/tools/line_zone.md diff --git a/docs/detection/tools/line_zone.md b/docs/detection/tools/line_zone.md new file mode 100644 index 00000000..3e15a00e --- /dev/null +++ b/docs/detection/tools/line_zone.md @@ -0,0 +1,3 @@ +## LineZone + +:::supervision.detection.line_counter.LineZone \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index 276c85dc..f511cb2f 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -39,6 +39,7 @@ nav: - Core: detection/core.md - Utils: detection/utils.md - Tools: + - Line Zone: detection/tools/line_zone.md - Polygon Zone: detection/tools/polygon_zone.md - Inference Slicer: detection/tools/inference_slicer.md - Annotators: annotators.md diff --git a/supervision/detection/line_counter.py b/supervision/detection/line_counter.py index c668354e..851d1d4a 100644 --- a/supervision/detection/line_counter.py +++ b/supervision/detection/line_counter.py @@ -1,4 +1,4 @@ -from typing import Dict, Optional +from typing import Dict, Optional, Tuple import cv2 import numpy as np @@ -10,42 +10,54 @@ from supervision.geometry.core import Point, Rect, Vector class LineZone: """ - Count the number of objects that cross a line. + This class is responsible for counting the number of objects that cross a + predefined line. + + !!! warning + + LineZone utilizes the `tracker_id`. Read + [here](https://supervision.roboflow.com/trackers/) to learn how to plug + tracking into your inference pipeline. + + Attributes: + in_count (int): The number of objects that have crossed the line from outside + to inside. + out_count (int): The number of objects that have crossed the line from inside + to outside. """ def __init__(self, start: Point, end: Point): """ - Initialize a LineCounter object. - - Attributes: + Args: start (Point): The starting point of the line. end (Point): The ending point of the line. - """ self.vector = Vector(start=start, end=end) self.tracker_state: Dict[str, bool] = {} self.in_count: int = 0 self.out_count: int = 0 - def trigger(self, detections: Detections) -> np.ndarray: + def trigger(self, detections: Detections) -> Tuple[np.ndarray, np.ndarray]: """ - Update the in_count and out_count for the detections that cross the line. + Update the `in_count` and `out_count` based on the objects that cross the line. - Attributes: - detections (Detections): The detections for which to update the counts. + Args: + detections (Detections): A list of detections for which to update the + counts. Returns: - np.ndarray: A boolean array indicating - which detection has crossed the line on the either sides + A tuple of two boolean NumPy arrays. The first array indicates which + detections have crossed the line from outside to inside. The second + array indicates which detections have crossed the line from inside to + outside. """ - crossed = np.full(len(detections), False) + crossed_in = np.full(len(detections), False) + crossed_out = np.full(len(detections), False) for i, (xyxy, _, confidence, class_id, tracker_id) in enumerate(detections): - # handle detections with no tracker_id if tracker_id is None: continue - # we check if all four anchors of bbox are on the same side of vector x1, y1, x2, y2 = xyxy anchors = [ Point(x=x1, y=y1), @@ -55,30 +67,27 @@ class LineZone: ] triggers = [self.vector.is_in(point=anchor) for anchor in anchors] - # detection is partially in and partially out if len(set(triggers)) == 2: continue tracker_state = triggers[0] - # handle new detection + if tracker_id not in self.tracker_state: self.tracker_state[tracker_id] = tracker_state continue - # handle detection on the same side of the line if self.tracker_state.get(tracker_id) == tracker_state: continue self.tracker_state[tracker_id] = tracker_state if tracker_state: self.in_count += 1 - crossed[i] = True - + crossed_in[i] = True else: self.out_count += 1 - crossed[i] = True + crossed_out[i] = True - return crossed + return crossed_in, crossed_out class LineZoneAnnotator: From 62c45548a63bdf47165fa017fd59b36f620f5e6b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 18 Oct 2023 12:44:19 +0000 Subject: [PATCH 033/164] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/detection/tools/line_zone.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/detection/tools/line_zone.md b/docs/detection/tools/line_zone.md index 3e15a00e..cbecdaa9 100644 --- a/docs/detection/tools/line_zone.md +++ b/docs/detection/tools/line_zone.md @@ -1,3 +1,3 @@ ## LineZone -:::supervision.detection.line_counter.LineZone \ No newline at end of file +:::supervision.detection.line_counter.LineZone From 61809f9329c40a4d2941c532f397cb6317d0ee2b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 18 Oct 2023 13:53:25 +0000 Subject: [PATCH 034/164] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/annotators/dot_marker_annotator.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/supervision/annotators/dot_marker_annotator.py b/supervision/annotators/dot_marker_annotator.py index 4f931b5f..ecdb9af0 100644 --- a/supervision/annotators/dot_marker_annotator.py +++ b/supervision/annotators/dot_marker_annotator.py @@ -1,9 +1,10 @@ from typing import Union -import numpy as np -import cv2 -from supervision import Color, ColorPalette, Position, Detections -from supervision.annotators.base import BaseAnnotator +import cv2 +import numpy as np + +from supervision import Color, ColorPalette, Detections, Position +from supervision.annotators.base import BaseAnnotator class DotMarkerAnnotator(BaseAnnotator): @@ -43,4 +44,3 @@ class DotMarkerAnnotator(BaseAnnotator): return self.color[detection.track_id % len(self.color)] else: raise ValueError("Invalid color mapping strategy") - From fabfe0783aad29a6fa6475016075ebe05772a354 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Wed, 18 Oct 2023 18:09:13 +0200 Subject: [PATCH 035/164] Refactor DotMarkerAnnotator and merge into core annotators The DotMarkerAnnotator class has been refactored and named DotAnnotator for simplicity. It's now part of the core annotators to conform with the project structure. The color lookup on the DotAnnotator now uses the 'color_lookup' parameter, allowing for more flexibility and customization in the colors used for the annotations. All the changes aim to standardize the way different annotators are organized and make color customization easier. --- supervision/__init__.py | 1 + supervision/annotators/core.py | 33 +++++++++++++ .../annotators/dot_marker_annotator.py | 46 ------------------- 3 files changed, 34 insertions(+), 46 deletions(-) delete mode 100644 supervision/annotators/dot_marker_annotator.py diff --git a/supervision/__init__.py b/supervision/__init__.py index 31d01314..b1d25337 100644 --- a/supervision/__init__.py +++ b/supervision/__init__.py @@ -12,6 +12,7 @@ from supervision.annotators.core import ( BoxCornerAnnotator, BoxMaskAnnotator, CircleAnnotator, + DotAnnotator, EllipseAnnotator, HaloAnnotator, LabelAnnotator, diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index 8005f49b..3bde610a 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -602,6 +602,39 @@ class CircleAnnotator(BaseAnnotator): return scene +class DotAnnotator(BaseAnnotator): + def __init__( + self, + color: Union[Color, ColorPalette] = ColorPalette.default(), + radius: int = 4, + position: Position = Position.CENTER, + color_lookup: ColorLookup = ColorLookup.CLASS, + ): + self.color: Union[Color, ColorPalette] = color + self.radius: int = radius + self.position: Position = position + self.color_lookup: ColorLookup = color_lookup + + def annotate( + self, + scene: np.ndarray, + detections: Detections, + custom_color_lookup: Optional[np.ndarray] = None, + ) -> np.ndarray: + xy = detections.get_anchor_coordinates(anchor=self.position) + for detection_idx in range(len(detections)): + color = resolve_color( + color=self.color, + detections=detections, + detection_idx=detection_idx, + color_lookup=self.color_lookup + if custom_color_lookup is None + else custom_color_lookup, + ) + center = (int(xy[detection_idx, 0]), int(xy[detection_idx, 1])) + cv2.circle(scene, center, self.radius, color.as_bgr(), -1) + return scene + class LabelAnnotator: """ A class for annotating labels on an image using provided detections. diff --git a/supervision/annotators/dot_marker_annotator.py b/supervision/annotators/dot_marker_annotator.py deleted file mode 100644 index ecdb9af0..00000000 --- a/supervision/annotators/dot_marker_annotator.py +++ /dev/null @@ -1,46 +0,0 @@ -from typing import Union - -import cv2 -import numpy as np - -from supervision import Color, ColorPalette, Detections, Position -from supervision.annotators.base import BaseAnnotator - - -class DotMarkerAnnotator(BaseAnnotator): - def __init__( - self, - color: Union[Color, ColorPalette] = ColorPalette.default(), - radius: int = 4, - position: Position = Position.CENTER, - color_map: str = "class", - ): - self.color = color - self.radius = radius - self.position = position - self.color_map = color_map - - def annotate( - self, - scene: np.ndarray, - detections: Detections, - ) -> np.ndarray: - annotated_scene = scene.copy() - - for detection in detections: - dot_color = self._get_color(detection) - box_position = detection.bounding_box.get_position(self.position) - dot_position = (int(box_position[0]), int(box_position[1])) - cv2.circle(annotated_scene, dot_position, self.radius, dot_color, -1) - - return annotated_scene - - def _get_color(self, detection): - if self.color_map == "class": - return self.color[detection.class_id] - elif self.color_map == "index": - return self.color[detection.index % len(self.color)] - elif self.color_map == "track": - return self.color[detection.track_id % len(self.color)] - else: - raise ValueError("Invalid color mapping strategy") From 1b6613d4a3b3f66adf8cfef82e3679c4baeacdbb Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 18 Oct 2023 16:09:40 +0000 Subject: [PATCH 036/164] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/annotators/core.py | 1 + 1 file changed, 1 insertion(+) diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index 3bde610a..4abb4f91 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -635,6 +635,7 @@ class DotAnnotator(BaseAnnotator): cv2.circle(scene, center, self.radius, color.as_bgr(), -1) return scene + class LabelAnnotator: """ A class for annotating labels on an image using provided detections. From 142fe02959d6fa2ecb4ff81a525e4fc192f38f23 Mon Sep 17 00:00:00 2001 From: kapter Date: Wed, 18 Oct 2023 19:44:15 +0300 Subject: [PATCH 037/164] add params for hsv --- supervision/annotators/core.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index 072e1026..a9aa0da6 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -97,6 +97,8 @@ class HeatmapAnnotator: opacity: float = 0.2, radius: int = 40, kernel_size: Optional[int] = 25, + top_hue: int = 0, #red + low_hue: int = 125, #blue ): """ Args: @@ -105,12 +107,19 @@ class HeatmapAnnotator: opacity (float): Opacity of the overlay mask. Must be between `0` and `1`. radius (int): Radius of the heat circle. kernel_size (Optional[int]): Kernel size for blurring the heatmap. + top_hue (int): Hue of the top of the heatmap. + Defaults to `0` (red). + low_hue (int): Hue of the bottom of the heatmap. + Defaults to `125` (blue). """ self.position = position self.opacity = opacity self.radius = radius self.kernel_size = kernel_size self.heatmask = None + self.top_hue = top_hue + self.low_hue = low_hue + def annotate(self, scene: np.ndarray, detections: Detections) -> np.ndarray: """ @@ -156,19 +165,17 @@ class HeatmapAnnotator: cv2.circle(mask, (int(xy[0]), int(xy[1])), self.radius, 1, -1) self.heatmask = mask + self.heatmask temp = self.heatmask.copy() - temp = 100 - temp / temp.max() * 90 + temp = self.low_hue-temp/temp.max()*(self.low_hue-self.top_hue) temp = temp.astype(np.uint8) if self.kernel_size is not None: - temp = cv2.GaussianBlur(temp, (self.kernel_size, self.kernel_size), 0) + temp = cv2.blur(temp, (self.kernel_size, self.kernel_size)) hsv = np.zeros(scene.shape) hsv[..., 0] = temp hsv[..., 1] = 255 hsv[..., 2] = 255 - mask = temp > 0 temp = cv2.cvtColor(hsv.astype(np.uint8), cv2.COLOR_HSV2BGR) - scene[mask] = cv2.addWeighted(temp, self.opacity, scene, 1 - self.opacity, 0)[ - mask - ] + mask = cv2.cvtColor(self.heatmask.astype(np.uint8), cv2.COLOR_GRAY2BGR)>0 + scene[mask] = cv2.addWeighted( temp, self.opacity,scene, 1-self.opacity, 0)[mask] return scene From b9d1d78f31013a1416837e306eceb8e6ecf13c9b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 18 Oct 2023 16:45:50 +0000 Subject: [PATCH 038/164] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/annotators/core.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index a9aa0da6..7764d420 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -97,8 +97,8 @@ class HeatmapAnnotator: opacity: float = 0.2, radius: int = 40, kernel_size: Optional[int] = 25, - top_hue: int = 0, #red - low_hue: int = 125, #blue + top_hue: int = 0, # red + low_hue: int = 125, # blue ): """ Args: @@ -107,7 +107,7 @@ class HeatmapAnnotator: opacity (float): Opacity of the overlay mask. Must be between `0` and `1`. radius (int): Radius of the heat circle. kernel_size (Optional[int]): Kernel size for blurring the heatmap. - top_hue (int): Hue of the top of the heatmap. + top_hue (int): Hue of the top of the heatmap. Defaults to `0` (red). low_hue (int): Hue of the bottom of the heatmap. Defaults to `125` (blue). @@ -119,7 +119,6 @@ class HeatmapAnnotator: self.heatmask = None self.top_hue = top_hue self.low_hue = low_hue - def annotate(self, scene: np.ndarray, detections: Detections) -> np.ndarray: """ @@ -165,7 +164,7 @@ class HeatmapAnnotator: cv2.circle(mask, (int(xy[0]), int(xy[1])), self.radius, 1, -1) self.heatmask = mask + self.heatmask temp = self.heatmask.copy() - temp = self.low_hue-temp/temp.max()*(self.low_hue-self.top_hue) + temp = self.low_hue - temp / temp.max() * (self.low_hue - self.top_hue) temp = temp.astype(np.uint8) if self.kernel_size is not None: temp = cv2.blur(temp, (self.kernel_size, self.kernel_size)) @@ -174,8 +173,10 @@ class HeatmapAnnotator: hsv[..., 1] = 255 hsv[..., 2] = 255 temp = cv2.cvtColor(hsv.astype(np.uint8), cv2.COLOR_HSV2BGR) - mask = cv2.cvtColor(self.heatmask.astype(np.uint8), cv2.COLOR_GRAY2BGR)>0 - scene[mask] = cv2.addWeighted( temp, self.opacity,scene, 1-self.opacity, 0)[mask] + mask = cv2.cvtColor(self.heatmask.astype(np.uint8), cv2.COLOR_GRAY2BGR) > 0 + scene[mask] = cv2.addWeighted(temp, self.opacity, scene, 1 - self.opacity, 0)[ + mask + ] return scene From 25a45aa42357a7a81ddedfb1b08aff6117c76a9f Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Wed, 18 Oct 2023 18:53:39 +0200 Subject: [PATCH 039/164] Expand and update Color, ColorPalette, and DotAnnotator classes Added detailed comments and examples to the Color and ColorPalette classes in supervision/draw/color.py, in addition to the DotAnnotator class in supervision/annotators/core.py. The changes clarify the usage and function of these classes. Also appended to the documentation by creating a new section for Color in docs/draw/color.md and including Color and DotAnnotator in docs/annotators.md. Incorporated the new documentation into the navigation structure in mkdocs.yml for user accessibility. The improvements enhance overall code-readability and understandability. --- docs/annotators.md | 29 +++++++++++ docs/draw/color.md | 7 +++ mkdocs.yml | 1 + supervision/annotators/core.py | 42 ++++++++++++++++ supervision/annotators/utils.py | 11 ++++- supervision/draw/color.py | 87 ++++++++++++++++++++++++++------- 6 files changed, 157 insertions(+), 20 deletions(-) create mode 100644 docs/draw/color.md diff --git a/docs/annotators.md b/docs/annotators.md index 9709d7c8..98f5fd08 100644 --- a/docs/annotators.md +++ b/docs/annotators.md @@ -82,6 +82,27 @@ +=== "Dot" + + ```python + >>> import supervision as sv + + >>> image = ... + >>> detections = sv.Detections(...) + + >>> dot_annotator = sv.DotAnnotator() + >>> annotated_frame = dot_annotator.annotate( + ... scene=image.copy(), + ... detections=detections + ... ) + ``` + +
+ + ![circle-annotator-example](https://media.roboflow.com/supervision-annotator-examples/dot-annotator-example-purple.png){ align=center width="800" } + +
+ === "Ellipse" ```python @@ -224,6 +245,10 @@ :::supervision.annotators.core.CircleAnnotator +## DotAnnotator + +:::supervision.annotators.core.DotAnnotator + ## EllipseAnnotator :::supervision.annotators.core.EllipseAnnotator @@ -247,3 +272,7 @@ ## TraceAnnotator :::supervision.annotators.core.TraceAnnotator + +## ColorLookup + +:::supervision.annotators.utils.ColorLookup diff --git a/docs/draw/color.md b/docs/draw/color.md new file mode 100644 index 00000000..d0259463 --- /dev/null +++ b/docs/draw/color.md @@ -0,0 +1,7 @@ +## Color + +:::supervision.draw.color.Color + +## ColorPalette + +:::supervision.draw.color.ColorPalette \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index f511cb2f..98d21dc4 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -48,6 +48,7 @@ nav: - Metrics: - Object Detection: metrics/detection.md - Draw: + - Color: draw/color.md - Utils: draw/utils.md - Utils: - Video: utils/video.md diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index 4abb4f91..d371a9fc 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -603,6 +603,10 @@ class CircleAnnotator(BaseAnnotator): class DotAnnotator(BaseAnnotator): + """ + A class for drawing dots on an image at specific coordinates based on provided detections. + """ + def __init__( self, color: Union[Color, ColorPalette] = ColorPalette.default(), @@ -610,6 +614,15 @@ class DotAnnotator(BaseAnnotator): position: Position = Position.CENTER, color_lookup: ColorLookup = ColorLookup.CLASS, ): + """ + Args: + color (Union[Color, ColorPalette]): The color or color palette to use for + annotating detections. + radius (int): Radius of the drawn dots. + position (Position): The anchor position for placing the dot. + color_lookup (ColorLookup): Strategy for mapping colors to annotations. + Options are `INDEX`, `CLASS`, `TRACE`. + """ self.color: Union[Color, ColorPalette] = color self.radius: int = radius self.position: Position = position @@ -621,6 +634,35 @@ class DotAnnotator(BaseAnnotator): detections: Detections, custom_color_lookup: Optional[np.ndarray] = None, ) -> np.ndarray: + """ + Annotates the given scene with dots based on the provided detections. + + Args: + scene (np.ndarray): The image where dots will be drawn. + detections (Detections): Object detections to annotate. + custom_color_lookup (Optional[np.ndarray]): Custom color lookup array. + Allows to override the default color mapping strategy. + + Returns: + np.ndarray: The annotated image. + + Example: + ```python + >>> import supervision as sv + + >>> image = ... + >>> detections = sv.Detections(...) + + >>> dot_annotator = sv.DotAnnotator() + >>> annotated_frame = dot_annotator.annotate( + ... scene=image.copy(), + ... detections=detections + ... ) + ``` + + ![dot-annotator-example](https://media.roboflow.com/ + supervision-annotator-examples/dot-annotator-example-purple.png) + """ xy = detections.get_anchor_coordinates(anchor=self.position) for detection_idx in range(len(detections)): color = resolve_color( diff --git a/supervision/annotators/utils.py b/supervision/annotators/utils.py index 6b6b9837..5b4e86cb 100644 --- a/supervision/annotators/utils.py +++ b/supervision/annotators/utils.py @@ -10,13 +10,22 @@ from supervision.geometry.core import Position class ColorLookup(Enum): """ - Enum for annotator color lookup. + Enumeration class to define strategies for mapping colors to annotations. + + This enum supports three different lookup strategies: + - `INDEX`: Colors are determined by the index of the detection within the scene. + - `CLASS`: Colors are determined by the class label of the detected object. + - `TRACK`: Colors are determined by the tracking identifier of the object. """ INDEX = "index" CLASS = "class" TRACK = "track" + @classmethod + def list(cls): + return list(map(lambda c: c.value, cls)) + def resolve_color_idx( detections: Detections, diff --git a/supervision/draw/color.py b/supervision/draw/color.py index ed28e78b..a4d41b76 100644 --- a/supervision/draw/color.py +++ b/supervision/draw/color.py @@ -34,6 +34,14 @@ def _validate_color_hex(color_hex: str): @dataclass class Color: + """ + Represents a color in RGB format. + + Attributes: + r (int): Red channel. + g (int): Green channel. + b (int): Blue channel. + """ r: int g: int b: int @@ -41,14 +49,19 @@ class Color: @classmethod def from_hex(cls, color_hex: str): """ - Creates a Color instance from a color hex string + Create a Color instance from a hex string. - :param color_hex: str : The color hex string in the format - of "fff", "ffffff", "#fff", or "#ffffff" - :return: Color : A Color instance representing the color + Args: + color_hex (str): Hex string of the color. + + Returns: + Color: Instance representing the color. Example: - color = Color.from_hex('#ff00ff') + ``` + >>> Color.from_hex('#ff00ff') + Color(r=255, g=0, b=255) + ``` """ _validate_color_hex(color_hex) color_hex = color_hex.lstrip("#") @@ -59,17 +72,31 @@ class Color: def as_rgb(self) -> Tuple[int, int, int]: """ - Returns the color as a tuple of integers in the RGB format + Returns the color as an RGB tuple. - :return: Tuple[int, int, int] : The color in the RGB format + Returns: + Tuple[int, int, int]: RGB tuple. + + Example: + ``` + >>> color.as_rgb() + (255, 0, 255) + ``` """ return self.r, self.g, self.b def as_bgr(self) -> Tuple[int, int, int]: """ - Returns the color as a tuple of integers in the BGR format + Returns the color as a BGR tuple. - :return: Tuple[int, int, int] : The color in the BGR format + Returns: + Tuple[int, int, int]: BGR tuple. + + Example: + ``` + >>> color.as_bgr() + (255, 0, 255) + ``` """ return self.b, self.g, self.r @@ -100,33 +127,55 @@ class ColorPalette: @classmethod def default(cls) -> ColorPalette: + """ + Returns a default color palette. + + Returns: + ColorPalette: A ColorPalette instance with default colors. + + Example: + ``` + >>> ColorPalette.default() + ColorPalette(colors=[Color(r=255, g=0, b=0), Color(r=0, g=255, b=0), ...]) + ``` + """ return ColorPalette.from_hex(color_hex_list=DEFAULT_COLOR_PALETTE) @classmethod def from_hex(cls, color_hex_list: List[str]): """ - Creates a ColorPalette instance from a list of color hex strings + Create a ColorPalette instance from a list of hex strings. - :param color_hex_list: List[str] : A list of color hex strings in the - format of "fff", "ffffff", "#fff", or "#ffffff" - :return: ColorPalette : A ColorPalette instance representing the color palette + Args: + color_hex_list (List[str]): List of color hex strings. + + Returns: + ColorPalette: A ColorPalette instance. Example: - color_palette = ColorPalette.from_hex(['#ff0000', '#00ff00', '#0000ff']) + ``` + >>> ColorPalette.from_hex(['#ff0000', '#00ff00', '#0000ff']) + ColorPalette(colors=[Color(r=255, g=0, b=0), Color(r=0, g=255, b=0), ...]) + ``` """ colors = [Color.from_hex(color_hex) for color_hex in color_hex_list] return cls(colors) def by_idx(self, idx: int) -> Color: """ - Returns the color at a given index in the color palette. + Return the color at a given index in the palette. - :param idx: int : The index of the color in the color palette - :return: Color : The color at the given index + Args: + idx (int): Index of the color in the palette. + + Returns: + Color: Color at the given index. Example: - color_palette = ColorPalette.from_hex(['#ff0000', '#00ff00', '#0000ff']) - color = color_palette.by_idx(1) + ``` + >>> color_palette.by_idx(1) + Color(r=0, g=255, b=0) + ``` """ if idx < 0: raise ValueError("idx argument should not be negative") From e209c7436c38be5e4010eb8562f849a9a5b05fc5 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 18 Oct 2023 16:57:04 +0000 Subject: [PATCH 040/164] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/draw/color.md | 2 +- supervision/draw/color.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/draw/color.md b/docs/draw/color.md index d0259463..5114f4ba 100644 --- a/docs/draw/color.md +++ b/docs/draw/color.md @@ -4,4 +4,4 @@ ## ColorPalette -:::supervision.draw.color.ColorPalette \ No newline at end of file +:::supervision.draw.color.ColorPalette diff --git a/supervision/draw/color.py b/supervision/draw/color.py index a4d41b76..aceb0da0 100644 --- a/supervision/draw/color.py +++ b/supervision/draw/color.py @@ -42,6 +42,7 @@ class Color: g (int): Green channel. b (int): Blue channel. """ + r: int g: int b: int From e173510117dde22ca9fb268bf9ae99470767cd94 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Wed, 18 Oct 2023 19:01:54 +0200 Subject: [PATCH 041/164] Refactor DotAnnotator docstring for clarity --- supervision/annotators/core.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index d371a9fc..cb50f868 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -604,7 +604,8 @@ class CircleAnnotator(BaseAnnotator): class DotAnnotator(BaseAnnotator): """ - A class for drawing dots on an image at specific coordinates based on provided detections. + A class for drawing dots on an image at specific coordinates based on provided + detections. """ def __init__( From 809d8946e61bd22402a2172e55b9a801c309fc17 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Wed, 18 Oct 2023 20:50:52 +0200 Subject: [PATCH 042/164] Update docs on object detection and annotation This commit clarifies the process of object detection and annotation using Supervision and the Ultralytics YOLOv8 model. The changes also include updated instructions on how to load model predictions into Supervision and using them to annotate images, with links to the methods used in the process and the available options. An image showing the resulting annotated image has also been added for better understanding. The changes are shaped to make the documentation more informative, concise, and easy to follow. --- docs/how_to/detect_and_annotate.md | 87 +++++++++++++++--------------- 1 file changed, 43 insertions(+), 44 deletions(-) diff --git a/docs/how_to/detect_and_annotate.md b/docs/how_to/detect_and_annotate.md index 7c121fa2..66e09115 100644 --- a/docs/how_to/detect_and_annotate.md +++ b/docs/how_to/detect_and_annotate.md @@ -1,54 +1,59 @@ -## How to Detect and Annotate +With Supervision, you can easily [annotate](https://supervision.roboflow.com/annotators/) predictions obtained from a variety of object detection and segmentation models. This document outlines how to run inference using the [Ultralytics](https://github.com/ultralytics/ultralytics) YOLOv8 model, load these predictions into Supervision, and annotate the image. -Supervision enables you to annotate predictions from object detection and segmentation models in a few lines of code. - -The `sv.BoxAnnotator` class lets you annotate images with bounding boxes, while the `sv.MaskAnnotator` class lets you annotate images with segmentation masks. `sv.MaskAnnotator` is a drop-in replacement for `sv.BoxAnnotator`, so you don't need to update any other code if you want to switch between the two. - -In this guide, we run inference on an Ultralytics YOLOv8 object detection model and plot the predictions with the `sv.BoxAnnotator` class. You can also load predictions using: - -- `from_deepsparse` (Deepsparse) -- `from_detectron2` (Detectron2) -- `from_mmdetection` (MMDetection) -- `from_ultralytics` (Ultralytics) -- `from_roboflow` (Roboflow) -- `from_sam` (Segment Anything Model) -- `from_transformers` (Hugging Face Transformers) -- `from_yolo_nas` (YOLO-NAS) - -## Load a Model and Retrieve Predictions - -First, we need to retrieve predictions from a model. For this guide, we will retrieve predictions from a YOLOv8 model. See a list of all models from which you can load predictions into supervision. +## Run Inference +First, you'll need to obtain predictions from your object detection or segmentation model. ```python -import supervision as sv -from ultralytics import YOLO import cv2 +from ultralytics import YOLO model = YOLO("yolov8n.pt") - -results = model("image.jpg") +image = cv2.imread("image.jpg") +results = model(image)[0] ``` -In this code, we import `supervision`, `ultralytics`, and `cv2` (OpenCV). We load then load a YOLOv8 object detection model, then run inference on an image called `image.jpg`. The image is loaded using OpenCV. The `results` variable contains the predictions from the model. - ## Load Predictions into Supervision -Now that we have predictions from a model, we can load them into supervision. - -We can do so using the `sv.Detections.from_ultralytics` method, which accepts model results from Ultralytics models. [See a list of other supported data loaders](https://supervision.roboflow.com/detection/core/#supervision.detection.core.Detections.from_deepsparse). +Now that we have predictions from a model, we can load them into Supervision. We can do so using the [`sv.Detections.from_ultralytics`](https://supervision.roboflow.com/detection/core/#supervision.detection.core.Detections.from_ultralytics) method, which accepts model results from both detection and segmentation models. ```python -detections = sv.Detections.from_ultralytics(results[0]) +import cv2 +from ultralytics import YOLO +import supervision as sv + +model = YOLO("yolov8n.pt") +image = cv2.imread("image.jpg") +results = model(image)[0] +detections = sv.Detections.from_ultralytics(results) ``` +You can conveniently load predictions from other computer vision frameworks and libraries using: + +- [`from_deepsparse`](https://supervision.roboflow.com/detection/core/#supervision.detection.core.Detections.from_deepsparse) ([Deepsparse](https://github.com/neuralmagic/deepsparse)) +- [`from_detectron2`](https://supervision.roboflow.com/detection/core/#supervision.detection.core.Detections.from_detectron2) ([Detectron2](https://github.com/facebookresearch/detectron2)) +- [`from_mmdetection`](https://supervision.roboflow.com/detection/core/#supervision.detection.core.Detections.from_mmdetection) ([MMDetection](https://github.com/open-mmlab/mmdetection)) +- [`from_roboflow`](https://supervision.roboflow.com/detection/core/#supervision.detection.core.Detections.from_roboflow) ([Roboflow Inference](https://github.com/roboflow/inference)) +- [`from_sam`](https://supervision.roboflow.com/detection/core/#supervision.detection.core.Detections.from_sam) ([Segment Anything Model](https://github.com/facebookresearch/segment-anything)) +- [`from_transformers`](https://supervision.roboflow.com/detection/core/#supervision.detection.core.Detections.from_transformers) ([HuggingFace Transformers](https://github.com/huggingface/transformers)) +- [`from_yolo_nas`](https://supervision.roboflow.com/detection/core/#supervision.detection.core.Detections.from_yolo_nas) ([YOLO-NAS](https://github.com/Deci-AI/super-gradients/blob/master/YOLONAS.md)) + + ## Annotate Image -Next, we can annotate the image with the predictions returned by our model. Since we are working with an object detection model, we will use the `sv.BoxAnnotator` class to annotate an image with predictions. +Finally, we can annotate the image with the predictions. Since we are working with an object detection model, we will use the [`sv.BoundingBoxAnnotator`](https://supervision.roboflow.com/annotators/#supervision.annotators.core.BoundingBoxAnnotator) and [`sv.LabelAnnotator`](https://supervision.roboflow.com/annotators/#supervision.annotators.core.LabelAnnotator) classes. If you are running the segmentation model [`sv.MaskAnnotator`](https://supervision.roboflow.com/annotators/#supervision.annotators.core.MaskAnnotator) is a drop-in replacement for [`sv.BoundingBoxAnnotator`](https://supervision.roboflow.com/annotators/#supervision.annotators.core.BoundingBoxAnnotator) that will allow you to draw masks instead of boxes. ```python -image = cv2.imread("image.jpg") +import cv2 +from ultralytics import YOLO +import supervision as sv -annotator = sv.BoxAnnotator() +model = YOLO("yolov8n.pt") +image = cv2.imread("image.jpg") +results = model(image)[0] +detections = sv.Detections.from_ultralytics(results) + +bounding_box_annotator = sv.BoundingBoxAnnotator() +label_annotator = sv.LabelAnnotator() labels = [ results.names[class_id] @@ -56,24 +61,18 @@ labels = [ in detections.class_id ] -annotated_image = annotator.annotate(image, detections, labels) +annotated_image = bounding_box_annotator.annotate( + scene=image, detections=detections) +annotated_image = label_annotator.annotate( + scene=annotated_image, detections=detections, labels=labels) ``` -In this code, we: - -1. Load the image to annotate. -2. Create a `sv.BoxAnnotator` object to annotate the image. -3. Create a list of labels for each prediction. In this example, we get the class name associated with each class ID using the `results[0].names` attribute available in the `results` object` -3. Use the `annotate` method to annotate the image with the predictions. +![Predictions plotted on an image](https://media.roboflow.com/supervision_annotate_example.png) ## Display Annotated Image -Finally, we can display the annotated image: +To display the annotated image in Jupyter Notebook or Google Colab, use the [`sv.plot_image`](https://supervision.roboflow.com/utils/notebook/#supervision.utils.notebook.plot_image) function. ```python sv.plot_image(annotated_image) ``` - -Here is the result: - -![Predictions plotted on an image](https://media.roboflow.com/supervision_annotate_example.png) From 54bb79c22002c388a4ff01e2af3c0fa45e079a4a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 18 Oct 2023 18:51:32 +0000 Subject: [PATCH 043/164] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/how_to/detect_and_annotate.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/how_to/detect_and_annotate.md b/docs/how_to/detect_and_annotate.md index 66e09115..04250bc3 100644 --- a/docs/how_to/detect_and_annotate.md +++ b/docs/how_to/detect_and_annotate.md @@ -14,7 +14,7 @@ results = model(image)[0] ## Load Predictions into Supervision -Now that we have predictions from a model, we can load them into Supervision. We can do so using the [`sv.Detections.from_ultralytics`](https://supervision.roboflow.com/detection/core/#supervision.detection.core.Detections.from_ultralytics) method, which accepts model results from both detection and segmentation models. +Now that we have predictions from a model, we can load them into Supervision. We can do so using the [`sv.Detections.from_ultralytics`](https://supervision.roboflow.com/detection/core/#supervision.detection.core.Detections.from_ultralytics) method, which accepts model results from both detection and segmentation models. ```python import cv2 @@ -40,7 +40,7 @@ You can conveniently load predictions from other computer vision frameworks and ## Annotate Image -Finally, we can annotate the image with the predictions. Since we are working with an object detection model, we will use the [`sv.BoundingBoxAnnotator`](https://supervision.roboflow.com/annotators/#supervision.annotators.core.BoundingBoxAnnotator) and [`sv.LabelAnnotator`](https://supervision.roboflow.com/annotators/#supervision.annotators.core.LabelAnnotator) classes. If you are running the segmentation model [`sv.MaskAnnotator`](https://supervision.roboflow.com/annotators/#supervision.annotators.core.MaskAnnotator) is a drop-in replacement for [`sv.BoundingBoxAnnotator`](https://supervision.roboflow.com/annotators/#supervision.annotators.core.BoundingBoxAnnotator) that will allow you to draw masks instead of boxes. +Finally, we can annotate the image with the predictions. Since we are working with an object detection model, we will use the [`sv.BoundingBoxAnnotator`](https://supervision.roboflow.com/annotators/#supervision.annotators.core.BoundingBoxAnnotator) and [`sv.LabelAnnotator`](https://supervision.roboflow.com/annotators/#supervision.annotators.core.LabelAnnotator) classes. If you are running the segmentation model [`sv.MaskAnnotator`](https://supervision.roboflow.com/annotators/#supervision.annotators.core.MaskAnnotator) is a drop-in replacement for [`sv.BoundingBoxAnnotator`](https://supervision.roboflow.com/annotators/#supervision.annotators.core.BoundingBoxAnnotator) that will allow you to draw masks instead of boxes. ```python import cv2 From a037a4a4041109593d1d98fa013332d74a8e3807 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Wed, 18 Oct 2023 21:17:51 +0200 Subject: [PATCH 044/164] Add HeatMapAnnotator class to supervision A HeatMapAnnotator class has been added for visualization purposes. This class can be used to draw heatmaps on an image based on provided detections, where the heat accumulates over time and is drawn as a semi-transparent overlay of blurred circles. --- supervision/__init__.py | 1 + supervision/annotators/core.py | 217 +++++++++++++++++---------------- 2 files changed, 114 insertions(+), 104 deletions(-) diff --git a/supervision/__init__.py b/supervision/__init__.py index b1d25337..69b1a344 100644 --- a/supervision/__init__.py +++ b/supervision/__init__.py @@ -15,6 +15,7 @@ from supervision.annotators.core import ( DotAnnotator, EllipseAnnotator, HaloAnnotator, + HeatMapAnnotator, LabelAnnotator, MaskAnnotator, TraceAnnotator, diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index 4d3fea5f..444d8ff2 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -89,101 +89,6 @@ class BoundingBoxAnnotator(BaseAnnotator): return scene -class HeatmapAnnotator: - """ - A class for drawing heatmap on an image using provided detections. - Heat is accumulated over time. Drawn as a semi-transparent overlay as blured circles. - """ - - def __init__( - self, - position: Optional[Position] = Position.BOTTOM_CENTER, - opacity: float = 0.2, - radius: int = 40, - kernel_size: Optional[int] = 25, - top_hue: int = 0, # red - low_hue: int = 125, # blue - ): - """ - Args: - position (Optional[Position]): The position of the heatmap. - Defaults to `BOTTOM_CENTER`. - opacity (float): Opacity of the overlay mask. Must be between `0` and `1`. - radius (int): Radius of the heat circle. - kernel_size (Optional[int]): Kernel size for blurring the heatmap. - top_hue (int): Hue of the top of the heatmap. - Defaults to `0` (red). - low_hue (int): Hue of the bottom of the heatmap. - Defaults to `125` (blue). - """ - self.position = position - self.opacity = opacity - self.radius = radius - self.kernel_size = kernel_size - self.heatmask = None - self.top_hue = top_hue - self.low_hue = low_hue - - def annotate(self, scene: np.ndarray, detections: Detections) -> np.ndarray: - """ - Annotates the given scene with heatmap based on the provided detections. - - Args: - scene (np.ndarray): The image where heatmap will be drawn. - detections (Detections): Object detections to annotate. - - Returns: - np.ndarray: The annotated image. - - Example: - ```python - >>> import supervision as sv - >>> model = YOLO('yolov8s.pt') - >>> video_info = sv.VideoInfo.from_video_path(video_path=video_path) - >>> hma = HeatmapAnnotator( - ... position=Position.BOTTOM_CENTER, - ... opacity=0.2, - ... radius=40, - ... kernel_size=25, - ...) - >>> with sv.VideoSink(target_path=target_path, video_info=video_info) as sink: - ... for result in tqdm(model(source=video_path, agnostic_nms=True, verbose=False), total=video_info.total_frames): - ... frame = result.orig_img - ... detections = sv.Detections.from_ultralytics(result) - ... detections = detections[detections.class_id == 0] - ... annotated_frame = hma.annotate( - ... scene=frame.copy(), - ... detections=detections) - ... sink.write_frame(frame=annotated_frame) - ``` - - ![heatmap-annotator-example](https://media.roboflow.com/ - supervision-annotator-examples/heatmap-annotator-example.png) - """ - - if self.heatmask is None: - self.heatmask = np.zeros(scene.shape[:2]) - mask = np.zeros(scene.shape[:2]) - for xy in detections.get_anchor_coordinates(self.position): - cv2.circle(mask, (int(xy[0]), int(xy[1])), self.radius, 1, -1) - self.heatmask = mask + self.heatmask - temp = self.heatmask.copy() - temp = self.low_hue - temp / temp.max() * (self.low_hue - self.top_hue) - temp = temp.astype(np.uint8) - if self.kernel_size is not None: - temp = cv2.blur(temp, (self.kernel_size, self.kernel_size)) - hsv = np.zeros(scene.shape) - hsv[..., 0] = temp - hsv[..., 1] = 255 - hsv[..., 2] = 255 - temp = cv2.cvtColor(hsv.astype(np.uint8), cv2.COLOR_HSV2BGR) - mask = cv2.cvtColor(self.heatmask.astype(np.uint8), cv2.COLOR_GRAY2BGR) > 0 - scene[mask] = cv2.addWeighted(temp, self.opacity, scene, 1 - self.opacity, 0)[ - mask - ] - return scene - - class MaskAnnotator(BaseAnnotator): """ A class for drawing masks on an image using provided detections. @@ -1010,7 +915,7 @@ class TraceAnnotator: def __init__( self, color: Union[Color, ColorPalette] = ColorPalette.default(), - position: Optional[Position] = Position.CENTER, + position: Position = Position.CENTER, trace_length: int = 30, thickness: int = 2, color_lookup: ColorLookup = ColorLookup.CLASS, @@ -1019,7 +924,7 @@ class TraceAnnotator: Args: color (Union[Color, ColorPalette]): The color to draw the trace, can be a single color or a color palette. - position (Optional[Position]): The position of the trace. + position (Position): The position of the trace. Defaults to `CENTER`. trace_length (int): The maximum length of the trace in terms of historical points. Defaults to `30`. @@ -1055,15 +960,25 @@ class TraceAnnotator: Example: ```python >>> import supervision as sv + >>> from ultralytics import YOLO - >>> image = ... - >>> detections = sv.Detections(...) + >>> model = YOLO('yolov8x.pt') - >>> trace_annotator = sv.TraceAnnotator() - >>> annotated_frame = trace_annotator.annotate( - ... scene=image.copy(), - ... detections=detections - ... ) + >>> heat_map_annotator = sv.TraceAnnotator() + + >>> video_info = sv.VideoInfo.from_video_path(video_path=...) + >>> frames_generator = get_video_frames_generator(source_path=...) + >>> tracker = sv.ByteTrack() + + >>> with sv.VideoSink(target_path=..., video_info=video_info) as sink: + ... for frame in frames_generator: + ... result = model(frame)[0] + ... detections = sv.Detections.from_ultralytics(result) + ... detections = tracker.update_with_detections(detections) + ... annotated_frame = trace_annotator.annotate( + ... scene=frame.copy(), + ... detections=detections) + ... sink.write_frame(frame=annotated_frame) ``` ![trace-annotator-example](https://media.roboflow.com/ @@ -1091,3 +1006,97 @@ class TraceAnnotator: thickness=self.thickness, ) return scene + + +class HeatMapAnnotator: + """ + A class for drawing heatmaps on an image based on provided detections. + Heat accumulates over time and is drawn as a semi-transparent overlay + of blurred circles. + """ + + def __init__( + self, + position: Position = Position.BOTTOM_CENTER, + opacity: float = 0.2, + radius: int = 40, + kernel_size: int = 25, + top_hue: int = 0, + low_hue: int = 125, + ): + """ + Args: + position (Position): The position of the heatmap. Defaults to + `BOTTOM_CENTER`. + opacity (float): Opacity of the overlay mask, between 0 and 1. + radius (int): Radius of the heat circle. + kernel_size (int): Kernel size for blurring the heatmap. + top_hue (int): Hue at the top of the heatmap. Defaults to 0 (red). + low_hue (int): Hue at the bottom of the heatmap. Defaults to 125 (blue). + """ + self.position = position + self.opacity = opacity + self.radius = radius + self.kernel_size = kernel_size + self.heat_mask = None + self.top_hue = top_hue + self.low_hue = low_hue + + def annotate(self, scene: np.ndarray, detections: Detections) -> np.ndarray: + """ + Annotates the scene with a heatmap based on the provided detections. + + Args: + scene (np.ndarray): The image where the heatmap will be drawn. + detections (Detections): Object detections to annotate. + + Returns: + np.ndarray: Annotated image. + + Example: + ```python + >>> import supervision as sv + >>> from ultralytics import YOLO + + >>> model = YOLO('yolov8x.pt') + + >>> heat_map_annotator = sv.HeatMapAnnotator() + + >>> video_info = sv.VideoInfo.from_video_path(video_path=...) + >>> frames_generator = get_video_frames_generator(source_path=...) + + >>> with sv.VideoSink(target_path=..., video_info=video_info) as sink: + ... for frame in frames_generator: + ... result = model(frame)[0] + ... detections = sv.Detections.from_ultralytics(result) + ... annotated_frame = heat_map_annotator.annotate( + ... scene=frame.copy(), + ... detections=detections) + ... sink.write_frame(frame=annotated_frame) + ``` + + ![heatmap-annotator-example](https://media.roboflow.com/ + supervision-annotator-examples/heatmap-annotator-example.png) + """ + + if self.heat_mask is None: + self.heat_mask = np.zeros(scene.shape[:2]) + mask = np.zeros(scene.shape[:2]) + for xy in detections.get_anchor_coordinates(self.position): + cv2.circle(mask, (int(xy[0]), int(xy[1])), self.radius, 1, -1) + self.heat_mask = mask + self.heat_mask + temp = self.heat_mask.copy() + temp = self.low_hue - temp / temp.max() * (self.low_hue - self.top_hue) + temp = temp.astype(np.uint8) + if self.kernel_size is not None: + temp = cv2.blur(temp, (self.kernel_size, self.kernel_size)) + hsv = np.zeros(scene.shape) + hsv[..., 0] = temp + hsv[..., 1] = 255 + hsv[..., 2] = 255 + temp = cv2.cvtColor(hsv.astype(np.uint8), cv2.COLOR_HSV2BGR) + mask = cv2.cvtColor(self.heat_mask.astype(np.uint8), cv2.COLOR_GRAY2BGR) > 0 + scene[mask] = cv2.addWeighted(temp, self.opacity, scene, 1 - self.opacity, 0)[ + mask + ] + return scene From d66a53977954a33e66d752f08eb7407a6648a4b9 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Wed, 18 Oct 2023 21:25:44 +0200 Subject: [PATCH 045/164] Update example code blocks in `core.py` and `annotators.md` Code examples in `supervision/annotators/core.py` and `docs/annotators.md` have been updated for clarity and consistency. The changes include renaming variables more appropriately and elaborating on the video processing steps which now includes tracking and annotating frames using a YOLO model. This revision aims to make examples more understandable and consistent for users following the documentation. --- docs/annotators.md | 55 ++++++++++++++++++++++++++++++---- supervision/annotators/core.py | 14 ++++----- 2 files changed, 56 insertions(+), 13 deletions(-) diff --git a/docs/annotators.md b/docs/annotators.md index 98f5fd08..b9ae93d8 100644 --- a/docs/annotators.md +++ b/docs/annotators.md @@ -212,15 +212,54 @@ ```python >>> import supervision as sv + >>> from ultralytics import YOLO - >>> image = ... - >>> detections = sv.Detections(...) + >>> model = YOLO('yolov8x.pt') >>> trace_annotator = sv.TraceAnnotator() - >>> annotated_frame = trace_annotator.annotate( - ... scene=image.copy(), - ... detections=detections - ... ) + + >>> video_info = sv.VideoInfo.from_video_path(video_path='...') + >>> frames_generator = get_video_frames_generator(source_path='...') + >>> tracker = sv.ByteTrack() + + >>> with sv.VideoSink(target_path='...', video_info=video_info) as sink: + ... for frame in frames_generator: + ... result = model(frame)[0] + ... detections = sv.Detections.from_ultralytics(result) + ... detections = tracker.update_with_detections(detections) + ... annotated_frame = trace_annotator.annotate( + ... scene=frame.copy(), + ... detections=detections) + ... sink.write_frame(frame=annotated_frame) + ``` + +
+ + ![trace-annotator-example](https://media.roboflow.com/supervision-annotator-examples/trace-annotator-example-purple.png){ align=center width="800" } + +
+ +=== "HeatMap" + + ```python + >>> import supervision as sv + >>> from ultralytics import YOLO + + >>> model = YOLO('yolov8x.pt') + + >>> heat_map_annotator = sv.HeatMapAnnotator() + + >>> video_info = sv.VideoInfo.from_video_path(video_path='...') + >>> frames_generator = get_video_frames_generator(source_path='...') + + >>> with sv.VideoSink(target_path='...', video_info=video_info) as sink: + ... for frame in frames_generator: + ... result = model(frame)[0] + ... detections = sv.Detections.from_ultralytics(result) + ... annotated_frame = heat_map_annotator.annotate( + ... scene=frame.copy(), + ... detections=detections) + ... sink.write_frame(frame=annotated_frame) ```
@@ -257,6 +296,10 @@ :::supervision.annotators.core.HaloAnnotator +## HeatMapAnnotator + +:::supervision.annotators.core.HeatMapAnnotator + ## MaskAnnotator :::supervision.annotators.core.MaskAnnotator diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index 444d8ff2..5c133a23 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -964,13 +964,13 @@ class TraceAnnotator: >>> model = YOLO('yolov8x.pt') - >>> heat_map_annotator = sv.TraceAnnotator() + >>> trace_annotator = sv.TraceAnnotator() - >>> video_info = sv.VideoInfo.from_video_path(video_path=...) - >>> frames_generator = get_video_frames_generator(source_path=...) + >>> video_info = sv.VideoInfo.from_video_path(video_path='...') + >>> frames_generator = sv.get_video_frames_generator(source_path='...') >>> tracker = sv.ByteTrack() - >>> with sv.VideoSink(target_path=..., video_info=video_info) as sink: + >>> with sv.VideoSink(target_path='...', video_info=video_info) as sink: ... for frame in frames_generator: ... result = model(frame)[0] ... detections = sv.Detections.from_ultralytics(result) @@ -1062,10 +1062,10 @@ class HeatMapAnnotator: >>> heat_map_annotator = sv.HeatMapAnnotator() - >>> video_info = sv.VideoInfo.from_video_path(video_path=...) - >>> frames_generator = get_video_frames_generator(source_path=...) + >>> video_info = sv.VideoInfo.from_video_path(video_path='...') + >>> frames_generator = get_video_frames_generator(source_path='...') - >>> with sv.VideoSink(target_path=..., video_info=video_info) as sink: + >>> with sv.VideoSink(target_path='...', video_info=video_info) as sink: ... for frame in frames_generator: ... result = model(frame)[0] ... detections = sv.Detections.from_ultralytics(result) From 5f82aac9e67600d6ea01db265ddde3ed362326c5 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Wed, 18 Oct 2023 21:34:56 +0200 Subject: [PATCH 046/164] Update example images link in `core.py` and `annotators.md` The hyperlink to images in the example blocks in `supervision/annotators/core.py`, and `docs/annotators.md` was modified to reflect recent updates to the annotated heat map image. --- docs/annotators.md | 2 +- supervision/annotators/core.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/annotators.md b/docs/annotators.md index b9ae93d8..efb77d11 100644 --- a/docs/annotators.md +++ b/docs/annotators.md @@ -264,7 +264,7 @@
- ![trace-annotator-example](https://media.roboflow.com/supervision-annotator-examples/trace-annotator-example-purple.png){ align=center width="800" } + ![trace-annotator-example](https://media.roboflow.com/supervision-annotator-examples/heat-map-annotator-example-purple.png){ align=center width="800" }
diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index 5c133a23..3fbd7a85 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -1076,7 +1076,7 @@ class HeatMapAnnotator: ``` ![heatmap-annotator-example](https://media.roboflow.com/ - supervision-annotator-examples/heatmap-annotator-example.png) + supervision-annotator-examples/heat-map-annotator-example-purple.png) """ if self.heat_mask is None: From 737cb37249e0313ab861899600f3ffc547b85fa9 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Wed, 18 Oct 2023 22:31:34 +0200 Subject: [PATCH 047/164] Add new drawing methods and improve type hints Expanded the drawing functionality by adding new utility methods 'draw_image', 'draw_line' and 'draw_rectangle' and imported them in supervision/__init__.py. Updated the documentation of draw/utils, to include 'draw_image'. Improved type hinting in draw/color.py and draw/utils.py. Also, some redundant comments and unnecessary immediate memory freeing line are removed from draw/utils.py to enhance code readability. --- docs/draw/utils.md | 4 ++++ supervision/__init__.py | 9 ++++++++- supervision/draw/color.py | 4 ++-- supervision/draw/utils.py | 5 +++-- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/docs/draw/utils.md b/docs/draw/utils.md index e7bb806b..5832089e 100644 --- a/docs/draw/utils.md +++ b/docs/draw/utils.md @@ -17,3 +17,7 @@ ## draw_text :::supervision.draw.utils.draw_text + +## draw_image + +:::supervision.draw.utils.draw_image diff --git a/supervision/__init__.py b/supervision/__init__.py index 69b1a344..10f654b8 100644 --- a/supervision/__init__.py +++ b/supervision/__init__.py @@ -42,7 +42,14 @@ from supervision.detection.utils import ( polygon_to_xyxy, ) from supervision.draw.color import Color, ColorPalette -from supervision.draw.utils import draw_filled_rectangle, draw_polygon, draw_text +from supervision.draw.utils import ( + draw_filled_rectangle, + draw_polygon, + draw_text, + draw_image, + draw_line, + draw_rectangle +) from supervision.geometry.core import Point, Position, Rect from supervision.geometry.utils import get_polygon_center from supervision.metrics.detection import ConfusionMatrix, MeanAveragePrecision diff --git a/supervision/draw/color.py b/supervision/draw/color.py index aceb0da0..69bcc9c5 100644 --- a/supervision/draw/color.py +++ b/supervision/draw/color.py @@ -48,7 +48,7 @@ class Color: b: int @classmethod - def from_hex(cls, color_hex: str): + def from_hex(cls, color_hex: str) -> Color: """ Create a Color instance from a hex string. @@ -143,7 +143,7 @@ class ColorPalette: return ColorPalette.from_hex(color_hex_list=DEFAULT_COLOR_PALETTE) @classmethod - def from_hex(cls, color_hex_list: List[str]): + def from_hex(cls, color_hex_list: List[str]) -> ColorPalette: """ Create a ColorPalette instance from a list of hex strings. diff --git a/supervision/draw/utils.py b/supervision/draw/utils.py index 73844fbd..f9152969 100644 --- a/supervision/draw/utils.py +++ b/supervision/draw/utils.py @@ -190,11 +190,13 @@ def draw_image( np.ndarray: The scene with the image drawn onto it. Example: + ```python >>> scene = np.zeros((400, 400, 3), dtype=np.uint8) >>> image_path = "path/to/image.jpg" >>> opacity = 0.5 >>> rect = Rect(x=50, y=50, width=200, height=200) >>> new_scene = draw_image(scene, image_path, opacity, rect) + ``` """ if isinstance(image, str): assert os.path.exists(image), f'The specified path ("{image}") does not exist.' @@ -211,14 +213,13 @@ def draw_image( image = cv2.resize(image, (rect.width, rect.height)) - # watermark with transparent background if image.shape[2] == 4: b, g, r, a = cv2.split(image) b = cv2.bitwise_and(b, b, mask=a) g = cv2.bitwise_and(g, g, mask=a) r = cv2.bitwise_and(r, r, mask=a) image = cv2.merge([b, g, r, a]) - del b, g, r, a # immediately free up memory + del b, g, r, a if scene.shape[2] == 3: scene = np.dstack([scene, np.ones(scene.shape[:2], dtype=np.uint8) * 255]) From 743f3281a5a45baf547a160dbaddbfec1159b1bd Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 18 Oct 2023 20:33:05 +0000 Subject: [PATCH 048/164] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/supervision/__init__.py b/supervision/__init__.py index 10f654b8..f4e70ead 100644 --- a/supervision/__init__.py +++ b/supervision/__init__.py @@ -44,11 +44,11 @@ from supervision.detection.utils import ( from supervision.draw.color import Color, ColorPalette from supervision.draw.utils import ( draw_filled_rectangle, - draw_polygon, - draw_text, draw_image, draw_line, - draw_rectangle + draw_polygon, + draw_rectangle, + draw_text, ) from supervision.geometry.core import Point, Position, Rect from supervision.geometry.utils import get_polygon_center From 57ba059f1c2a1016ccf5a1a122c1aa8c26e8e745 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Wed, 18 Oct 2023 22:45:58 +0200 Subject: [PATCH 049/164] test --- supervision/draw/utils.py | 72 ++++++++++++++------------------------- 1 file changed, 26 insertions(+), 46 deletions(-) diff --git a/supervision/draw/utils.py b/supervision/draw/utils.py index f9152969..171694aa 100644 --- a/supervision/draw/utils.py +++ b/supervision/draw/utils.py @@ -172,64 +172,44 @@ def draw_text( def draw_image( - scene: np.ndarray, image: Union[str, np.ndarray], opacity: float, rect: Rect + scene: np.ndarray, image: Union[str, np.ndarray], opacity: float, rect: Rect ) -> np.ndarray: """ Draws an image onto a given scene with specified opacity and dimensions. - - Args: - scene (np.ndarray): The background image onto which the image will be drawn. - image (Union[str, np.ndarray]): The image to be drawn. - Can be either a file path or a NumPy array. - opacity (float): The opacity level of the image to be drawn, - ranging from 0.0 to 1.0. - rect (Rect): A Rect object specifying the dimensions and - position where the image will be drawn. - - Returns: - np.ndarray: The scene with the image drawn onto it. - - Example: - ```python - >>> scene = np.zeros((400, 400, 3), dtype=np.uint8) - >>> image_path = "path/to/image.jpg" - >>> opacity = 0.5 - >>> rect = Rect(x=50, y=50, width=200, height=200) - >>> new_scene = draw_image(scene, image_path, opacity, rect) - ``` """ + # Input checks + assert 0.0 <= opacity <= 1.0, "Opacity has to be between 0.0 and 1.0." + assert rect.x >= 0 and rect.y >= 0, "Top left coordinates of the rect must be positive." + assert rect.width > 0 and rect.height > 0, "Rect dimensions should be positive." + assert rect.x + rect.width <= scene.shape[1] and rect.y + rect.height <= \ + scene.shape[0], "Image exceeds scene bounds." + + # Read image if a path is provided if isinstance(image, str): - assert os.path.exists(image), f'The specified path ("{image}") does not exist.' + assert os.path.exists(image), f"The specified path '{image}' does not exist." image = cv2.imread(image, cv2.IMREAD_UNCHANGED) - assert 0.0 <= opacity <= 1.0, "The opacity has to be between 0.0 and 1.0." - - assert ( - rect.x >= 0 and rect.y >= 0 - ), "The top left coordinates of the rectangle have to be positive." - assert ( - rect.x + rect.width <= scene.shape[1] and rect.y + rect.height <= scene.shape[0] - ), "The image you are trying to draw exceeds the bounds of the scene." - + # Resize the image image = cv2.resize(image, (rect.width, rect.height)) + # If image has an alpha channel, extract it + alpha_channel = None if image.shape[2] == 4: - b, g, r, a = cv2.split(image) - b = cv2.bitwise_and(b, b, mask=a) - g = cv2.bitwise_and(g, g, mask=a) - r = cv2.bitwise_and(r, r, mask=a) - image = cv2.merge([b, g, r, a]) - del b, g, r, a + alpha_channel = image[:, :, 3] + image = cv2.cvtColor(image, cv2.COLOR_BGRA2BGR) - if scene.shape[2] == 3: - scene = np.dstack([scene, np.ones(scene.shape[:2], dtype=np.uint8) * 255]) + # Apply opacity to the alpha channel + if alpha_channel is None: + alpha_channel = np.ones(image.shape[:2], dtype=image.dtype) * 255 + alpha_channel = cv2.convertScaleAbs(alpha_channel * opacity) - scene_h, scene_w, channels = scene.shape[:3] - water_h, water_w = image.shape[:2] + # Get ROI from the scene + scene_roi = scene[rect.y:rect.y + rect.height, rect.x:rect.x + rect.width] - overlay = np.zeros((scene_h, scene_w, channels), dtype="uint8") - overlay[rect.y : rect.y + water_h, rect.x : rect.x + water_w] = image + # Blend the image and the ROI + blended_roi = cv2.addWeighted(scene_roi, 1 - opacity, image, opacity, 0) - cv2.addWeighted(overlay, opacity, scene, 1.0, 0, scene) + # Apply the blended ROI to the scene + scene[rect.y:rect.y + rect.height, rect.x:rect.x + rect.width] = blended_roi - return scene[:, :, :3] + return scene From b35a6161dd5592c435efa469bce37a77abe4eb7c Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 18 Oct 2023 20:46:24 +0000 Subject: [PATCH 050/164] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/draw/utils.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/supervision/draw/utils.py b/supervision/draw/utils.py index 171694aa..550ab134 100644 --- a/supervision/draw/utils.py +++ b/supervision/draw/utils.py @@ -172,17 +172,20 @@ def draw_text( def draw_image( - scene: np.ndarray, image: Union[str, np.ndarray], opacity: float, rect: Rect + scene: np.ndarray, image: Union[str, np.ndarray], opacity: float, rect: Rect ) -> np.ndarray: """ Draws an image onto a given scene with specified opacity and dimensions. """ # Input checks assert 0.0 <= opacity <= 1.0, "Opacity has to be between 0.0 and 1.0." - assert rect.x >= 0 and rect.y >= 0, "Top left coordinates of the rect must be positive." + assert ( + rect.x >= 0 and rect.y >= 0 + ), "Top left coordinates of the rect must be positive." assert rect.width > 0 and rect.height > 0, "Rect dimensions should be positive." - assert rect.x + rect.width <= scene.shape[1] and rect.y + rect.height <= \ - scene.shape[0], "Image exceeds scene bounds." + assert ( + rect.x + rect.width <= scene.shape[1] and rect.y + rect.height <= scene.shape[0] + ), "Image exceeds scene bounds." # Read image if a path is provided if isinstance(image, str): @@ -204,12 +207,12 @@ def draw_image( alpha_channel = cv2.convertScaleAbs(alpha_channel * opacity) # Get ROI from the scene - scene_roi = scene[rect.y:rect.y + rect.height, rect.x:rect.x + rect.width] + scene_roi = scene[rect.y : rect.y + rect.height, rect.x : rect.x + rect.width] # Blend the image and the ROI blended_roi = cv2.addWeighted(scene_roi, 1 - opacity, image, opacity, 0) # Apply the blended ROI to the scene - scene[rect.y:rect.y + rect.height, rect.x:rect.x + rect.width] = blended_roi + scene[rect.y : rect.y + rect.height, rect.x : rect.x + rect.width] = blended_roi return scene From 893a19a991cf0e63b04a5ae2e93d817f082c7d15 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Wed, 18 Oct 2023 22:49:35 +0200 Subject: [PATCH 051/164] test --- supervision/draw/utils.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/supervision/draw/utils.py b/supervision/draw/utils.py index 171694aa..bded8142 100644 --- a/supervision/draw/utils.py +++ b/supervision/draw/utils.py @@ -192,22 +192,22 @@ def draw_image( # Resize the image image = cv2.resize(image, (rect.width, rect.height)) - # If image has an alpha channel, extract it - alpha_channel = None + # Handle alpha channel for transparent PNG if image.shape[2] == 4: alpha_channel = image[:, :, 3] image = cv2.cvtColor(image, cv2.COLOR_BGRA2BGR) + else: + alpha_channel = np.ones(image.shape[:2], dtype=image.dtype) * 255 # Apply opacity to the alpha channel - if alpha_channel is None: - alpha_channel = np.ones(image.shape[:2], dtype=image.dtype) * 255 alpha_channel = cv2.convertScaleAbs(alpha_channel * opacity) # Get ROI from the scene scene_roi = scene[rect.y:rect.y + rect.height, rect.x:rect.x + rect.width] - # Blend the image and the ROI - blended_roi = cv2.addWeighted(scene_roi, 1 - opacity, image, opacity, 0) + # Alpha blending + blended_roi = cv2.addWeighted(scene_roi, 1 - (alpha_channel / 255.0), image, + (alpha_channel / 255.0), 0) # Apply the blended ROI to the scene scene[rect.y:rect.y + rect.height, rect.x:rect.x + rect.width] = blended_roi From 08af18ad41193e7cfd75bc472683a8be51a8c6ea Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 18 Oct 2023 20:49:56 +0000 Subject: [PATCH 052/164] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/draw/utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/supervision/draw/utils.py b/supervision/draw/utils.py index 08f0b586..7acea903 100644 --- a/supervision/draw/utils.py +++ b/supervision/draw/utils.py @@ -209,8 +209,9 @@ def draw_image( scene_roi = scene[rect.y : rect.y + rect.height, rect.x : rect.x + rect.width] # Alpha blending - blended_roi = cv2.addWeighted(scene_roi, 1 - (alpha_channel / 255.0), image, - (alpha_channel / 255.0), 0) + blended_roi = cv2.addWeighted( + scene_roi, 1 - (alpha_channel / 255.0), image, (alpha_channel / 255.0), 0 + ) # Apply the blended ROI to the scene scene[rect.y : rect.y + rect.height, rect.x : rect.x + rect.width] = blended_roi From be16b84340970075179351e684028139a17affa0 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Wed, 18 Oct 2023 22:53:10 +0200 Subject: [PATCH 053/164] test --- supervision/draw/utils.py | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/supervision/draw/utils.py b/supervision/draw/utils.py index 08f0b586..8d8df0e4 100644 --- a/supervision/draw/utils.py +++ b/supervision/draw/utils.py @@ -172,20 +172,17 @@ def draw_text( def draw_image( - scene: np.ndarray, image: Union[str, np.ndarray], opacity: float, rect: Rect + scene: np.ndarray, image: Union[str, np.ndarray], opacity: float, rect: Rect ) -> np.ndarray: """ Draws an image onto a given scene with specified opacity and dimensions. """ # Input checks assert 0.0 <= opacity <= 1.0, "Opacity has to be between 0.0 and 1.0." - assert ( - rect.x >= 0 and rect.y >= 0 - ), "Top left coordinates of the rect must be positive." + assert rect.x >= 0 and rect.y >= 0, "Top left coordinates of the rect must be positive." assert rect.width > 0 and rect.height > 0, "Rect dimensions should be positive." - assert ( - rect.x + rect.width <= scene.shape[1] and rect.y + rect.height <= scene.shape[0] - ), "Image exceeds scene bounds." + assert rect.x + rect.width <= scene.shape[1] and rect.y + rect.height <= \ + scene.shape[0], "Image exceeds scene bounds." # Read image if a path is provided if isinstance(image, str): @@ -206,13 +203,19 @@ def draw_image( alpha_channel = cv2.convertScaleAbs(alpha_channel * opacity) # Get ROI from the scene - scene_roi = scene[rect.y : rect.y + rect.height, rect.x : rect.x + rect.width] + scene_roi = scene[rect.y:rect.y + rect.height, rect.x:rect.x + rect.width] # Alpha blending - blended_roi = cv2.addWeighted(scene_roi, 1 - (alpha_channel / 255.0), image, - (alpha_channel / 255.0), 0) + alpha_float = alpha_channel.astype(np.float32) / 255.0 + blended_roi = cv2.addWeighted( + scene_roi, + 1.0 - alpha_float[..., np.newaxis], + image, + alpha_float[..., np.newaxis], + 0 + ) # Apply the blended ROI to the scene - scene[rect.y : rect.y + rect.height, rect.x : rect.x + rect.width] = blended_roi + scene[rect.y:rect.y + rect.height, rect.x:rect.x + rect.width] = blended_roi return scene From a5c211ff61e691f9f5aa473fd2ed45b9050cf992 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 18 Oct 2023 20:54:15 +0000 Subject: [PATCH 054/164] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/draw/utils.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/supervision/draw/utils.py b/supervision/draw/utils.py index 8d8df0e4..ceb453d8 100644 --- a/supervision/draw/utils.py +++ b/supervision/draw/utils.py @@ -172,17 +172,20 @@ def draw_text( def draw_image( - scene: np.ndarray, image: Union[str, np.ndarray], opacity: float, rect: Rect + scene: np.ndarray, image: Union[str, np.ndarray], opacity: float, rect: Rect ) -> np.ndarray: """ Draws an image onto a given scene with specified opacity and dimensions. """ # Input checks assert 0.0 <= opacity <= 1.0, "Opacity has to be between 0.0 and 1.0." - assert rect.x >= 0 and rect.y >= 0, "Top left coordinates of the rect must be positive." + assert ( + rect.x >= 0 and rect.y >= 0 + ), "Top left coordinates of the rect must be positive." assert rect.width > 0 and rect.height > 0, "Rect dimensions should be positive." - assert rect.x + rect.width <= scene.shape[1] and rect.y + rect.height <= \ - scene.shape[0], "Image exceeds scene bounds." + assert ( + rect.x + rect.width <= scene.shape[1] and rect.y + rect.height <= scene.shape[0] + ), "Image exceeds scene bounds." # Read image if a path is provided if isinstance(image, str): @@ -203,7 +206,7 @@ def draw_image( alpha_channel = cv2.convertScaleAbs(alpha_channel * opacity) # Get ROI from the scene - scene_roi = scene[rect.y:rect.y + rect.height, rect.x:rect.x + rect.width] + scene_roi = scene[rect.y : rect.y + rect.height, rect.x : rect.x + rect.width] # Alpha blending alpha_float = alpha_channel.astype(np.float32) / 255.0 @@ -212,10 +215,10 @@ def draw_image( 1.0 - alpha_float[..., np.newaxis], image, alpha_float[..., np.newaxis], - 0 + 0, ) # Apply the blended ROI to the scene - scene[rect.y:rect.y + rect.height, rect.x:rect.x + rect.width] = blended_roi + scene[rect.y : rect.y + rect.height, rect.x : rect.x + rect.width] = blended_roi return scene From 0e6d69cf854c58251b5acdf566788bd2690d4c58 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Wed, 18 Oct 2023 22:56:09 +0200 Subject: [PATCH 055/164] test --- supervision/draw/utils.py | 32 ++++++++------------------------ 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/supervision/draw/utils.py b/supervision/draw/utils.py index 8d8df0e4..ddacdf37 100644 --- a/supervision/draw/utils.py +++ b/supervision/draw/utils.py @@ -177,45 +177,29 @@ def draw_image( """ Draws an image onto a given scene with specified opacity and dimensions. """ - # Input checks - assert 0.0 <= opacity <= 1.0, "Opacity has to be between 0.0 and 1.0." - assert rect.x >= 0 and rect.y >= 0, "Top left coordinates of the rect must be positive." - assert rect.width > 0 and rect.height > 0, "Rect dimensions should be positive." - assert rect.x + rect.width <= scene.shape[1] and rect.y + rect.height <= \ - scene.shape[0], "Image exceeds scene bounds." # Read image if a path is provided if isinstance(image, str): - assert os.path.exists(image), f"The specified path '{image}' does not exist." image = cv2.imread(image, cv2.IMREAD_UNCHANGED) # Resize the image image = cv2.resize(image, (rect.width, rect.height)) - # Handle alpha channel for transparent PNG + # If the image has an alpha channel, extract it and remove from the image if image.shape[2] == 4: alpha_channel = image[:, :, 3] - image = cv2.cvtColor(image, cv2.COLOR_BGRA2BGR) + image = image[:, :, :3] else: - alpha_channel = np.ones(image.shape[:2], dtype=image.dtype) * 255 + alpha_channel = np.ones((rect.height, rect.width), dtype=np.uint8) * 255 # Apply opacity to the alpha channel alpha_channel = cv2.convertScaleAbs(alpha_channel * opacity) - # Get ROI from the scene - scene_roi = scene[rect.y:rect.y + rect.height, rect.x:rect.x + rect.width] + # Define the ROI and blend the image onto the scene + roi = scene[rect.y: rect.y + rect.height, rect.x: rect.x + rect.width] - # Alpha blending - alpha_float = alpha_channel.astype(np.float32) / 255.0 - blended_roi = cv2.addWeighted( - scene_roi, - 1.0 - alpha_float[..., np.newaxis], - image, - alpha_float[..., np.newaxis], - 0 - ) - - # Apply the blended ROI to the scene - scene[rect.y:rect.y + rect.height, rect.x:rect.x + rect.width] = blended_roi + for c in range(0, 3): + roi[:, :, c] = roi[:, :, c] * (1 - alpha_channel / 255.0) + image[:, :, c] * ( + alpha_channel / 255.0) return scene From 8b73c12bcc89d378ecc4abcef8d6eb888d3b8d87 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Wed, 18 Oct 2023 22:58:58 +0200 Subject: [PATCH 056/164] test --- supervision/draw/utils.py | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/supervision/draw/utils.py b/supervision/draw/utils.py index ddacdf37..2bc26e6b 100644 --- a/supervision/draw/utils.py +++ b/supervision/draw/utils.py @@ -172,20 +172,20 @@ def draw_text( def draw_image( - scene: np.ndarray, image: Union[str, np.ndarray], opacity: float, rect: Rect + scene: np.ndarray, image: Union[str, np.ndarray], opacity: float, rect: Rect ) -> np.ndarray: """ Draws an image onto a given scene with specified opacity and dimensions. """ - # Read image if a path is provided + # Load image if a path is provided if isinstance(image, str): image = cv2.imread(image, cv2.IMREAD_UNCHANGED) # Resize the image image = cv2.resize(image, (rect.width, rect.height)) - # If the image has an alpha channel, extract it and remove from the image + # Separate the alpha channel if present if image.shape[2] == 4: alpha_channel = image[:, :, 3] image = image[:, :, :3] @@ -195,11 +195,21 @@ def draw_image( # Apply opacity to the alpha channel alpha_channel = cv2.convertScaleAbs(alpha_channel * opacity) - # Define the ROI and blend the image onto the scene - roi = scene[rect.y: rect.y + rect.height, rect.x: rect.x + rect.width] + # Get the ROI from the scene + scene_roi = scene[rect.y:rect.y + rect.height, rect.x:rect.x + rect.width] - for c in range(0, 3): - roi[:, :, c] = roi[:, :, c] * (1 - alpha_channel / 255.0) + image[:, :, c] * ( - alpha_channel / 255.0) + # Manually apply alpha blending + alpha_float = alpha_channel.astype(np.float32) / 255.0 + blended_roi = ((1.0 - alpha_float[..., np.newaxis]) * scene_roi.astype(np.float32)) + (alpha_float[..., np.newaxis] * image.astype(np.float32)) + blended_roi = blended_roi.astype(np.uint8) + + # Insert blended ROI back into the scene + scene[rect.y:rect.y + rect.height, rect.x:rect.x + rect.width] = blended_roi return scene + + + + + + From 586ff5b3fbe50ec189d1e588589b248d6b9f3e1c Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 18 Oct 2023 20:59:14 +0000 Subject: [PATCH 057/164] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/draw/utils.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/supervision/draw/utils.py b/supervision/draw/utils.py index 2bc26e6b..56740377 100644 --- a/supervision/draw/utils.py +++ b/supervision/draw/utils.py @@ -1,4 +1,3 @@ -import os from typing import Optional, Union import cv2 @@ -196,20 +195,16 @@ def draw_image( alpha_channel = cv2.convertScaleAbs(alpha_channel * opacity) # Get the ROI from the scene - scene_roi = scene[rect.y:rect.y + rect.height, rect.x:rect.x + rect.width] + scene_roi = scene[rect.y : rect.y + rect.height, rect.x : rect.x + rect.width] # Manually apply alpha blending alpha_float = alpha_channel.astype(np.float32) / 255.0 - blended_roi = ((1.0 - alpha_float[..., np.newaxis]) * scene_roi.astype(np.float32)) + (alpha_float[..., np.newaxis] * image.astype(np.float32)) + blended_roi = ( + (1.0 - alpha_float[..., np.newaxis]) * scene_roi.astype(np.float32) + ) + (alpha_float[..., np.newaxis] * image.astype(np.float32)) blended_roi = blended_roi.astype(np.uint8) # Insert blended ROI back into the scene - scene[rect.y:rect.y + rect.height, rect.x:rect.x + rect.width] = blended_roi + scene[rect.y : rect.y + rect.height, rect.x : rect.x + rect.width] = blended_roi return scene - - - - - - From 2fed8ae0c3e18ea79d8d6c04cbd35cc72db5c213 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Wed, 18 Oct 2023 23:10:36 +0200 Subject: [PATCH 058/164] test --- supervision/draw/utils.py | 68 +++++++++++++++++++++++++-------------- 1 file changed, 44 insertions(+), 24 deletions(-) diff --git a/supervision/draw/utils.py b/supervision/draw/utils.py index 56740377..721836f3 100644 --- a/supervision/draw/utils.py +++ b/supervision/draw/utils.py @@ -1,3 +1,4 @@ +import os from typing import Optional, Union import cv2 @@ -171,40 +172,59 @@ def draw_text( def draw_image( - scene: np.ndarray, image: Union[str, np.ndarray], opacity: float, rect: Rect + scene: np.ndarray, + image: Union[str, np.ndarray], + opacity: float, + rect: Rect ) -> np.ndarray: """ Draws an image onto a given scene with specified opacity and dimensions. + + Args: + scene (np.ndarray): Background image where the new image will be drawn. + image (Union[str, np.ndarray]): Image to draw. + opacity (float): Opacity of the image to be drawn. + rect (Rect): Rectangle specifying where to draw the image. + + Returns: + np.ndarray: The updated scene. + + Raises: + FileNotFoundError: If the image path does not exist. + ValueError: For invalid opacity or rectangle dimensions. """ - # Load image if a path is provided + # Validate and load image if isinstance(image, str): + if not os.path.exists(image): + raise FileNotFoundError(f"Image path ('{image}') does not exist.") image = cv2.imread(image, cv2.IMREAD_UNCHANGED) - # Resize the image + # Validate opacity + if not 0.0 <= opacity <= 1.0: + raise ValueError("Opacity must be between 0.0 and 1.0.") + + # Validate rectangle dimensions + if rect.x < 0 or rect.y < 0 or \ + rect.x + rect.width > scene.shape[1] or rect.y + rect.height > scene.shape[ + 0]: + raise ValueError("Invalid rectangle dimensions.") + + # Resize and isolate alpha channel image = cv2.resize(image, (rect.width, rect.height)) + alpha_channel = image[:, :, 3] if image.shape[2] == 4 else np.ones( + (rect.height, rect.width), dtype=image.dtype) * 255 + alpha_scaled = cv2.convertScaleAbs(alpha_channel * opacity) - # Separate the alpha channel if present - if image.shape[2] == 4: - alpha_channel = image[:, :, 3] - image = image[:, :, :3] - else: - alpha_channel = np.ones((rect.height, rect.width), dtype=np.uint8) * 255 + # Perform blending + scene_roi = scene[rect.y:rect.y + rect.height, rect.x:rect.x + rect.width] + alpha_float = alpha_scaled.astype(np.float32) / 255.0 + blended_roi = cv2.convertScaleAbs( + (1 - alpha_float[..., np.newaxis]) * scene_roi + alpha_float[ + ..., np.newaxis] * image[:, :, :3] + ) - # Apply opacity to the alpha channel - alpha_channel = cv2.convertScaleAbs(alpha_channel * opacity) - - # Get the ROI from the scene - scene_roi = scene[rect.y : rect.y + rect.height, rect.x : rect.x + rect.width] - - # Manually apply alpha blending - alpha_float = alpha_channel.astype(np.float32) / 255.0 - blended_roi = ( - (1.0 - alpha_float[..., np.newaxis]) * scene_roi.astype(np.float32) - ) + (alpha_float[..., np.newaxis] * image.astype(np.float32)) - blended_roi = blended_roi.astype(np.uint8) - - # Insert blended ROI back into the scene - scene[rect.y : rect.y + rect.height, rect.x : rect.x + rect.width] = blended_roi + # Update the scene + scene[rect.y:rect.y + rect.height, rect.x:rect.x + rect.width] = blended_roi return scene From 815c43beb8aba117914db4df59b9063879db3b99 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 18 Oct 2023 21:11:26 +0000 Subject: [PATCH 059/164] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/draw/utils.py | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/supervision/draw/utils.py b/supervision/draw/utils.py index 721836f3..1d4d5ec6 100644 --- a/supervision/draw/utils.py +++ b/supervision/draw/utils.py @@ -172,10 +172,7 @@ def draw_text( def draw_image( - scene: np.ndarray, - image: Union[str, np.ndarray], - opacity: float, - rect: Rect + scene: np.ndarray, image: Union[str, np.ndarray], opacity: float, rect: Rect ) -> np.ndarray: """ Draws an image onto a given scene with specified opacity and dimensions. @@ -205,26 +202,32 @@ def draw_image( raise ValueError("Opacity must be between 0.0 and 1.0.") # Validate rectangle dimensions - if rect.x < 0 or rect.y < 0 or \ - rect.x + rect.width > scene.shape[1] or rect.y + rect.height > scene.shape[ - 0]: + if ( + rect.x < 0 + or rect.y < 0 + or rect.x + rect.width > scene.shape[1] + or rect.y + rect.height > scene.shape[0] + ): raise ValueError("Invalid rectangle dimensions.") # Resize and isolate alpha channel image = cv2.resize(image, (rect.width, rect.height)) - alpha_channel = image[:, :, 3] if image.shape[2] == 4 else np.ones( - (rect.height, rect.width), dtype=image.dtype) * 255 + alpha_channel = ( + image[:, :, 3] + if image.shape[2] == 4 + else np.ones((rect.height, rect.width), dtype=image.dtype) * 255 + ) alpha_scaled = cv2.convertScaleAbs(alpha_channel * opacity) # Perform blending - scene_roi = scene[rect.y:rect.y + rect.height, rect.x:rect.x + rect.width] + scene_roi = scene[rect.y : rect.y + rect.height, rect.x : rect.x + rect.width] alpha_float = alpha_scaled.astype(np.float32) / 255.0 blended_roi = cv2.convertScaleAbs( - (1 - alpha_float[..., np.newaxis]) * scene_roi + alpha_float[ - ..., np.newaxis] * image[:, :, :3] + (1 - alpha_float[..., np.newaxis]) * scene_roi + + alpha_float[..., np.newaxis] * image[:, :, :3] ) # Update the scene - scene[rect.y:rect.y + rect.height, rect.x:rect.x + rect.width] = blended_roi + scene[rect.y : rect.y + rect.height, rect.x : rect.x + rect.width] = blended_roi return scene From a640e527d0c164b1f6d063186bddaf9865ae93cb Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Thu, 19 Oct 2023 00:41:13 +0200 Subject: [PATCH 060/164] Remove custom 404 page and update documentation for new release The custom 404.html was removed as it was no longer necessary with the updates to the Mkdocs.yml file. Upgraded the project version from 0.16.0rc2 to 0.16.0rc3 in the pyproject.toml file. Various updates were added to the changelog.md to reflect improvements and bug fixes in the new project release. This includes new annotations, utility improvements, and bug-fixes to improve project functionality. --- custom_theme/404.html | 7 ------- docs/changelog.md | 44 +++++++++++++++++++++++++++++++++++++++++++ mkdocs.yml | 1 - pyproject.toml | 2 +- 4 files changed, 45 insertions(+), 9 deletions(-) delete mode 100644 custom_theme/404.html diff --git a/custom_theme/404.html b/custom_theme/404.html deleted file mode 100644 index 4ce71946..00000000 --- a/custom_theme/404.html +++ /dev/null @@ -1,7 +0,0 @@ -{% extends "main.html" %} - -{% block content %} -

Page Not Found

-

The page you have requested was not found.

-

Go back to the documentation home.

-{% endblock %} diff --git a/docs/changelog.md b/docs/changelog.md index 5c303b86..a3088393 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,3 +1,47 @@ +### 0.16.0 October 19, 2023 + +- Added [#422](https://github.com/roboflow/supervision/pull/422): [`sv.BoxMaskAnnotator`](https://supervision.roboflow.com/annotators/#supervision.annotators.core.BoxMaskAnnotator) allowing to annotate images and videos with mox masks. + +- Added [#433](https://github.com/roboflow/supervision/pull/433): [`sv.HaloAnnotator`](https://supervision.roboflow.com/annotators/#supervision.annotators.core.HaloAnnotator) allowing to annotate images and videos with halo effect. + +```python +>>> import supervision as sv + +>>> image = ... +>>> detections = sv.Detections(...) + +>>> halo_annotator = sv.HaloAnnotator() +>>> annotated_frame = halo_annotator.annotate( +... scene=image.copy(), +... detections=detections +... ) +``` + +- Added [#466](https://github.com/roboflow/supervision/pull/466): [`sv.HeatMapAnnotator`](https://supervision.roboflow.com/annotators/#supervision.annotators.core.HeatMapAnnotator) allowing to annotate videos with heat maps. + +- Added [#492](https://github.com/roboflow/supervision/pull/492): [`sv.DotAnnotator`](https://supervision.roboflow.com/annotators/#supervision.annotators.core.DotAnnotator) allowing to annotate images and videos with dots. + +- Added [#449](https://github.com/roboflow/supervision/pull/449): [`sv.draw_image`](https://supervision.roboflow.com/draw/utils/#supervision.draw.utils.draw_image) allowing to draw an image onto a given scene with specified opacity and dimensions. + +- Added [#280](https://github.com/roboflow/supervision/pull/280): [`sv.FPSMonitor`](https://supervision.roboflow.com/utils/video/#supervision.utils.video.FPSMonitor) for monitoring frames per second (FPS) to benchmark latency. + +- Added [#454](https://github.com/roboflow/supervision/pull/454): 🤗 Hugging Face Annotators [space](https://huggingface.co/spaces/Roboflow/Annotators). + +- Changed [#482](https://github.com/roboflow/supervision/pull/482): [`sv.LineZone.tigger`](https://supervision.roboflow.com/detection/tools/line_zone/#supervision.detection.line_counter.LineZone.trigger) now return `Tuple[np.ndarray, np.ndarray]`. The first array indicates which detections have crossed the line from outside to inside. The second array indicates which detections have crossed the line from inside to outside. + +- Changed [#465](https://github.com/roboflow/supervision/pull/465): Annotator argument name from `color_map: str` to `color_lookup: ColorLookup` enum to increase type safety. + +- Changed [#426](https://github.com/roboflow/supervision/pull/426): [`sv.MaskAnnotator`](https://supervision.roboflow.com/annotators/#supervision.annotators.core.MaskAnnotator) allowing 2x faster annotation. + +- Fixed [#477](https://github.com/roboflow/supervision/pull/477): Poetry env definition allowing proper local installation. + +- Fixed [#430](https://github.com/roboflow/supervision/pull/430): [`sv.ByteTrack`](https://supervision.roboflow.com/trackers/#supervision.tracker.byte_tracker.core.ByteTrack) to return `np.array([], dtype=int)` when `svDetections` is empty. + +!!! warning + + `sv.Detections.from_yolov8` and `sv.Classifications.from_yolov8` as those are now replaced by [`sv.Detections.from_ultralytics`](https://supervision.roboflow.com/detection/core/#supervision.detection.core.Detections.from_ultralytics) and [`sv.Classifications.from_ultralytics`](https://supervision.roboflow.com/classification/core/#supervision.classification.core.Classifications.from_ultralytics). + + ### 0.15.0 October 5, 2023 - Added [#170](https://github.com/roboflow/supervision/pull/170): [`sv.BoundingBoxAnnotator`](https://supervision.roboflow.com/annotators/#supervision.annotators.core.BoundingBoxAnnotator) allowing to annotate images and videos with bounding boxes. diff --git a/mkdocs.yml b/mkdocs.yml index 98d21dc4..6f0cbed4 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -78,7 +78,6 @@ theme: font: text: Roboto code: Roboto Mono - custom_dir: 'custom_theme' plugins: - mkdocstrings diff --git a/pyproject.toml b/pyproject.toml index d78a50b7..95b5b242 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "supervision" -version = "0.16.0rc2" +version = "0.16.0rc3" description = "A set of easy-to-use utils that will come in handy in any Computer Vision project" authors = ["Piotr Skalski "] maintainers = ["Piotr Skalski "] From c1797ffd81fcb628cab6a099155f323f3395317e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 18 Oct 2023 22:42:54 +0000 Subject: [PATCH 061/164] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changelog.md b/docs/changelog.md index a3088393..1039bb07 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,6 +1,6 @@ ### 0.16.0 October 19, 2023 -- Added [#422](https://github.com/roboflow/supervision/pull/422): [`sv.BoxMaskAnnotator`](https://supervision.roboflow.com/annotators/#supervision.annotators.core.BoxMaskAnnotator) allowing to annotate images and videos with mox masks. +- Added [#422](https://github.com/roboflow/supervision/pull/422): [`sv.BoxMaskAnnotator`](https://supervision.roboflow.com/annotators/#supervision.annotators.core.BoxMaskAnnotator) allowing to annotate images and videos with mox masks. - Added [#433](https://github.com/roboflow/supervision/pull/433): [`sv.HaloAnnotator`](https://supervision.roboflow.com/annotators/#supervision.annotators.core.HaloAnnotator) allowing to annotate images and videos with halo effect. From f44a9376ec1bc21ca9f05f57f78cdf4995e2bd1f Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Thu, 19 Oct 2023 10:22:38 +0200 Subject: [PATCH 062/164] Update version number in pyproject.toml Updated the version number in pyproject.toml from 0.16.0rc3 to 0.16.0. This denotes the transition from the release candidate to the official version. --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 95b5b242..cd47f273 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "supervision" -version = "0.16.0rc3" +version = "0.16.0" description = "A set of easy-to-use utils that will come in handy in any Computer Vision project" authors = ["Piotr Skalski "] maintainers = ["Piotr Skalski "] From b815c0e7fc86702d8ac54daf639ac275379ae3d1 Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Sat, 21 Oct 2023 10:36:30 +0300 Subject: [PATCH 063/164] =?UTF-8?q?fix(notebook):=20=F0=9F=90=9B?= =?UTF-8?q?=F0=9F=93=98=20sam=20detection=20ColorLookup=20param=20and=20en?= =?UTF-8?q?um=20added=20and=20sv=20version=20updated?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Onuralp SEZER --- demo.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/demo.ipynb b/demo.ipynb index 11abb584..9c06b62c 100644 --- a/demo.ipynb +++ b/demo.ipynb @@ -226,7 +226,7 @@ "output_type": "stream", "text": [ "\u001b[?25l \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m0.0/45.4 kB\u001b[0m \u001b[31m?\u001b[0m eta \u001b[36m-:--:--\u001b[0m\r\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m45.4/45.4 kB\u001b[0m \u001b[31m3.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", - "\u001b[?25h0.15.0\n" + "\u001b[?25h0.16.0\n" ] } ], @@ -540,7 +540,7 @@ } ], "source": [ - "mask_annotator = sv.MaskAnnotator(color_map=\"index\")\n", + "mask_annotator = sv.MaskAnnotator(color_lookup=sv.ColorLookup.INDEX)\n", "\n", "annotated_image = mask_annotator.annotate(image.copy(), detections=detections)\n", "\n", From 8bf721559f7eebb6a2c8ce0f2cc2c4e7eec3c74e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 23 Oct 2023 17:44:59 +0000 Subject: [PATCH 064/164] =?UTF-8?q?chore(pre=5Fcommit):=20=E2=AC=86=20pre?= =?UTF-8?q?=5Fcommit=20autoupdate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black: 23.9.1 → 23.10.0](https://github.com/psf/black/compare/23.9.1...23.10.0) - [github.com/astral-sh/ruff-pre-commit: v0.0.292 → v0.1.1](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.292...v0.1.1) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2e0b0ede..2853b370 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -65,12 +65,12 @@ repos: - repo: https://github.com/psf/black - rev: 23.9.1 + rev: 23.10.0 hooks: - id: black - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.0.292 + rev: v0.1.1 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] From f987e4f7862c5fc1d1bd2fddbff72b57c33399b7 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Tue, 24 Oct 2023 13:23:05 +0200 Subject: [PATCH 065/164] Refactor video assets enum and variable names Renamed enum and variables to improve clarity for VideoAssets in asset_list.py. For instance, MILK_1 is updated to MILK_BOTTLED_PLANT and PEOPLE_WALKING_BW to PEOPLE_WALKING. Also, the VIDEO_ASSETS dictionary type hint updated to Dict. Additionally, a new method 'list' added to class VideoAssets that returns a list of all enum values. --- supervision/assets/asset_list.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/supervision/assets/asset_list.py b/supervision/assets/asset_list.py index 588cdff3..92e977e4 100644 --- a/supervision/assets/asset_list.py +++ b/supervision/assets/asset_list.py @@ -1,19 +1,25 @@ from enum import Enum +from typing import Tuple, Dict + BASE_VIDEO_URL = "https://media.roboflow.com/supervision/video-examples/" class VideoAssets(Enum): VEHICLES = "vehicles.mp4" - MILK_1 = "milk-video-1.mp4" + MILK_BOTTLING_PLANT = "milk-bottling-plant.mp4" VEHICLES_2 = "vehicles-2.mp4" GROCERY_STORE = "grocery-store.mp4" SUBWAY = "subway.mp4" MARKET_SQUARE = "market-square.mp4" - PEOPLE_WALKING_BW = "people-walking-bw.mp4" + PEOPLE_WALKING = "people-walking.mp4" + + @classmethod + def list(cls): + return list(map(lambda c: c.value, cls)) -VIDEO_ASSETS: dict[str : tuple[str]] = { +VIDEO_ASSETS: Dict[str, Tuple[str, str]] = { VideoAssets.VEHICLES.value: ( f"{BASE_VIDEO_URL}{VideoAssets.VEHICLES.value}", "8155ff4e4de08cfa25f39de96483f918", @@ -22,8 +28,8 @@ VIDEO_ASSETS: dict[str : tuple[str]] = { f"{BASE_VIDEO_URL}{VideoAssets.VEHICLES_2.value}", "830af6fba21ffbf14867a7fea595937b", ), - VideoAssets.MILK_1.value: ( - f"{BASE_VIDEO_URL}{VideoAssets.MILK_1.value}", + VideoAssets.MILK_BOTTLING_PLANT.value: ( + f"{BASE_VIDEO_URL}{VideoAssets.MILK_BOTTLING_PLANT.value}", "9e8fb6e883f842a38b3d34267290bdc7", ), VideoAssets.GROCERY_STORE.value: ( @@ -38,8 +44,8 @@ VIDEO_ASSETS: dict[str : tuple[str]] = { f"{BASE_VIDEO_URL}{VideoAssets.MARKET_SQUARE.value}", "859179bf4a21f80a8baabfdb2ed716dc", ), - VideoAssets.PEOPLE_WALKING_BW.value: ( - f"{BASE_VIDEO_URL}{VideoAssets.PEOPLE_WALKING_BW.value}", + VideoAssets.PEOPLE_WALKING.value: ( + f"{BASE_VIDEO_URL}{VideoAssets.PEOPLE_WALKING.value}", "0574c053c8686c3f1dc0aa3743e45cb9", ), } From 7faddb52ca75492a0e39b7bb69dd70246af62d5b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 24 Oct 2023 11:23:23 +0000 Subject: [PATCH 066/164] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/assets/asset_list.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/supervision/assets/asset_list.py b/supervision/assets/asset_list.py index 92e977e4..d7ba5644 100644 --- a/supervision/assets/asset_list.py +++ b/supervision/assets/asset_list.py @@ -1,6 +1,5 @@ from enum import Enum - -from typing import Tuple, Dict +from typing import Dict, Tuple BASE_VIDEO_URL = "https://media.roboflow.com/supervision/video-examples/" From 03fd015f39c203d4e6bfb65ddf0cb8418f8cbf34 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Tue, 24 Oct 2023 14:04:00 +0200 Subject: [PATCH 067/164] Improve readability and maintainability in downloader.py --- supervision/assets/downloader.py | 48 +++++++++++++++----------------- 1 file changed, 22 insertions(+), 26 deletions(-) diff --git a/supervision/assets/downloader.py b/supervision/assets/downloader.py index b5312d9c..2d494dca 100644 --- a/supervision/assets/downloader.py +++ b/supervision/assets/downloader.py @@ -1,3 +1,4 @@ +import os from functools import partial from hashlib import md5 from os import remove as os_remove @@ -22,31 +23,33 @@ except ImportError: ) -# md5 check function -def _check_md5(filename: str, orig_md5: str) -> bool: +def is_md5_hash_matching(filename: str, original_md5_hash: str) -> bool: """ - filename: str, A string representing the path to the file. - orig_md5: str, A string representing the original md5 hash. + Check if the MD5 hash of a file matches the original hash. + + Parameters: + filename (str): The path to the file to be checked as a string. + original_md5_hash (str): The original MD5 hash to compare against. + + Returns: + bool: True if the hashes match, False otherwise. """ - if not path_exists(filename): - return False - with open(filename, "rb") as file_to_check: - # read contents of the file - data = file_to_check.read() - # pipe contents of the file through - md5_returned = md5(data).hexdigest() - # Return True if the computed hash matches the original one - if md5_returned == orig_md5: - return True + if not os.path.exists(filename): return False + with open(filename, "rb") as file: + file_contents = file.read() + computed_md5_hash = md5(file_contents).hexdigest() + + return computed_md5_hash == original_md5_hash + def download_assets(asset_name: Union[VideoAssets, str]) -> str: """ asset_name: VIDEO_ASSETS, name of the file to download """ - filename = f"{asset_name}" + filename = asset_name.value if isinstance(asset_name, VideoAssets) else asset_name if not path_exists(filename) and asset_name in VIDEO_ASSETS: print(f"Downloading {filename} assets \n") res: Response = get( @@ -66,19 +69,19 @@ def download_assets(asset_name: Union[VideoAssets, str]) -> str: desc = "(Unknown total file size)" if file_size == 0 else "" res.raw.read = partial( res.raw.read, decode_content=True - ) # Decompress if needed + ) with tqdm.wrapattr( res.raw, "read", total=file_size, desc=desc, - colour="a351fb", + colour="#a351fb", ) as r_raw: with folder_path.open("wb") as f: copyfileobj(r_raw, f) elif path_exists(filename): - if not _check_md5(filename, VIDEO_ASSETS[asset_name][2]): + if not is_md5_hash_matching(filename, VIDEO_ASSETS[asset_name][2]): print("File corrupted. Re-downloading... \n") os_remove(filename) download_assets(asset_name) @@ -86,14 +89,7 @@ def download_assets(asset_name: Union[VideoAssets, str]) -> str: print(f"{filename} asset download complete. \n") else: raise ValueError( - "Invalid asset type. It should be one of the following: \n" - "vehicles.mp4 \n" - "vehicles-2.mp4 \n" - "milk-video-1.mp4 \n" - "grocery-store.mp4 \n" - "subway.mp4 \n" - "market-square.mp4 \n" - "people-walking-bw.mp4 \n" + f"Invalid asset. It should be one of the following: {VideoAssets.list()}." ) return filename From 52452c019c792b98f501cbbc592cbb210e132055 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 24 Oct 2023 12:04:33 +0000 Subject: [PATCH 068/164] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/assets/downloader.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/supervision/assets/downloader.py b/supervision/assets/downloader.py index 2d494dca..fdd91488 100644 --- a/supervision/assets/downloader.py +++ b/supervision/assets/downloader.py @@ -67,9 +67,7 @@ def download_assets(asset_name: Union[VideoAssets, str]) -> str: folder_path.parent.mkdir(parents=True, exist_ok=True) desc = "(Unknown total file size)" if file_size == 0 else "" - res.raw.read = partial( - res.raw.read, decode_content=True - ) + res.raw.read = partial(res.raw.read, decode_content=True) with tqdm.wrapattr( res.raw, "read", From 24aefe6bcd34cb9c3e38a7e93878e9c14b563c41 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Tue, 24 Oct 2023 14:12:45 +0200 Subject: [PATCH 069/164] Fix asset name checking in downloader module --- supervision/assets/downloader.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/supervision/assets/downloader.py b/supervision/assets/downloader.py index 2d494dca..b5f4a0de 100644 --- a/supervision/assets/downloader.py +++ b/supervision/assets/downloader.py @@ -50,7 +50,7 @@ def download_assets(asset_name: Union[VideoAssets, str]) -> str: """ filename = asset_name.value if isinstance(asset_name, VideoAssets) else asset_name - if not path_exists(filename) and asset_name in VIDEO_ASSETS: + if not path_exists(filename) and filename in VIDEO_ASSETS: print(f"Downloading {filename} assets \n") res: Response = get( VIDEO_ASSETS[asset_name][0], stream=True, allow_redirects=True From 7715ef2a17c84e48612de2fb861e37aac724fa5d Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Tue, 24 Oct 2023 14:16:46 +0200 Subject: [PATCH 070/164] The downloader was incorrectly using 'asset_name' instead of 'filename' leading to missed video asset downloads. The reference has been corrected to use 'filename' for proper checking and downloading. --- supervision/assets/downloader.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/supervision/assets/downloader.py b/supervision/assets/downloader.py index a501c468..6ef53c4a 100644 --- a/supervision/assets/downloader.py +++ b/supervision/assets/downloader.py @@ -53,7 +53,7 @@ def download_assets(asset_name: Union[VideoAssets, str]) -> str: if not path_exists(filename) and filename in VIDEO_ASSETS: print(f"Downloading {filename} assets \n") res: Response = get( - VIDEO_ASSETS[asset_name][0], stream=True, allow_redirects=True + VIDEO_ASSETS[filename][0], stream=True, allow_redirects=True ) if res.status_code != 200: res.raise_for_status() From a36abd4297a878d5ba7fc247daede03d7495c2d4 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Tue, 24 Oct 2023 14:21:58 +0200 Subject: [PATCH 071/164] "Fix reference bug in video asset downloader Updated 'asset_name' to 'filename' in downloader.py. The downloader was using the incorrect variable 'asset_name', causing failed video asset downloads. Correcting to 'filename' allows for accurate md5 check and download." --- supervision/assets/downloader.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/supervision/assets/downloader.py b/supervision/assets/downloader.py index 6ef53c4a..6ce25b00 100644 --- a/supervision/assets/downloader.py +++ b/supervision/assets/downloader.py @@ -79,10 +79,10 @@ def download_assets(asset_name: Union[VideoAssets, str]) -> str: copyfileobj(r_raw, f) elif path_exists(filename): - if not is_md5_hash_matching(filename, VIDEO_ASSETS[asset_name][2]): + if not is_md5_hash_matching(filename, VIDEO_ASSETS[filename][2]): print("File corrupted. Re-downloading... \n") os_remove(filename) - download_assets(asset_name) + download_assets(filename) print(f"{filename} asset download complete. \n") else: From 6887b0b412f008cbb5473ec9b227c7788fb215c8 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Tue, 24 Oct 2023 14:25:11 +0200 Subject: [PATCH 072/164] "Correct md5 hash reference in downloader script Updated the reference for the md5 hash in downloader.py. --- supervision/assets/downloader.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/supervision/assets/downloader.py b/supervision/assets/downloader.py index 6ce25b00..5e26e2de 100644 --- a/supervision/assets/downloader.py +++ b/supervision/assets/downloader.py @@ -79,7 +79,7 @@ def download_assets(asset_name: Union[VideoAssets, str]) -> str: copyfileobj(r_raw, f) elif path_exists(filename): - if not is_md5_hash_matching(filename, VIDEO_ASSETS[filename][2]): + if not is_md5_hash_matching(filename, VIDEO_ASSETS[filename][1]): print("File corrupted. Re-downloading... \n") os_remove(filename) download_assets(filename) From 3391eec0787d5d997713b120d2864a394fa7e82c Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Tue, 24 Oct 2023 14:31:31 +0200 Subject: [PATCH 073/164] Refactor and improve readability of downloader.py The code for the downloader function in the supervision/assets/downloader.py file has been refactored and optimized. Package imports were cleaned up to remove unnecessary functions and the "path_exists" and "os_remove" functions were replaced with their pathlib equivalents to improve consistency. --- supervision/assets/downloader.py | 57 ++++++++++++++------------------ 1 file changed, 25 insertions(+), 32 deletions(-) diff --git a/supervision/assets/downloader.py b/supervision/assets/downloader.py index 5e26e2de..e9c0d029 100644 --- a/supervision/assets/downloader.py +++ b/supervision/assets/downloader.py @@ -1,8 +1,5 @@ import os -from functools import partial from hashlib import md5 -from os import remove as os_remove -from os.path import exists as path_exists from pathlib import Path from shutil import copyfileobj from typing import Union @@ -46,48 +43,44 @@ def is_md5_hash_matching(filename: str, original_md5_hash: str) -> bool: def download_assets(asset_name: Union[VideoAssets, str]) -> str: """ - asset_name: VIDEO_ASSETS, name of the file to download + Download a specified asset if it doesn't already exist or is corrupted. + + Parameters: + asset_name (Union[VideoAssets, str]): The name or type of the asset to be + downloaded. + + Returns: + str: The filename of the downloaded asset. """ filename = asset_name.value if isinstance(asset_name, VideoAssets) else asset_name - if not path_exists(filename) and filename in VIDEO_ASSETS: - print(f"Downloading {filename} assets \n") - res: Response = get( - VIDEO_ASSETS[filename][0], stream=True, allow_redirects=True - ) - if res.status_code != 200: - res.raise_for_status() - raise RuntimeError( - f"Request to {VIDEO_ASSETS[asset_name][0]} " - f"returned status code {res.status_code}" - ) - file_size: int = int(res.headers.get("Content-Length", 0)) - folder_path: Path = Path(filename).expanduser().resolve() + if not Path(filename).exists() and filename in VIDEO_ASSETS: + print(f"Downloading {filename} assets \n") + response = get(VIDEO_ASSETS[filename][0], stream=True, allow_redirects=True) + response.raise_for_status() + + file_size = int(response.headers.get("Content-Length", 0)) + folder_path = Path(filename).expanduser().resolve() folder_path.parent.mkdir(parents=True, exist_ok=True) - desc = "(Unknown total file size)" if file_size == 0 else "" - res.raw.read = partial(res.raw.read, decode_content=True) with tqdm.wrapattr( - res.raw, - "read", - total=file_size, - desc=desc, - colour="#a351fb", - ) as r_raw: - with folder_path.open("wb") as f: - copyfileobj(r_raw, f) + response.raw, "read", total=file_size, desc="", colour="#a351fb" + ) as raw_resp: + with folder_path.open("wb") as file: + copyfileobj(raw_resp, file) - elif path_exists(filename): + elif Path(filename).exists(): if not is_md5_hash_matching(filename, VIDEO_ASSETS[filename][1]): print("File corrupted. Re-downloading... \n") - os_remove(filename) - download_assets(filename) + os.remove(filename) + return download_assets(filename) print(f"{filename} asset download complete. \n") + else: + valid_assets = ', '.join(asset.value for asset in VideoAssets) raise ValueError( - f"Invalid asset. It should be one of the following: {VideoAssets.list()}." - ) + f"Invalid asset. It should be one of the following: {valid_assets}.") return filename From 8689c294bf41ad8d636e4ecf8efd28b0e4be4bfd Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 24 Oct 2023 12:34:27 +0000 Subject: [PATCH 074/164] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/assets/downloader.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/supervision/assets/downloader.py b/supervision/assets/downloader.py index e9c0d029..77269a8c 100644 --- a/supervision/assets/downloader.py +++ b/supervision/assets/downloader.py @@ -79,8 +79,9 @@ def download_assets(asset_name: Union[VideoAssets, str]) -> str: print(f"{filename} asset download complete. \n") else: - valid_assets = ', '.join(asset.value for asset in VideoAssets) + valid_assets = ", ".join(asset.value for asset in VideoAssets) raise ValueError( - f"Invalid asset. It should be one of the following: {valid_assets}.") + f"Invalid asset. It should be one of the following: {valid_assets}." + ) return filename From 3f5f5fb070db7aa5fe12aedae41e7cf42eb2b3a9 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Tue, 24 Oct 2023 15:01:03 +0200 Subject: [PATCH 075/164] Rename asset_list.py and update VideoAssets enumeration The file asset_list.py has been renamed to list.py for better readability and simplicity. In the VideoAssets enumeration, additional information has been included. This includes specific details for each member of the enum, notably the filename of the related video and its URL. --- docs/assets.md | 7 +++++++ mkdocs.yml | 1 + supervision/assets/__init__.py | 2 +- supervision/assets/downloader.py | 2 +- supervision/assets/{asset_list.py => list.py} | 14 ++++++++++++++ 5 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 docs/assets.md rename supervision/assets/{asset_list.py => list.py} (51%) diff --git a/docs/assets.md b/docs/assets.md new file mode 100644 index 00000000..1a194a62 --- /dev/null +++ b/docs/assets.md @@ -0,0 +1,7 @@ +## download_assets + +:::supervision.assets.downloader.download_assets + +## VideoAssets + +:::supervision.assets.list.VideoAssets \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index 6528b238..7d5b0b5e 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -53,6 +53,7 @@ nav: - Image: utils/image.md - Notebook: utils/notebook.md - File: utils/file.md + - Assets: assets.md - Changelog: changelog.md theme: diff --git a/supervision/assets/__init__.py b/supervision/assets/__init__.py index 17119d2e..84f33869 100644 --- a/supervision/assets/__init__.py +++ b/supervision/assets/__init__.py @@ -1,2 +1,2 @@ -from .asset_list import VideoAssets +from .list import VideoAssets from .downloader import download_assets diff --git a/supervision/assets/downloader.py b/supervision/assets/downloader.py index e9c0d029..af24a290 100644 --- a/supervision/assets/downloader.py +++ b/supervision/assets/downloader.py @@ -5,7 +5,7 @@ from shutil import copyfileobj from typing import Union from supervision.assets import VideoAssets -from supervision.assets.asset_list import VIDEO_ASSETS +from supervision.assets.list import VIDEO_ASSETS try: from requests import Response, get diff --git a/supervision/assets/asset_list.py b/supervision/assets/list.py similarity index 51% rename from supervision/assets/asset_list.py rename to supervision/assets/list.py index d7ba5644..ec8dc47c 100644 --- a/supervision/assets/asset_list.py +++ b/supervision/assets/list.py @@ -5,6 +5,20 @@ BASE_VIDEO_URL = "https://media.roboflow.com/supervision/video-examples/" class VideoAssets(Enum): + """ #noqa + Each member of this enum represents a video asset. The value associated with each + member is the filename of the video. + + | Enum Member | Video Filename | Video URL | + |------------------------|----------------------------|---------------------------------------------------------------------------------------| + | `VEHICLES` | `vehicles.mp4` | [Link](https://media.roboflow.com/supervision/video-examples/vehicles.mp4) | + | `MILK_BOTTLING_PLANT` | `milk-bottling-plant.mp4` | [Link](https://media.roboflow.com/supervision/video-examples/milk-bottling-plant.mp4) | + | `VEHICLES_2` | `vehicles-2.mp4` | [Link](https://media.roboflow.com/supervision/video-examples/vehicles-2.mp4) | + | `GROCERY_STORE` | `grocery-store.mp4` | [Link](https://media.roboflow.com/supervision/video-examples/grocery-store.mp4) | + | `SUBWAY` | `subway.mp4` | [Link](https://media.roboflow.com/supervision/video-examples/subway.mp4) | + | `MARKET_SQUARE` | `market-square.mp4` | [Link](https://media.roboflow.com/supervision/video-examples/market-square.mp4) | + | `PEOPLE_WALKING` | `people-walking.mp4` | [Link](https://media.roboflow.com/supervision/video-examples/people-walking.mp4) | + """ VEHICLES = "vehicles.mp4" MILK_BOTTLING_PLANT = "milk-bottling-plant.mp4" VEHICLES_2 = "vehicles-2.mp4" From 7d3082c93b07ae18173277dadd8345b11395a4b0 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 24 Oct 2023 13:01:25 +0000 Subject: [PATCH 076/164] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/assets.md | 2 +- supervision/assets/__init__.py | 2 +- supervision/assets/list.py | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/assets.md b/docs/assets.md index 1a194a62..27b7b5f5 100644 --- a/docs/assets.md +++ b/docs/assets.md @@ -4,4 +4,4 @@ ## VideoAssets -:::supervision.assets.list.VideoAssets \ No newline at end of file +:::supervision.assets.list.VideoAssets diff --git a/supervision/assets/__init__.py b/supervision/assets/__init__.py index 84f33869..18cc0810 100644 --- a/supervision/assets/__init__.py +++ b/supervision/assets/__init__.py @@ -1,2 +1,2 @@ -from .list import VideoAssets from .downloader import download_assets +from .list import VideoAssets diff --git a/supervision/assets/list.py b/supervision/assets/list.py index ec8dc47c..96a0a6d9 100644 --- a/supervision/assets/list.py +++ b/supervision/assets/list.py @@ -5,7 +5,7 @@ BASE_VIDEO_URL = "https://media.roboflow.com/supervision/video-examples/" class VideoAssets(Enum): - """ #noqa + """#noqa Each member of this enum represents a video asset. The value associated with each member is the filename of the video. @@ -19,6 +19,7 @@ class VideoAssets(Enum): | `MARKET_SQUARE` | `market-square.mp4` | [Link](https://media.roboflow.com/supervision/video-examples/market-square.mp4) | | `PEOPLE_WALKING` | `people-walking.mp4` | [Link](https://media.roboflow.com/supervision/video-examples/people-walking.mp4) | """ + VEHICLES = "vehicles.mp4" MILK_BOTTLING_PLANT = "milk-bottling-plant.mp4" VEHICLES_2 = "vehicles-2.mp4" From 999c12162a6899ab7448bdc0fd8661897b5bbe51 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Tue, 24 Oct 2023 15:03:54 +0200 Subject: [PATCH 077/164] Refactor imports in downloader.py The 'Response' imported module from 'requests' in downloader.py is not needed. --- supervision/assets/downloader.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/supervision/assets/downloader.py b/supervision/assets/downloader.py index 25b535f2..04f1b4b2 100644 --- a/supervision/assets/downloader.py +++ b/supervision/assets/downloader.py @@ -8,7 +8,7 @@ from supervision.assets import VideoAssets from supervision.assets.list import VIDEO_ASSETS try: - from requests import Response, get + from requests import get from tqdm.auto import tqdm except ImportError: raise ValueError( From c529402068b4bf362e688c19db294bef735346b7 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Tue, 24 Oct 2023 15:05:00 +0200 Subject: [PATCH 078/164] Update docstring formatting in VideoAssets enum Updated the docstring comment's format inside the VideoAssets enum in supervision/assets/list.py. The update aligns with PEP 8 E501 error code that requires line too long (>80 characters). --- supervision/assets/list.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/supervision/assets/list.py b/supervision/assets/list.py index 96a0a6d9..a7a928e9 100644 --- a/supervision/assets/list.py +++ b/supervision/assets/list.py @@ -5,7 +5,7 @@ BASE_VIDEO_URL = "https://media.roboflow.com/supervision/video-examples/" class VideoAssets(Enum): - """#noqa + """ # noqa: E501 Each member of this enum represents a video asset. The value associated with each member is the filename of the video. From b6001e389ee546665cd03b4d95a9019744dde7e5 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Tue, 24 Oct 2023 15:05:00 +0200 Subject: [PATCH 079/164] Update docstring formatting in VideoAssets enum Updated the docstring comment's format inside the VideoAssets enum in supervision/assets/list.py. The update aligns with PEP 8 E501 error code that requires line too long (>80 characters). Signed-off-by: Onuralp SEZER --- supervision/assets/list.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/supervision/assets/list.py b/supervision/assets/list.py index 96a0a6d9..105736a7 100644 --- a/supervision/assets/list.py +++ b/supervision/assets/list.py @@ -5,7 +5,7 @@ BASE_VIDEO_URL = "https://media.roboflow.com/supervision/video-examples/" class VideoAssets(Enum): - """#noqa + """ Each member of this enum represents a video asset. The value associated with each member is the filename of the video. @@ -18,7 +18,7 @@ class VideoAssets(Enum): | `SUBWAY` | `subway.mp4` | [Link](https://media.roboflow.com/supervision/video-examples/subway.mp4) | | `MARKET_SQUARE` | `market-square.mp4` | [Link](https://media.roboflow.com/supervision/video-examples/market-square.mp4) | | `PEOPLE_WALKING` | `people-walking.mp4` | [Link](https://media.roboflow.com/supervision/video-examples/people-walking.mp4) | - """ + """ # noqa: E501 E261 VEHICLES = "vehicles.mp4" MILK_BOTTLING_PLANT = "milk-bottling-plant.mp4" From e9866c2f25e8570312d29415f32f853b76e31355 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Tue, 24 Oct 2023 15:40:19 +0200 Subject: [PATCH 080/164] "Add instructions for assets utility installation Expanded the documentation to include instructions on how to install and use the Supervision assets utility. Instructions include steps for performing the installation using pip, allowing users to easily download video files for their demos. --- docs/assets.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/assets.md b/docs/assets.md index 27b7b5f5..4fded6e7 100644 --- a/docs/assets.md +++ b/docs/assets.md @@ -1,3 +1,17 @@ +Supervision offers an assets download utility that allows you to download video files +that you can use in your demos. + +## install extra + +To install the Supervision assets utility, you can use pip. This utility is available +as an extra within the Supervision package. + +!!! example "pip install" + + ```bash + pip install supervision[assets] + ``` + ## download_assets :::supervision.assets.downloader.download_assets From 28fb656bcafbb71fb8f7f7b301d9a91cfad8a300 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Tue, 24 Oct 2023 15:05:00 +0200 Subject: [PATCH 081/164] Update docstring formatting in VideoAssets enum Updated the docstring comment's format inside the VideoAssets enum in supervision/assets/list.py. The update aligns with PEP 8 E501 error code that requires line too long (>80 characters). Signed-off-by: Onuralp SEZER --- pyproject.toml | 3 +++ supervision/assets/list.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 7c96ff69..5c93144d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -81,6 +81,7 @@ extend-ignore = """ """ per-file-ignores = """ __init__.py: F401 + supervision/assets/list.py: E501 """ [tool.isort] @@ -151,6 +152,7 @@ exclude = [ "yarn-error.log", "yarn.lock", "docs", + "supervision/assets/list.py" ] # Same as Black. @@ -169,6 +171,7 @@ convention = "google" [tool.ruff.per-file-ignores] "__init__.py" = ["E402","F401"] +"supervision/assets/list.py" = ["E501"] [tool.ruff.pylint] max-args = 20 diff --git a/supervision/assets/list.py b/supervision/assets/list.py index 96a0a6d9..a8ba566b 100644 --- a/supervision/assets/list.py +++ b/supervision/assets/list.py @@ -5,7 +5,7 @@ BASE_VIDEO_URL = "https://media.roboflow.com/supervision/video-examples/" class VideoAssets(Enum): - """#noqa + """ Each member of this enum represents a video asset. The value associated with each member is the filename of the video. From 671c8b3683234e4d1c9126de562126ec0c81bc2b Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Tue, 24 Oct 2023 15:49:32 +0200 Subject: [PATCH 082/164] Update asset list and project version --- pyproject.toml | 2 +- supervision/assets/list.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 5c93144d..11eac5a5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "supervision" -version = "0.16.0rc2" +version = "0.17.0rc1" description = "A set of easy-to-use utils that will come in handy in any Computer Vision project" authors = ["Piotr Skalski "] maintainers = ["Piotr Skalski "] diff --git a/supervision/assets/list.py b/supervision/assets/list.py index 105736a7..a8ba566b 100644 --- a/supervision/assets/list.py +++ b/supervision/assets/list.py @@ -18,7 +18,7 @@ class VideoAssets(Enum): | `SUBWAY` | `subway.mp4` | [Link](https://media.roboflow.com/supervision/video-examples/subway.mp4) | | `MARKET_SQUARE` | `market-square.mp4` | [Link](https://media.roboflow.com/supervision/video-examples/market-square.mp4) | | `PEOPLE_WALKING` | `people-walking.mp4` | [Link](https://media.roboflow.com/supervision/video-examples/people-walking.mp4) | - """ # noqa: E501 E261 + """ VEHICLES = "vehicles.mp4" MILK_BOTTLING_PLANT = "milk-bottling-plant.mp4" From 8c2d18d7529cc58316d5644986ef59e76b486322 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 24 Oct 2023 13:56:19 +0000 Subject: [PATCH 083/164] :arrow_up: Bump actions/first-interaction from 1.1.1 to 1.2.0 Bumps [actions/first-interaction](https://github.com/actions/first-interaction) from 1.1.1 to 1.2.0. - [Release notes](https://github.com/actions/first-interaction/releases) - [Commits](https://github.com/actions/first-interaction/compare/v1.1.1...v1.2.0) --- updated-dependencies: - dependency-name: actions/first-interaction dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/welcome.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/welcome.yml b/.github/workflows/welcome.yml index d5cf47ba..11e6df17 100644 --- a/.github/workflows/welcome.yml +++ b/.github/workflows/welcome.yml @@ -11,7 +11,7 @@ jobs: name: 👋 Welcome runs-on: ubuntu-latest steps: - - uses: actions/first-interaction@v1.1.1 + - uses: actions/first-interaction@v1.2.0 with: repo-token: ${{ secrets.GITHUB_TOKEN }} issue-message: "Hello there, thank you for opening an Issue ! 🙏🏻 The team was notified and they will get back to you asap." From 70017218721ded178e23d756c424c723d8e80734 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 24 Oct 2023 13:56:24 +0000 Subject: [PATCH 084/164] :arrow_up: Bump actions/checkout from 3 to 4 Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/docs.yml | 2 +- .github/workflows/publish-test.yml | 2 +- .github/workflows/publish.yml | 2 +- .github/workflows/test.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 2e0405cc..c15768df 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -10,7 +10,7 @@ jobs: deploy: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-python@v4 with: python-version: 3.x diff --git a/.github/workflows/publish-test.yml b/.github/workflows/publish-test.yml index b473a360..e0c77bee 100644 --- a/.github/workflows/publish-test.yml +++ b/.github/workflows/publish-test.yml @@ -16,7 +16,7 @@ jobs: steps: - name: Checkout source - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: 🐍 Set up Python 3.8 environment for build uses: actions/setup-python@v4 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index ee897360..3b7b3a6d 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -17,7 +17,7 @@ jobs: python-version: [3.8] steps: - name: 🛎️ Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: ${{ github.head_ref }} - name: 🐍 Set up Python ${{ matrix.python-version }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cd151b02..f9bbad99 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,7 +12,7 @@ jobs: python-version: ["3.8", "3.9", "3.10","3.11"] steps: - name: 🛎️ Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: 🐍 Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 # id based on python version From 46a50e9595bbde7d802b3998b4d3ce139b4728ce Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 24 Oct 2023 13:57:57 +0000 Subject: [PATCH 085/164] :arrow_up: Bump pytest from 7.4.0 to 7.4.2 Bumps [pytest](https://github.com/pytest-dev/pytest) from 7.4.0 to 7.4.2. - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest/compare/7.4.0...7.4.2) --- updated-dependencies: - dependency-name: pytest dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- poetry.lock | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/poetry.lock b/poetry.lock index 95eb8665..8f4ad89c 100644 --- a/poetry.lock +++ b/poetry.lock @@ -493,6 +493,7 @@ files = [ {file = "contourpy-1.1.0-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:18a64814ae7bce73925131381603fff0116e2df25230dfc80d6d690aa6e20b37"}, {file = "contourpy-1.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:90c81f22b4f572f8a2110b0b741bb64e5a6427e0a198b2cdc1fbaf85f352a3aa"}, {file = "contourpy-1.1.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:53cc3a40635abedbec7f1bde60f8c189c49e84ac180c665f2cd7c162cc454baa"}, + {file = "contourpy-1.1.0-cp310-cp310-win32.whl", hash = "sha256:9b2dd2ca3ac561aceef4c7c13ba654aaa404cf885b187427760d7f7d4c57cff8"}, {file = "contourpy-1.1.0-cp310-cp310-win_amd64.whl", hash = "sha256:1f795597073b09d631782e7245016a4323cf1cf0b4e06eef7ea6627e06a37ff2"}, {file = "contourpy-1.1.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:0b7b04ed0961647691cfe5d82115dd072af7ce8846d31a5fac6c142dcce8b882"}, {file = "contourpy-1.1.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:27bc79200c742f9746d7dd51a734ee326a292d77e7d94c8af6e08d1e6c15d545"}, @@ -501,6 +502,7 @@ files = [ {file = "contourpy-1.1.0-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:e5cec36c5090e75a9ac9dbd0ff4a8cf7cecd60f1b6dc23a374c7d980a1cd710e"}, {file = "contourpy-1.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1f0cbd657e9bde94cd0e33aa7df94fb73c1ab7799378d3b3f902eb8eb2e04a3a"}, {file = "contourpy-1.1.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:181cbace49874f4358e2929aaf7ba84006acb76694102e88dd15af861996c16e"}, + {file = "contourpy-1.1.0-cp311-cp311-win32.whl", hash = "sha256:edb989d31065b1acef3828a3688f88b2abb799a7db891c9e282df5ec7e46221b"}, {file = "contourpy-1.1.0-cp311-cp311-win_amd64.whl", hash = "sha256:fb3b7d9e6243bfa1efb93ccfe64ec610d85cfe5aec2c25f97fbbd2e58b531256"}, {file = "contourpy-1.1.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:bcb41692aa09aeb19c7c213411854402f29f6613845ad2453d30bf421fe68fed"}, {file = "contourpy-1.1.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:5d123a5bc63cd34c27ff9c7ac1cd978909e9c71da12e05be0231c608048bb2ae"}, @@ -509,6 +511,7 @@ files = [ {file = "contourpy-1.1.0-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:317267d915490d1e84577924bd61ba71bf8681a30e0d6c545f577363157e5e94"}, {file = "contourpy-1.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d551f3a442655f3dcc1285723f9acd646ca5858834efeab4598d706206b09c9f"}, {file = "contourpy-1.1.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:e7a117ce7df5a938fe035cad481b0189049e8d92433b4b33aa7fc609344aafa1"}, + {file = "contourpy-1.1.0-cp38-cp38-win32.whl", hash = "sha256:108dfb5b3e731046a96c60bdc46a1a0ebee0760418951abecbe0fc07b5b93b27"}, {file = "contourpy-1.1.0-cp38-cp38-win_amd64.whl", hash = "sha256:d4f26b25b4f86087e7d75e63212756c38546e70f2a92d2be44f80114826e1cd4"}, {file = "contourpy-1.1.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:bc00bb4225d57bff7ebb634646c0ee2a1298402ec10a5fe7af79df9a51c1bfd9"}, {file = "contourpy-1.1.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:189ceb1525eb0655ab8487a9a9c41f42a73ba52d6789754788d1883fb06b2d8a"}, @@ -517,6 +520,7 @@ files = [ {file = "contourpy-1.1.0-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:143dde50520a9f90e4a2703f367cf8ec96a73042b72e68fcd184e1279962eb6f"}, {file = "contourpy-1.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e94bef2580e25b5fdb183bf98a2faa2adc5b638736b2c0a4da98691da641316a"}, {file = "contourpy-1.1.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:ed614aea8462735e7d70141374bd7650afd1c3f3cb0c2dbbcbe44e14331bf002"}, + {file = "contourpy-1.1.0-cp39-cp39-win32.whl", hash = "sha256:71551f9520f008b2950bef5f16b0e3587506ef4f23c734b71ffb7b89f8721999"}, {file = "contourpy-1.1.0-cp39-cp39-win_amd64.whl", hash = "sha256:438ba416d02f82b692e371858143970ed2eb6337d9cdbbede0d8ad9f3d7dd17d"}, {file = "contourpy-1.1.0-pp38-pypy38_pp73-macosx_10_9_x86_64.whl", hash = "sha256:a698c6a7a432789e587168573a864a7ea374c6be8d4f31f9d87c001d5a843493"}, {file = "contourpy-1.1.0-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:397b0ac8a12880412da3551a8cb5a187d3298a72802b45a3bd1805e204ad8439"}, @@ -1451,6 +1455,16 @@ files = [ {file = "MarkupSafe-2.1.3-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:5bbe06f8eeafd38e5d0a4894ffec89378b6c6a625ff57e3028921f8ff59318ac"}, {file = "MarkupSafe-2.1.3-cp311-cp311-win32.whl", hash = "sha256:dd15ff04ffd7e05ffcb7fe79f1b98041b8ea30ae9234aed2a9168b5797c3effb"}, {file = "MarkupSafe-2.1.3-cp311-cp311-win_amd64.whl", hash = "sha256:134da1eca9ec0ae528110ccc9e48041e0828d79f24121a1a146161103c76e686"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:f698de3fd0c4e6972b92290a45bd9b1536bffe8c6759c62471efaa8acb4c37bc"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:aa57bd9cf8ae831a362185ee444e15a93ecb2e344c8e52e4d721ea3ab6ef1823"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ffcc3f7c66b5f5b7931a5aa68fc9cecc51e685ef90282f4a82f0f5e9b704ad11"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:47d4f1c5f80fc62fdd7777d0d40a2e9dda0a05883ab11374334f6c4de38adffd"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1f67c7038d560d92149c060157d623c542173016c4babc0c1913cca0564b9939"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:9aad3c1755095ce347e26488214ef77e0485a3c34a50c5a5e2471dff60b9dd9c"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:14ff806850827afd6b07a5f32bd917fb7f45b046ba40c57abdb636674a8b559c"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8f9293864fe09b8149f0cc42ce56e3f0e54de883a9de90cd427f191c346eb2e1"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-win32.whl", hash = "sha256:715d3562f79d540f251b99ebd6d8baa547118974341db04f5ad06d5ea3eb8007"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-win_amd64.whl", hash = "sha256:1b8dd8c3fd14349433c79fa8abeb573a55fc0fdd769133baac1f5e07abf54aeb"}, {file = "MarkupSafe-2.1.3-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:8e254ae696c88d98da6555f5ace2279cf7cd5b3f52be2b5cf97feafe883b58d2"}, {file = "MarkupSafe-2.1.3-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cb0932dc158471523c9637e807d9bfb93e06a95cbf010f1a38b98623b929ef2b"}, {file = "MarkupSafe-2.1.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9402b03f1a1b4dc4c19845e5c749e3ab82d5078d16a2a4c2cd2df62d57bb0707"}, @@ -2463,13 +2477,13 @@ tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} [[package]] name = "pytest" -version = "7.4.0" +version = "7.4.2" description = "pytest: simple powerful testing with Python" optional = false python-versions = ">=3.7" files = [ - {file = "pytest-7.4.0-py3-none-any.whl", hash = "sha256:78bf16451a2eb8c7a2ea98e32dc119fd2aa758f1d5d66dbf0a59d69a3969df32"}, - {file = "pytest-7.4.0.tar.gz", hash = "sha256:b4bf8c45bd59934ed84001ad51e11b4ee40d40a1229d2c79f9c592b0a3f6bd8a"}, + {file = "pytest-7.4.2-py3-none-any.whl", hash = "sha256:1d881c6124e08ff0a1bb75ba3ec0bfd8b5354a01c194ddd5a0a870a48d99b002"}, + {file = "pytest-7.4.2.tar.gz", hash = "sha256:a766259cfab564a2ad52cb1aae1b881a75c3eb7e34ca3779697c23ed47c47069"}, ] [package.dependencies] @@ -2568,6 +2582,7 @@ files = [ {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:69b023b2b4daa7548bcfbd4aa3da05b3a74b772db9e23b982788168117739938"}, {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:81e0b275a9ecc9c0c0c07b4b90ba548307583c125f54d5b6946cfee6360c733d"}, {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ba336e390cd8e4d1739f42dfe9bb83a3cc2e80f567d8805e11b46f4a943f5515"}, + {file = "PyYAML-6.0.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:326c013efe8048858a6d312ddd31d56e468118ad4cdeda36c719bf5bb6192290"}, {file = "PyYAML-6.0.1-cp310-cp310-win32.whl", hash = "sha256:bd4af7373a854424dabd882decdc5579653d7868b8fb26dc7d0e99f823aa5924"}, {file = "PyYAML-6.0.1-cp310-cp310-win_amd64.whl", hash = "sha256:fd1592b3fdf65fff2ad0004b5e363300ef59ced41c2e6b3a99d4089fa8c5435d"}, {file = "PyYAML-6.0.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:6965a7bc3cf88e5a1c3bd2e0b5c22f8d677dc88a455344035f03399034eb3007"}, @@ -2575,8 +2590,15 @@ files = [ {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:42f8152b8dbc4fe7d96729ec2b99c7097d656dc1213a3229ca5383f973a5ed6d"}, {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:062582fca9fabdd2c8b54a3ef1c978d786e0f6b3a1510e0ac93ef59e0ddae2bc"}, {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d2b04aac4d386b172d5b9692e2d2da8de7bfb6c387fa4f801fbf6fb2e6ba4673"}, + {file = "PyYAML-6.0.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:e7d73685e87afe9f3b36c799222440d6cf362062f78be1013661b00c5c6f678b"}, {file = "PyYAML-6.0.1-cp311-cp311-win32.whl", hash = "sha256:1635fd110e8d85d55237ab316b5b011de701ea0f29d07611174a1b42f1444741"}, {file = "PyYAML-6.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:bf07ee2fef7014951eeb99f56f39c9bb4af143d8aa3c21b1677805985307da34"}, + {file = "PyYAML-6.0.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:855fb52b0dc35af121542a76b9a84f8d1cd886ea97c84703eaa6d88e37a2ad28"}, + {file = "PyYAML-6.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:40df9b996c2b73138957fe23a16a4f0ba614f4c0efce1e9406a184b6d07fa3a9"}, + {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c22bec3fbe2524cde73d7ada88f6566758a8f7227bfbf93a408a9d86bcc12a0"}, + {file = "PyYAML-6.0.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8d4e9c88387b0f5c7d5f281e55304de64cf7f9c0021a3525bd3b1c542da3b0e4"}, + {file = "PyYAML-6.0.1-cp312-cp312-win32.whl", hash = "sha256:d483d2cdf104e7c9fa60c544d92981f12ad66a457afae824d146093b8c294c54"}, + {file = "PyYAML-6.0.1-cp312-cp312-win_amd64.whl", hash = "sha256:0d3304d8c0adc42be59c5f8a4d9e3d7379e6955ad754aa9d6ab7a398b59dd1df"}, {file = "PyYAML-6.0.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:50550eb667afee136e9a77d6dc71ae76a44df8b3e51e41b77f6de2932bfe0f47"}, {file = "PyYAML-6.0.1-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1fe35611261b29bd1de0070f0b2f47cb6ff71fa6595c077e42bd0c419fa27b98"}, {file = "PyYAML-6.0.1-cp36-cp36m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:704219a11b772aea0d8ecd7058d0082713c3562b4e271b849ad7dc4a5c90c13c"}, @@ -2593,6 +2615,7 @@ files = [ {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a0cd17c15d3bb3fa06978b4e8958dcdc6e0174ccea823003a106c7d4d7899ac5"}, {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:28c119d996beec18c05208a8bd78cbe4007878c6dd15091efb73a30e90539696"}, {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7e07cbde391ba96ab58e532ff4803f79c4129397514e1413a7dc761ccd755735"}, + {file = "PyYAML-6.0.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:49a183be227561de579b4a36efbb21b3eab9651dd81b1858589f796549873dd6"}, {file = "PyYAML-6.0.1-cp38-cp38-win32.whl", hash = "sha256:184c5108a2aca3c5b3d3bf9395d50893a7ab82a38004c8f61c258d4428e80206"}, {file = "PyYAML-6.0.1-cp38-cp38-win_amd64.whl", hash = "sha256:1e2722cc9fbb45d9b87631ac70924c11d3a401b2d7f410cc0e3bbf249f2dca62"}, {file = "PyYAML-6.0.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:9eb6caa9a297fc2c2fb8862bc5370d0303ddba53ba97e71f08023b6cd73d16a8"}, @@ -2600,6 +2623,7 @@ files = [ {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5773183b6446b2c99bb77e77595dd486303b4faab2b086e7b17bc6bef28865f6"}, {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b786eecbdf8499b9ca1d697215862083bd6d2a99965554781d0d8d1ad31e13a0"}, {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bc1bf2925a1ecd43da378f4db9e4f799775d6367bdb94671027b73b393a7c42c"}, + {file = "PyYAML-6.0.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:04ac92ad1925b2cff1db0cfebffb6ffc43457495c9b3c39d3fcae417d7125dc5"}, {file = "PyYAML-6.0.1-cp39-cp39-win32.whl", hash = "sha256:faca3bdcf85b2fc05d06ff3fbc1f83e1391b3e724afa3feba7d13eeab355484c"}, {file = "PyYAML-6.0.1-cp39-cp39-win_amd64.whl", hash = "sha256:510c9deebc5c0225e8c96813043e62b680ba2f9c50a08d3724c7f28a747d1486"}, {file = "PyYAML-6.0.1.tar.gz", hash = "sha256:bfdf460b1736c775f2ba9f6a92bca30bc2095067b8a9d77876d1fad6cc3b4a43"}, @@ -3274,7 +3298,7 @@ files = [ name = "tqdm" version = "4.66.1" description = "Fast, Extensible Progress Meter" -optional = false +optional = true python-versions = ">=3.7" files = [ {file = "tqdm-4.66.1-py3-none-any.whl", hash = "sha256:d302b3c5b53d47bce91fea46679d9c3c6508cf6332229aa1e7d8653723793386"}, @@ -3511,9 +3535,10 @@ docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.link testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-ignore-flaky", "pytest-mypy (>=0.9.1)", "pytest-ruff"] [extras] +assets = ["requests", "tqdm"] desktop = ["opencv-python"] [metadata] lock-version = "2.0" python-versions = ">=3.8,<3.12.0" -content-hash = "88f2cd2cce563de66fa9ea5b877ff83a971047b33d2860dd9964e463fd4c1433" +content-hash = "13e2a369414eea8d0e840f8ce39365183c142398ba62a4dd149cfa1be87aa031" From b1ceb1debfa4544ed3030538e94b4cdbcd984575 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 24 Oct 2023 13:59:09 +0000 Subject: [PATCH 086/164] :arrow_up: Bump mkdocs-material from 9.1.19 to 9.4.6 Bumps [mkdocs-material](https://github.com/squidfunk/mkdocs-material) from 9.1.19 to 9.4.6. - [Release notes](https://github.com/squidfunk/mkdocs-material/releases) - [Changelog](https://github.com/squidfunk/mkdocs-material/blob/master/CHANGELOG) - [Commits](https://github.com/squidfunk/mkdocs-material/compare/9.1.19...9.4.6) --- updated-dependencies: - dependency-name: mkdocs-material dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- poetry.lock | 138 ++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 107 insertions(+), 31 deletions(-) diff --git a/poetry.lock b/poetry.lock index 95eb8665..2934a3a4 100644 --- a/poetry.lock +++ b/poetry.lock @@ -137,6 +137,23 @@ docs = ["furo", "myst-parser", "sphinx", "sphinx-notfound-page", "sphinxcontrib- tests = ["attrs[tests-no-zope]", "zope-interface"] tests-no-zope = ["cloudpickle", "hypothesis", "mypy (>=1.1.1)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "pytest-xdist[psutil]"] +[[package]] +name = "babel" +version = "2.13.0" +description = "Internationalization utilities" +optional = false +python-versions = ">=3.7" +files = [ + {file = "Babel-2.13.0-py3-none-any.whl", hash = "sha256:fbfcae1575ff78e26c7449136f1abbefc3c13ce542eeb13d43d50d8b047216ec"}, + {file = "Babel-2.13.0.tar.gz", hash = "sha256:04c3e2d28d2b7681644508f836be388ae49e0cfe91465095340395b60d00f210"}, +] + +[package.dependencies] +pytz = {version = ">=2015.7", markers = "python_version < \"3.9\""} + +[package.extras] +dev = ["freezegun (>=1.0,<2.0)", "pytest (>=6.0)", "pytest-cov"] + [[package]] name = "backcall" version = "0.2.0" @@ -493,6 +510,7 @@ files = [ {file = "contourpy-1.1.0-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:18a64814ae7bce73925131381603fff0116e2df25230dfc80d6d690aa6e20b37"}, {file = "contourpy-1.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:90c81f22b4f572f8a2110b0b741bb64e5a6427e0a198b2cdc1fbaf85f352a3aa"}, {file = "contourpy-1.1.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:53cc3a40635abedbec7f1bde60f8c189c49e84ac180c665f2cd7c162cc454baa"}, + {file = "contourpy-1.1.0-cp310-cp310-win32.whl", hash = "sha256:9b2dd2ca3ac561aceef4c7c13ba654aaa404cf885b187427760d7f7d4c57cff8"}, {file = "contourpy-1.1.0-cp310-cp310-win_amd64.whl", hash = "sha256:1f795597073b09d631782e7245016a4323cf1cf0b4e06eef7ea6627e06a37ff2"}, {file = "contourpy-1.1.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:0b7b04ed0961647691cfe5d82115dd072af7ce8846d31a5fac6c142dcce8b882"}, {file = "contourpy-1.1.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:27bc79200c742f9746d7dd51a734ee326a292d77e7d94c8af6e08d1e6c15d545"}, @@ -501,6 +519,7 @@ files = [ {file = "contourpy-1.1.0-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:e5cec36c5090e75a9ac9dbd0ff4a8cf7cecd60f1b6dc23a374c7d980a1cd710e"}, {file = "contourpy-1.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1f0cbd657e9bde94cd0e33aa7df94fb73c1ab7799378d3b3f902eb8eb2e04a3a"}, {file = "contourpy-1.1.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:181cbace49874f4358e2929aaf7ba84006acb76694102e88dd15af861996c16e"}, + {file = "contourpy-1.1.0-cp311-cp311-win32.whl", hash = "sha256:edb989d31065b1acef3828a3688f88b2abb799a7db891c9e282df5ec7e46221b"}, {file = "contourpy-1.1.0-cp311-cp311-win_amd64.whl", hash = "sha256:fb3b7d9e6243bfa1efb93ccfe64ec610d85cfe5aec2c25f97fbbd2e58b531256"}, {file = "contourpy-1.1.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:bcb41692aa09aeb19c7c213411854402f29f6613845ad2453d30bf421fe68fed"}, {file = "contourpy-1.1.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:5d123a5bc63cd34c27ff9c7ac1cd978909e9c71da12e05be0231c608048bb2ae"}, @@ -509,6 +528,7 @@ files = [ {file = "contourpy-1.1.0-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:317267d915490d1e84577924bd61ba71bf8681a30e0d6c545f577363157e5e94"}, {file = "contourpy-1.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d551f3a442655f3dcc1285723f9acd646ca5858834efeab4598d706206b09c9f"}, {file = "contourpy-1.1.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:e7a117ce7df5a938fe035cad481b0189049e8d92433b4b33aa7fc609344aafa1"}, + {file = "contourpy-1.1.0-cp38-cp38-win32.whl", hash = "sha256:108dfb5b3e731046a96c60bdc46a1a0ebee0760418951abecbe0fc07b5b93b27"}, {file = "contourpy-1.1.0-cp38-cp38-win_amd64.whl", hash = "sha256:d4f26b25b4f86087e7d75e63212756c38546e70f2a92d2be44f80114826e1cd4"}, {file = "contourpy-1.1.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:bc00bb4225d57bff7ebb634646c0ee2a1298402ec10a5fe7af79df9a51c1bfd9"}, {file = "contourpy-1.1.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:189ceb1525eb0655ab8487a9a9c41f42a73ba52d6789754788d1883fb06b2d8a"}, @@ -517,6 +537,7 @@ files = [ {file = "contourpy-1.1.0-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:143dde50520a9f90e4a2703f367cf8ec96a73042b72e68fcd184e1279962eb6f"}, {file = "contourpy-1.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e94bef2580e25b5fdb183bf98a2faa2adc5b638736b2c0a4da98691da641316a"}, {file = "contourpy-1.1.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:ed614aea8462735e7d70141374bd7650afd1c3f3cb0c2dbbcbe44e14331bf002"}, + {file = "contourpy-1.1.0-cp39-cp39-win32.whl", hash = "sha256:71551f9520f008b2950bef5f16b0e3587506ef4f23c734b71ffb7b89f8721999"}, {file = "contourpy-1.1.0-cp39-cp39-win_amd64.whl", hash = "sha256:438ba416d02f82b692e371858143970ed2eb6337d9cdbbede0d8ad9f3d7dd17d"}, {file = "contourpy-1.1.0-pp38-pypy38_pp73-macosx_10_9_x86_64.whl", hash = "sha256:a698c6a7a432789e587168573a864a7ea374c6be8d4f31f9d87c001d5a843493"}, {file = "contourpy-1.1.0-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:397b0ac8a12880412da3551a8cb5a187d3298a72802b45a3bd1805e204ad8439"}, @@ -1451,6 +1472,16 @@ files = [ {file = "MarkupSafe-2.1.3-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:5bbe06f8eeafd38e5d0a4894ffec89378b6c6a625ff57e3028921f8ff59318ac"}, {file = "MarkupSafe-2.1.3-cp311-cp311-win32.whl", hash = "sha256:dd15ff04ffd7e05ffcb7fe79f1b98041b8ea30ae9234aed2a9168b5797c3effb"}, {file = "MarkupSafe-2.1.3-cp311-cp311-win_amd64.whl", hash = "sha256:134da1eca9ec0ae528110ccc9e48041e0828d79f24121a1a146161103c76e686"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:f698de3fd0c4e6972b92290a45bd9b1536bffe8c6759c62471efaa8acb4c37bc"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:aa57bd9cf8ae831a362185ee444e15a93ecb2e344c8e52e4d721ea3ab6ef1823"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ffcc3f7c66b5f5b7931a5aa68fc9cecc51e685ef90282f4a82f0f5e9b704ad11"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:47d4f1c5f80fc62fdd7777d0d40a2e9dda0a05883ab11374334f6c4de38adffd"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1f67c7038d560d92149c060157d623c542173016c4babc0c1913cca0564b9939"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:9aad3c1755095ce347e26488214ef77e0485a3c34a50c5a5e2471dff60b9dd9c"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:14ff806850827afd6b07a5f32bd917fb7f45b046ba40c57abdb636674a8b559c"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8f9293864fe09b8149f0cc42ce56e3f0e54de883a9de90cd427f191c346eb2e1"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-win32.whl", hash = "sha256:715d3562f79d540f251b99ebd6d8baa547118974341db04f5ad06d5ea3eb8007"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-win_amd64.whl", hash = "sha256:1b8dd8c3fd14349433c79fa8abeb573a55fc0fdd769133baac1f5e07abf54aeb"}, {file = "MarkupSafe-2.1.3-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:8e254ae696c88d98da6555f5ace2279cf7cd5b3f52be2b5cf97feafe883b58d2"}, {file = "MarkupSafe-2.1.3-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cb0932dc158471523c9637e807d9bfb93e06a95cbf010f1a38b98623b929ef2b"}, {file = "MarkupSafe-2.1.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9402b03f1a1b4dc4c19845e5c749e3ab82d5078d16a2a4c2cd2df62d57bb0707"}, @@ -1605,13 +1636,13 @@ files = [ [[package]] name = "mkdocs" -version = "1.4.3" +version = "1.5.3" description = "Project documentation with Markdown." optional = false python-versions = ">=3.7" files = [ - {file = "mkdocs-1.4.3-py3-none-any.whl", hash = "sha256:6ee46d309bda331aac915cd24aab882c179a933bd9e77b80ce7d2eaaa3f689dd"}, - {file = "mkdocs-1.4.3.tar.gz", hash = "sha256:5955093bbd4dd2e9403c5afaf57324ad8b04f16886512a3ee6ef828956481c57"}, + {file = "mkdocs-1.5.3-py3-none-any.whl", hash = "sha256:3b3a78e736b31158d64dbb2f8ba29bd46a379d0c6e324c2246c3bc3d2189cfc1"}, + {file = "mkdocs-1.5.3.tar.gz", hash = "sha256:eb7c99214dcb945313ba30426c2451b735992c73c2e10838f76d09e39ff4d0e2"}, ] [package.dependencies] @@ -1620,16 +1651,19 @@ colorama = {version = ">=0.4", markers = "platform_system == \"Windows\""} ghp-import = ">=1.0" importlib-metadata = {version = ">=4.3", markers = "python_version < \"3.10\""} jinja2 = ">=2.11.1" -markdown = ">=3.2.1,<3.4" +markdown = ">=3.2.1" +markupsafe = ">=2.0.1" mergedeep = ">=1.3.4" packaging = ">=20.5" +pathspec = ">=0.11.1" +platformdirs = ">=2.2.0" pyyaml = ">=5.1" pyyaml-env-tag = ">=0.1" watchdog = ">=2.0" [package.extras] i18n = ["babel (>=2.9.0)"] -min-versions = ["babel (==2.9.0)", "click (==7.0)", "colorama (==0.4)", "ghp-import (==1.0)", "importlib-metadata (==4.3)", "jinja2 (==2.11.1)", "markdown (==3.2.1)", "markupsafe (==2.0.1)", "mergedeep (==1.3.4)", "packaging (==20.5)", "pyyaml (==5.1)", "pyyaml-env-tag (==0.1)", "typing-extensions (==3.10)", "watchdog (==2.0)"] +min-versions = ["babel (==2.9.0)", "click (==7.0)", "colorama (==0.4)", "ghp-import (==1.0)", "importlib-metadata (==4.3)", "jinja2 (==2.11.1)", "markdown (==3.2.1)", "markupsafe (==2.0.1)", "mergedeep (==1.3.4)", "packaging (==20.5)", "pathspec (==0.11.1)", "platformdirs (==2.2.0)", "pyyaml (==5.1)", "pyyaml-env-tag (==0.1)", "typing-extensions (==3.10)", "watchdog (==2.0)"] [[package]] name = "mkdocs-autorefs" @@ -1648,35 +1682,42 @@ mkdocs = ">=1.1" [[package]] name = "mkdocs-material" -version = "9.1.19" +version = "9.4.6" description = "Documentation that simply works" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "mkdocs_material-9.1.19-py3-none-any.whl", hash = "sha256:fb0a149294b319aedf36983919d8c40c9e566db21ead16258e20ebd2e6c0961c"}, - {file = "mkdocs_material-9.1.19.tar.gz", hash = "sha256:73b94b08c765e92a80645aac58d6a741fc5f587deec2b715489c714827b15a6f"}, + {file = "mkdocs_material-9.4.6-py3-none-any.whl", hash = "sha256:78802035d5768a78139c84ad7dce0c6493e8f7dc4861727d36ed91d1520a54da"}, + {file = "mkdocs_material-9.4.6.tar.gz", hash = "sha256:09665e60df7ee9e5ff3a54af173f6d45be718b1ee7dd962bcff3102b81fb0c14"}, ] [package.dependencies] -colorama = ">=0.4" -jinja2 = ">=3.0" -markdown = ">=3.2" -mkdocs = ">=1.4.2" -mkdocs-material-extensions = ">=1.1" -pygments = ">=2.14" -pymdown-extensions = ">=9.9.1" -regex = ">=2022.4.24" -requests = ">=2.26" +babel = ">=2.10,<3.0" +colorama = ">=0.4,<1.0" +jinja2 = ">=3.0,<4.0" +markdown = ">=3.2,<4.0" +mkdocs = ">=1.5.3,<2.0" +mkdocs-material-extensions = ">=1.2,<2.0" +paginate = ">=0.5,<1.0" +pygments = ">=2.16,<3.0" +pymdown-extensions = ">=10.2,<11.0" +regex = ">=2022.4" +requests = ">=2.26,<3.0" + +[package.extras] +git = ["mkdocs-git-committers-plugin-2 (>=1.1,<2.0)", "mkdocs-git-revision-date-localized-plugin (>=1.2,<2.0)"] +imaging = ["cairosvg (>=2.6,<3.0)", "pillow (>=9.4,<10.0)"] +recommended = ["mkdocs-minify-plugin (>=0.7,<1.0)", "mkdocs-redirects (>=1.2,<2.0)", "mkdocs-rss-plugin (>=1.6,<2.0)"] [[package]] name = "mkdocs-material-extensions" -version = "1.1.1" +version = "1.3" description = "Extension pack for Python Markdown and MkDocs Material." optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "mkdocs_material_extensions-1.1.1-py3-none-any.whl", hash = "sha256:e41d9f38e4798b6617ad98ca8f7f1157b1e4385ac1459ca1e4ea219b556df945"}, - {file = "mkdocs_material_extensions-1.1.1.tar.gz", hash = "sha256:9c003da71e2cc2493d910237448c672e00cefc800d3d6ae93d2fc69979e3bd93"}, + {file = "mkdocs_material_extensions-1.3-py3-none-any.whl", hash = "sha256:0297cc48ba68a9fdd1ef3780a3b41b534b0d0df1d1181a44676fda5f464eeadc"}, + {file = "mkdocs_material_extensions-1.3.tar.gz", hash = "sha256:f0446091503acb110a7cab9349cbc90eeac51b58d1caa92a704a81ca1e24ddbd"}, ] [[package]] @@ -2090,6 +2131,16 @@ files = [ {file = "packaging-23.1.tar.gz", hash = "sha256:a392980d2b6cffa644431898be54b0045151319d1e7ec34f0cfed48767dd334f"}, ] +[[package]] +name = "paginate" +version = "0.5.6" +description = "Divides large result sets into pages for easier browsing" +optional = false +python-versions = "*" +files = [ + {file = "paginate-0.5.6.tar.gz", hash = "sha256:5e6007b6a9398177a7e1648d04fdd9f8c9766a1a945bceac82f1929e8c78af2d"}, +] + [[package]] name = "pandocfilters" version = "1.5.0" @@ -2406,13 +2457,13 @@ files = [ [[package]] name = "pygments" -version = "2.15.1" +version = "2.16.1" description = "Pygments is a syntax highlighting package written in Python." optional = false python-versions = ">=3.7" files = [ - {file = "Pygments-2.15.1-py3-none-any.whl", hash = "sha256:db2db3deb4b4179f399a09054b023b6a586b76499d36965813c71aa8ed7b5fd1"}, - {file = "Pygments-2.15.1.tar.gz", hash = "sha256:8ace4d3c1dd481894b2005f560ead0f9f19ee64fe983366be1a21e171d12775c"}, + {file = "Pygments-2.16.1-py3-none-any.whl", hash = "sha256:13fc09fa63bc8d8671a6d247e1eb303c4b343eaee81d861f3404db2935653692"}, + {file = "Pygments-2.16.1.tar.gz", hash = "sha256:1daff0494820c69bc8941e407aa20f577374ee88364ee10a98fdbe0aece96e29"}, ] [package.extras] @@ -2420,19 +2471,22 @@ plugins = ["importlib-metadata"] [[package]] name = "pymdown-extensions" -version = "10.1" +version = "10.3.1" description = "Extension pack for Python Markdown." optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "pymdown_extensions-10.1-py3-none-any.whl", hash = "sha256:ef25dbbae530e8f67575d222b75ff0649b1e841e22c2ae9a20bad9472c2207dc"}, - {file = "pymdown_extensions-10.1.tar.gz", hash = "sha256:508009b211373058debb8247e168de4cbcb91b1bff7b5e961b2c3e864e00b195"}, + {file = "pymdown_extensions-10.3.1-py3-none-any.whl", hash = "sha256:8cba67beb2a1318cdaf742d09dff7c0fc4cafcc290147ade0f8fb7b71522711a"}, + {file = "pymdown_extensions-10.3.1.tar.gz", hash = "sha256:f6c79941498a458852853872e379e7bab63888361ba20992fc8b4f8a9b61735e"}, ] [package.dependencies] markdown = ">=3.2" pyyaml = "*" +[package.extras] +extra = ["pygments (>=2.12)"] + [[package]] name = "pyparsing" version = "3.0.9" @@ -2508,6 +2562,17 @@ files = [ {file = "python_json_logger-2.0.7-py3-none-any.whl", hash = "sha256:f380b826a991ebbe3de4d897aeec42760035ac760345e57b812938dc8b35e2bd"}, ] +[[package]] +name = "pytz" +version = "2023.3.post1" +description = "World timezone definitions, modern and historical" +optional = false +python-versions = "*" +files = [ + {file = "pytz-2023.3.post1-py2.py3-none-any.whl", hash = "sha256:ce42d816b81b68506614c11e8937d3aa9e41007ceb50bfdcb0749b921bf646c7"}, + {file = "pytz-2023.3.post1.tar.gz", hash = "sha256:7b4fddbeb94a1eba4b557da24f19fdf9db575192544270a9101d8509f9f43d7b"}, +] + [[package]] name = "pywin32" version = "306" @@ -2568,6 +2633,7 @@ files = [ {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:69b023b2b4daa7548bcfbd4aa3da05b3a74b772db9e23b982788168117739938"}, {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:81e0b275a9ecc9c0c0c07b4b90ba548307583c125f54d5b6946cfee6360c733d"}, {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ba336e390cd8e4d1739f42dfe9bb83a3cc2e80f567d8805e11b46f4a943f5515"}, + {file = "PyYAML-6.0.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:326c013efe8048858a6d312ddd31d56e468118ad4cdeda36c719bf5bb6192290"}, {file = "PyYAML-6.0.1-cp310-cp310-win32.whl", hash = "sha256:bd4af7373a854424dabd882decdc5579653d7868b8fb26dc7d0e99f823aa5924"}, {file = "PyYAML-6.0.1-cp310-cp310-win_amd64.whl", hash = "sha256:fd1592b3fdf65fff2ad0004b5e363300ef59ced41c2e6b3a99d4089fa8c5435d"}, {file = "PyYAML-6.0.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:6965a7bc3cf88e5a1c3bd2e0b5c22f8d677dc88a455344035f03399034eb3007"}, @@ -2575,8 +2641,15 @@ files = [ {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:42f8152b8dbc4fe7d96729ec2b99c7097d656dc1213a3229ca5383f973a5ed6d"}, {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:062582fca9fabdd2c8b54a3ef1c978d786e0f6b3a1510e0ac93ef59e0ddae2bc"}, {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d2b04aac4d386b172d5b9692e2d2da8de7bfb6c387fa4f801fbf6fb2e6ba4673"}, + {file = "PyYAML-6.0.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:e7d73685e87afe9f3b36c799222440d6cf362062f78be1013661b00c5c6f678b"}, {file = "PyYAML-6.0.1-cp311-cp311-win32.whl", hash = "sha256:1635fd110e8d85d55237ab316b5b011de701ea0f29d07611174a1b42f1444741"}, {file = "PyYAML-6.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:bf07ee2fef7014951eeb99f56f39c9bb4af143d8aa3c21b1677805985307da34"}, + {file = "PyYAML-6.0.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:855fb52b0dc35af121542a76b9a84f8d1cd886ea97c84703eaa6d88e37a2ad28"}, + {file = "PyYAML-6.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:40df9b996c2b73138957fe23a16a4f0ba614f4c0efce1e9406a184b6d07fa3a9"}, + {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c22bec3fbe2524cde73d7ada88f6566758a8f7227bfbf93a408a9d86bcc12a0"}, + {file = "PyYAML-6.0.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8d4e9c88387b0f5c7d5f281e55304de64cf7f9c0021a3525bd3b1c542da3b0e4"}, + {file = "PyYAML-6.0.1-cp312-cp312-win32.whl", hash = "sha256:d483d2cdf104e7c9fa60c544d92981f12ad66a457afae824d146093b8c294c54"}, + {file = "PyYAML-6.0.1-cp312-cp312-win_amd64.whl", hash = "sha256:0d3304d8c0adc42be59c5f8a4d9e3d7379e6955ad754aa9d6ab7a398b59dd1df"}, {file = "PyYAML-6.0.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:50550eb667afee136e9a77d6dc71ae76a44df8b3e51e41b77f6de2932bfe0f47"}, {file = "PyYAML-6.0.1-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1fe35611261b29bd1de0070f0b2f47cb6ff71fa6595c077e42bd0c419fa27b98"}, {file = "PyYAML-6.0.1-cp36-cp36m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:704219a11b772aea0d8ecd7058d0082713c3562b4e271b849ad7dc4a5c90c13c"}, @@ -2593,6 +2666,7 @@ files = [ {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a0cd17c15d3bb3fa06978b4e8958dcdc6e0174ccea823003a106c7d4d7899ac5"}, {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:28c119d996beec18c05208a8bd78cbe4007878c6dd15091efb73a30e90539696"}, {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7e07cbde391ba96ab58e532ff4803f79c4129397514e1413a7dc761ccd755735"}, + {file = "PyYAML-6.0.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:49a183be227561de579b4a36efbb21b3eab9651dd81b1858589f796549873dd6"}, {file = "PyYAML-6.0.1-cp38-cp38-win32.whl", hash = "sha256:184c5108a2aca3c5b3d3bf9395d50893a7ab82a38004c8f61c258d4428e80206"}, {file = "PyYAML-6.0.1-cp38-cp38-win_amd64.whl", hash = "sha256:1e2722cc9fbb45d9b87631ac70924c11d3a401b2d7f410cc0e3bbf249f2dca62"}, {file = "PyYAML-6.0.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:9eb6caa9a297fc2c2fb8862bc5370d0303ddba53ba97e71f08023b6cd73d16a8"}, @@ -2600,6 +2674,7 @@ files = [ {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5773183b6446b2c99bb77e77595dd486303b4faab2b086e7b17bc6bef28865f6"}, {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b786eecbdf8499b9ca1d697215862083bd6d2a99965554781d0d8d1ad31e13a0"}, {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bc1bf2925a1ecd43da378f4db9e4f799775d6367bdb94671027b73b393a7c42c"}, + {file = "PyYAML-6.0.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:04ac92ad1925b2cff1db0cfebffb6ffc43457495c9b3c39d3fcae417d7125dc5"}, {file = "PyYAML-6.0.1-cp39-cp39-win32.whl", hash = "sha256:faca3bdcf85b2fc05d06ff3fbc1f83e1391b3e724afa3feba7d13eeab355484c"}, {file = "PyYAML-6.0.1-cp39-cp39-win_amd64.whl", hash = "sha256:510c9deebc5c0225e8c96813043e62b680ba2f9c50a08d3724c7f28a747d1486"}, {file = "PyYAML-6.0.1.tar.gz", hash = "sha256:bfdf460b1736c775f2ba9f6a92bca30bc2095067b8a9d77876d1fad6cc3b4a43"}, @@ -3274,7 +3349,7 @@ files = [ name = "tqdm" version = "4.66.1" description = "Fast, Extensible Progress Meter" -optional = false +optional = true python-versions = ">=3.7" files = [ {file = "tqdm-4.66.1-py3-none-any.whl", hash = "sha256:d302b3c5b53d47bce91fea46679d9c3c6508cf6332229aa1e7d8653723793386"}, @@ -3511,9 +3586,10 @@ docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.link testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-ignore-flaky", "pytest-mypy (>=0.9.1)", "pytest-ruff"] [extras] +assets = ["requests", "tqdm"] desktop = ["opencv-python"] [metadata] lock-version = "2.0" python-versions = ">=3.8,<3.12.0" -content-hash = "88f2cd2cce563de66fa9ea5b877ff83a971047b33d2860dd9964e463fd4c1433" +content-hash = "13e2a369414eea8d0e840f8ce39365183c142398ba62a4dd149cfa1be87aa031" From e61f1718a0bb023a895635061515cfd1d458f3fa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 24 Oct 2023 14:00:32 +0000 Subject: [PATCH 087/164] :arrow_up: Bump opencv-python from 4.8.0.74 to 4.8.1.78 Bumps [opencv-python](https://github.com/opencv/opencv-python) from 4.8.0.74 to 4.8.1.78. - [Release notes](https://github.com/opencv/opencv-python/releases) - [Commits](https://github.com/opencv/opencv-python/commits) --- updated-dependencies: - dependency-name: opencv-python dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- poetry.lock | 45 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/poetry.lock b/poetry.lock index 95eb8665..aa7fbe28 100644 --- a/poetry.lock +++ b/poetry.lock @@ -493,6 +493,7 @@ files = [ {file = "contourpy-1.1.0-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:18a64814ae7bce73925131381603fff0116e2df25230dfc80d6d690aa6e20b37"}, {file = "contourpy-1.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:90c81f22b4f572f8a2110b0b741bb64e5a6427e0a198b2cdc1fbaf85f352a3aa"}, {file = "contourpy-1.1.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:53cc3a40635abedbec7f1bde60f8c189c49e84ac180c665f2cd7c162cc454baa"}, + {file = "contourpy-1.1.0-cp310-cp310-win32.whl", hash = "sha256:9b2dd2ca3ac561aceef4c7c13ba654aaa404cf885b187427760d7f7d4c57cff8"}, {file = "contourpy-1.1.0-cp310-cp310-win_amd64.whl", hash = "sha256:1f795597073b09d631782e7245016a4323cf1cf0b4e06eef7ea6627e06a37ff2"}, {file = "contourpy-1.1.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:0b7b04ed0961647691cfe5d82115dd072af7ce8846d31a5fac6c142dcce8b882"}, {file = "contourpy-1.1.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:27bc79200c742f9746d7dd51a734ee326a292d77e7d94c8af6e08d1e6c15d545"}, @@ -501,6 +502,7 @@ files = [ {file = "contourpy-1.1.0-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:e5cec36c5090e75a9ac9dbd0ff4a8cf7cecd60f1b6dc23a374c7d980a1cd710e"}, {file = "contourpy-1.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1f0cbd657e9bde94cd0e33aa7df94fb73c1ab7799378d3b3f902eb8eb2e04a3a"}, {file = "contourpy-1.1.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:181cbace49874f4358e2929aaf7ba84006acb76694102e88dd15af861996c16e"}, + {file = "contourpy-1.1.0-cp311-cp311-win32.whl", hash = "sha256:edb989d31065b1acef3828a3688f88b2abb799a7db891c9e282df5ec7e46221b"}, {file = "contourpy-1.1.0-cp311-cp311-win_amd64.whl", hash = "sha256:fb3b7d9e6243bfa1efb93ccfe64ec610d85cfe5aec2c25f97fbbd2e58b531256"}, {file = "contourpy-1.1.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:bcb41692aa09aeb19c7c213411854402f29f6613845ad2453d30bf421fe68fed"}, {file = "contourpy-1.1.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:5d123a5bc63cd34c27ff9c7ac1cd978909e9c71da12e05be0231c608048bb2ae"}, @@ -509,6 +511,7 @@ files = [ {file = "contourpy-1.1.0-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:317267d915490d1e84577924bd61ba71bf8681a30e0d6c545f577363157e5e94"}, {file = "contourpy-1.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d551f3a442655f3dcc1285723f9acd646ca5858834efeab4598d706206b09c9f"}, {file = "contourpy-1.1.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:e7a117ce7df5a938fe035cad481b0189049e8d92433b4b33aa7fc609344aafa1"}, + {file = "contourpy-1.1.0-cp38-cp38-win32.whl", hash = "sha256:108dfb5b3e731046a96c60bdc46a1a0ebee0760418951abecbe0fc07b5b93b27"}, {file = "contourpy-1.1.0-cp38-cp38-win_amd64.whl", hash = "sha256:d4f26b25b4f86087e7d75e63212756c38546e70f2a92d2be44f80114826e1cd4"}, {file = "contourpy-1.1.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:bc00bb4225d57bff7ebb634646c0ee2a1298402ec10a5fe7af79df9a51c1bfd9"}, {file = "contourpy-1.1.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:189ceb1525eb0655ab8487a9a9c41f42a73ba52d6789754788d1883fb06b2d8a"}, @@ -517,6 +520,7 @@ files = [ {file = "contourpy-1.1.0-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:143dde50520a9f90e4a2703f367cf8ec96a73042b72e68fcd184e1279962eb6f"}, {file = "contourpy-1.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e94bef2580e25b5fdb183bf98a2faa2adc5b638736b2c0a4da98691da641316a"}, {file = "contourpy-1.1.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:ed614aea8462735e7d70141374bd7650afd1c3f3cb0c2dbbcbe44e14331bf002"}, + {file = "contourpy-1.1.0-cp39-cp39-win32.whl", hash = "sha256:71551f9520f008b2950bef5f16b0e3587506ef4f23c734b71ffb7b89f8721999"}, {file = "contourpy-1.1.0-cp39-cp39-win_amd64.whl", hash = "sha256:438ba416d02f82b692e371858143970ed2eb6337d9cdbbede0d8ad9f3d7dd17d"}, {file = "contourpy-1.1.0-pp38-pypy38_pp73-macosx_10_9_x86_64.whl", hash = "sha256:a698c6a7a432789e587168573a864a7ea374c6be8d4f31f9d87c001d5a843493"}, {file = "contourpy-1.1.0-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:397b0ac8a12880412da3551a8cb5a187d3298a72802b45a3bd1805e204ad8439"}, @@ -1451,6 +1455,16 @@ files = [ {file = "MarkupSafe-2.1.3-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:5bbe06f8eeafd38e5d0a4894ffec89378b6c6a625ff57e3028921f8ff59318ac"}, {file = "MarkupSafe-2.1.3-cp311-cp311-win32.whl", hash = "sha256:dd15ff04ffd7e05ffcb7fe79f1b98041b8ea30ae9234aed2a9168b5797c3effb"}, {file = "MarkupSafe-2.1.3-cp311-cp311-win_amd64.whl", hash = "sha256:134da1eca9ec0ae528110ccc9e48041e0828d79f24121a1a146161103c76e686"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:f698de3fd0c4e6972b92290a45bd9b1536bffe8c6759c62471efaa8acb4c37bc"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:aa57bd9cf8ae831a362185ee444e15a93ecb2e344c8e52e4d721ea3ab6ef1823"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ffcc3f7c66b5f5b7931a5aa68fc9cecc51e685ef90282f4a82f0f5e9b704ad11"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:47d4f1c5f80fc62fdd7777d0d40a2e9dda0a05883ab11374334f6c4de38adffd"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1f67c7038d560d92149c060157d623c542173016c4babc0c1913cca0564b9939"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:9aad3c1755095ce347e26488214ef77e0485a3c34a50c5a5e2471dff60b9dd9c"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:14ff806850827afd6b07a5f32bd917fb7f45b046ba40c57abdb636674a8b559c"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8f9293864fe09b8149f0cc42ce56e3f0e54de883a9de90cd427f191c346eb2e1"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-win32.whl", hash = "sha256:715d3562f79d540f251b99ebd6d8baa547118974341db04f5ad06d5ea3eb8007"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-win_amd64.whl", hash = "sha256:1b8dd8c3fd14349433c79fa8abeb573a55fc0fdd769133baac1f5e07abf54aeb"}, {file = "MarkupSafe-2.1.3-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:8e254ae696c88d98da6555f5ace2279cf7cd5b3f52be2b5cf97feafe883b58d2"}, {file = "MarkupSafe-2.1.3-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cb0932dc158471523c9637e807d9bfb93e06a95cbf010f1a38b98623b929ef2b"}, {file = "MarkupSafe-2.1.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9402b03f1a1b4dc4c19845e5c749e3ab82d5078d16a2a4c2cd2df62d57bb0707"}, @@ -2018,18 +2032,18 @@ files = [ [[package]] name = "opencv-python" -version = "4.8.0.74" +version = "4.8.1.78" description = "Wrapper package for OpenCV python bindings." optional = true python-versions = ">=3.6" files = [ - {file = "opencv-python-4.8.0.74.tar.gz", hash = "sha256:009e3ce356a0cd2d7423723e00a32fd3d3cc5bb5970ed27a9a1f8a8f221d1db5"}, - {file = "opencv_python-4.8.0.74-cp37-abi3-macosx_10_16_x86_64.whl", hash = "sha256:31d0d59fc8fdf703de4cec46c79b9f8d026fdde9d23d6e2e6a66809feeebbda9"}, - {file = "opencv_python-4.8.0.74-cp37-abi3-macosx_11_0_arm64.whl", hash = "sha256:66eadb5882ee56848b67f9fb57aadcaca2f4c9d9d00a0ef11043041925b51291"}, - {file = "opencv_python-4.8.0.74-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:038ba7075e55cb8e2846663ae970f0fb776a45b48ee69a887bf4ee15e2570083"}, - {file = "opencv_python-4.8.0.74-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:43dd0dfe331fb95767af581bf3b2781d7a72cf6560ddf2f55949fe547f3e5c9f"}, - {file = "opencv_python-4.8.0.74-cp37-abi3-win32.whl", hash = "sha256:458e5dc377f15fcf769d80314f3d885bd95457b1a2891bee67df2eb24a1d3a52"}, - {file = "opencv_python-4.8.0.74-cp37-abi3-win_amd64.whl", hash = "sha256:8fe0018d0056a5187c57120b6b3f6c3e706c13b45c48e54e86d245a9a16fac84"}, + {file = "opencv-python-4.8.1.78.tar.gz", hash = "sha256:cc7adbbcd1112877a39274106cb2752e04984bc01a031162952e97450d6117f6"}, + {file = "opencv_python-4.8.1.78-cp37-abi3-macosx_10_16_x86_64.whl", hash = "sha256:91d5f6f5209dc2635d496f6b8ca6573ecdad051a09e6b5de4c399b8e673c60da"}, + {file = "opencv_python-4.8.1.78-cp37-abi3-macosx_11_0_arm64.whl", hash = "sha256:bc31f47e05447da8b3089faa0a07ffe80e114c91ce0b171e6424f9badbd1c5cd"}, + {file = "opencv_python-4.8.1.78-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9814beca408d3a0eca1bae7e3e5be68b07c17ecceb392b94170881216e09b319"}, + {file = "opencv_python-4.8.1.78-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c4c406bdb41eb21ea51b4e90dfbc989c002786c3f601c236a99c59a54670a394"}, + {file = "opencv_python-4.8.1.78-cp37-abi3-win32.whl", hash = "sha256:a7aac3900fbacf55b551e7b53626c3dad4c71ce85643645c43e91fcb19045e47"}, + {file = "opencv_python-4.8.1.78-cp37-abi3-win_amd64.whl", hash = "sha256:b983197f97cfa6fcb74e1da1802c7497a6f94ed561aba6980f1f33123f904956"}, ] [package.dependencies] @@ -2568,6 +2582,7 @@ files = [ {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:69b023b2b4daa7548bcfbd4aa3da05b3a74b772db9e23b982788168117739938"}, {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:81e0b275a9ecc9c0c0c07b4b90ba548307583c125f54d5b6946cfee6360c733d"}, {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ba336e390cd8e4d1739f42dfe9bb83a3cc2e80f567d8805e11b46f4a943f5515"}, + {file = "PyYAML-6.0.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:326c013efe8048858a6d312ddd31d56e468118ad4cdeda36c719bf5bb6192290"}, {file = "PyYAML-6.0.1-cp310-cp310-win32.whl", hash = "sha256:bd4af7373a854424dabd882decdc5579653d7868b8fb26dc7d0e99f823aa5924"}, {file = "PyYAML-6.0.1-cp310-cp310-win_amd64.whl", hash = "sha256:fd1592b3fdf65fff2ad0004b5e363300ef59ced41c2e6b3a99d4089fa8c5435d"}, {file = "PyYAML-6.0.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:6965a7bc3cf88e5a1c3bd2e0b5c22f8d677dc88a455344035f03399034eb3007"}, @@ -2575,8 +2590,15 @@ files = [ {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:42f8152b8dbc4fe7d96729ec2b99c7097d656dc1213a3229ca5383f973a5ed6d"}, {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:062582fca9fabdd2c8b54a3ef1c978d786e0f6b3a1510e0ac93ef59e0ddae2bc"}, {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d2b04aac4d386b172d5b9692e2d2da8de7bfb6c387fa4f801fbf6fb2e6ba4673"}, + {file = "PyYAML-6.0.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:e7d73685e87afe9f3b36c799222440d6cf362062f78be1013661b00c5c6f678b"}, {file = "PyYAML-6.0.1-cp311-cp311-win32.whl", hash = "sha256:1635fd110e8d85d55237ab316b5b011de701ea0f29d07611174a1b42f1444741"}, {file = "PyYAML-6.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:bf07ee2fef7014951eeb99f56f39c9bb4af143d8aa3c21b1677805985307da34"}, + {file = "PyYAML-6.0.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:855fb52b0dc35af121542a76b9a84f8d1cd886ea97c84703eaa6d88e37a2ad28"}, + {file = "PyYAML-6.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:40df9b996c2b73138957fe23a16a4f0ba614f4c0efce1e9406a184b6d07fa3a9"}, + {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c22bec3fbe2524cde73d7ada88f6566758a8f7227bfbf93a408a9d86bcc12a0"}, + {file = "PyYAML-6.0.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8d4e9c88387b0f5c7d5f281e55304de64cf7f9c0021a3525bd3b1c542da3b0e4"}, + {file = "PyYAML-6.0.1-cp312-cp312-win32.whl", hash = "sha256:d483d2cdf104e7c9fa60c544d92981f12ad66a457afae824d146093b8c294c54"}, + {file = "PyYAML-6.0.1-cp312-cp312-win_amd64.whl", hash = "sha256:0d3304d8c0adc42be59c5f8a4d9e3d7379e6955ad754aa9d6ab7a398b59dd1df"}, {file = "PyYAML-6.0.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:50550eb667afee136e9a77d6dc71ae76a44df8b3e51e41b77f6de2932bfe0f47"}, {file = "PyYAML-6.0.1-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1fe35611261b29bd1de0070f0b2f47cb6ff71fa6595c077e42bd0c419fa27b98"}, {file = "PyYAML-6.0.1-cp36-cp36m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:704219a11b772aea0d8ecd7058d0082713c3562b4e271b849ad7dc4a5c90c13c"}, @@ -2593,6 +2615,7 @@ files = [ {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a0cd17c15d3bb3fa06978b4e8958dcdc6e0174ccea823003a106c7d4d7899ac5"}, {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:28c119d996beec18c05208a8bd78cbe4007878c6dd15091efb73a30e90539696"}, {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7e07cbde391ba96ab58e532ff4803f79c4129397514e1413a7dc761ccd755735"}, + {file = "PyYAML-6.0.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:49a183be227561de579b4a36efbb21b3eab9651dd81b1858589f796549873dd6"}, {file = "PyYAML-6.0.1-cp38-cp38-win32.whl", hash = "sha256:184c5108a2aca3c5b3d3bf9395d50893a7ab82a38004c8f61c258d4428e80206"}, {file = "PyYAML-6.0.1-cp38-cp38-win_amd64.whl", hash = "sha256:1e2722cc9fbb45d9b87631ac70924c11d3a401b2d7f410cc0e3bbf249f2dca62"}, {file = "PyYAML-6.0.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:9eb6caa9a297fc2c2fb8862bc5370d0303ddba53ba97e71f08023b6cd73d16a8"}, @@ -2600,6 +2623,7 @@ files = [ {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5773183b6446b2c99bb77e77595dd486303b4faab2b086e7b17bc6bef28865f6"}, {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b786eecbdf8499b9ca1d697215862083bd6d2a99965554781d0d8d1ad31e13a0"}, {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bc1bf2925a1ecd43da378f4db9e4f799775d6367bdb94671027b73b393a7c42c"}, + {file = "PyYAML-6.0.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:04ac92ad1925b2cff1db0cfebffb6ffc43457495c9b3c39d3fcae417d7125dc5"}, {file = "PyYAML-6.0.1-cp39-cp39-win32.whl", hash = "sha256:faca3bdcf85b2fc05d06ff3fbc1f83e1391b3e724afa3feba7d13eeab355484c"}, {file = "PyYAML-6.0.1-cp39-cp39-win_amd64.whl", hash = "sha256:510c9deebc5c0225e8c96813043e62b680ba2f9c50a08d3724c7f28a747d1486"}, {file = "PyYAML-6.0.1.tar.gz", hash = "sha256:bfdf460b1736c775f2ba9f6a92bca30bc2095067b8a9d77876d1fad6cc3b4a43"}, @@ -3274,7 +3298,7 @@ files = [ name = "tqdm" version = "4.66.1" description = "Fast, Extensible Progress Meter" -optional = false +optional = true python-versions = ">=3.7" files = [ {file = "tqdm-4.66.1-py3-none-any.whl", hash = "sha256:d302b3c5b53d47bce91fea46679d9c3c6508cf6332229aa1e7d8653723793386"}, @@ -3511,9 +3535,10 @@ docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.link testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-ignore-flaky", "pytest-mypy (>=0.9.1)", "pytest-ruff"] [extras] +assets = ["requests", "tqdm"] desktop = ["opencv-python"] [metadata] lock-version = "2.0" python-versions = ">=3.8,<3.12.0" -content-hash = "88f2cd2cce563de66fa9ea5b877ff83a971047b33d2860dd9964e463fd4c1433" +content-hash = "13e2a369414eea8d0e840f8ce39365183c142398ba62a4dd149cfa1be87aa031" From 23a71e6f51a0db2b38f240c6be60d4d8b1a00e72 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 24 Oct 2023 14:02:20 +0000 Subject: [PATCH 088/164] :arrow_up: Bump build from 0.10.0 to 1.0.3 Bumps [build](https://github.com/pypa/build) from 0.10.0 to 1.0.3. - [Release notes](https://github.com/pypa/build/releases) - [Changelog](https://github.com/pypa/build/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pypa/build/compare/0.10.0...1.0.3) --- updated-dependencies: - dependency-name: build dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- poetry.lock | 15 ++++++++------- pyproject.toml | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/poetry.lock b/poetry.lock index ad5368da..dfef5225 100644 --- a/poetry.lock +++ b/poetry.lock @@ -249,25 +249,26 @@ css = ["tinycss2 (>=1.1.0,<1.2)"] [[package]] name = "build" -version = "0.10.0" +version = "1.0.3" description = "A simple, correct Python build frontend" optional = false python-versions = ">= 3.7" files = [ - {file = "build-0.10.0-py3-none-any.whl", hash = "sha256:af266720050a66c893a6096a2f410989eeac74ff9a68ba194b3f6473e8e26171"}, - {file = "build-0.10.0.tar.gz", hash = "sha256:d5b71264afdb5951d6704482aac78de887c80691c52b88a9ad195983ca2c9269"}, + {file = "build-1.0.3-py3-none-any.whl", hash = "sha256:589bf99a67df7c9cf07ec0ac0e5e2ea5d4b37ac63301c4986d1acb126aa83f8f"}, + {file = "build-1.0.3.tar.gz", hash = "sha256:538aab1b64f9828977f84bc63ae570b060a8ed1be419e7870b8b4fc5e6ea553b"}, ] [package.dependencies] colorama = {version = "*", markers = "os_name == \"nt\""} +importlib-metadata = {version = ">=4.6", markers = "python_version < \"3.10\""} packaging = ">=19.0" pyproject_hooks = "*" tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} [package.extras] -docs = ["furo (>=2021.08.31)", "sphinx (>=4.0,<5.0)", "sphinx-argparse-cli (>=1.5)", "sphinx-autodoc-typehints (>=1.10)"] -test = ["filelock (>=3)", "pytest (>=6.2.4)", "pytest-cov (>=2.12)", "pytest-mock (>=2)", "pytest-rerunfailures (>=9.1)", "pytest-xdist (>=1.34)", "setuptools (>=42.0.0)", "setuptools (>=56.0.0)", "toml (>=0.10.0)", "wheel (>=0.36.0)"] -typing = ["importlib-metadata (>=5.1)", "mypy (==0.991)", "tomli", "typing-extensions (>=3.7.4.3)"] +docs = ["furo (>=2023.08.17)", "sphinx (>=7.0,<8.0)", "sphinx-argparse-cli (>=1.5)", "sphinx-autodoc-typehints (>=1.10)", "sphinx-issues (>=3.0.0)"] +test = ["filelock (>=3)", "pytest (>=6.2.4)", "pytest-cov (>=2.12)", "pytest-mock (>=2)", "pytest-rerunfailures (>=9.1)", "pytest-xdist (>=1.34)", "setuptools (>=42.0.0)", "setuptools (>=56.0.0)", "setuptools (>=56.0.0)", "setuptools (>=67.8.0)", "wheel (>=0.36.0)"] +typing = ["importlib-metadata (>=5.1)", "mypy (>=1.5.0,<1.6.0)", "tomli", "typing-extensions (>=3.7.4.3)"] virtualenv = ["virtualenv (>=20.0.35)"] [[package]] @@ -3592,4 +3593,4 @@ desktop = ["opencv-python"] [metadata] lock-version = "2.0" python-versions = ">=3.8,<3.12.0" -content-hash = "13e2a369414eea8d0e840f8ce39365183c142398ba62a4dd149cfa1be87aa031" +content-hash = "7f29055b1cbde4699f27580f4ff0e115069821746674245274846b26ee48ce0b" diff --git a/pyproject.toml b/pyproject.toml index 11eac5a5..b0add150 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -56,7 +56,7 @@ twine = "^4.0.2" pytest = "^7.2.2" wheel = "^0.40.0" notebook = "^6.5.3" -build = "^0.10.0" +build = ">=0.10,<1.1" ruff = "^0.0.280" isort = "^5.12.0" black = "^23.7.0" From 6837ef1d36348232fe355c5e0198abad6d2534a7 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Tue, 24 Oct 2023 16:10:37 +0200 Subject: [PATCH 089/164] Refactor asset imports and improve documentation Updated the import statements in the `supervision/assets/__init__.py`, `supervision/assets/downloader.py`, and `supervision/assets/list.py` files to use absolute paths for improved readability and reduced risk of import errors. Also added a usage example to the `download_assets` function to better illustrate its usage and return value. --- supervision/assets/__init__.py | 4 ++-- supervision/assets/downloader.py | 11 +++++++++-- supervision/assets/list.py | 1 + 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/supervision/assets/__init__.py b/supervision/assets/__init__.py index 18cc0810..3b76c5ab 100644 --- a/supervision/assets/__init__.py +++ b/supervision/assets/__init__.py @@ -1,2 +1,2 @@ -from .downloader import download_assets -from .list import VideoAssets +from supervision.assets.downloader import download_assets +from supervision.assets.list import VideoAssets diff --git a/supervision/assets/downloader.py b/supervision/assets/downloader.py index 04f1b4b2..9b12264a 100644 --- a/supervision/assets/downloader.py +++ b/supervision/assets/downloader.py @@ -4,8 +4,7 @@ from pathlib import Path from shutil import copyfileobj from typing import Union -from supervision.assets import VideoAssets -from supervision.assets.list import VIDEO_ASSETS +from supervision.assets.list import VIDEO_ASSETS, VideoAssets try: from requests import get @@ -51,6 +50,14 @@ def download_assets(asset_name: Union[VideoAssets, str]) -> str: Returns: str: The filename of the downloaded asset. + + Example: + ```python + >>> from supervision.assets import download_assets, VideoAssets + + >>> download_assets(VideoAssets.VEHICLES) + "vehicles.mp4" + ``` """ filename = asset_name.value if isinstance(asset_name, VideoAssets) else asset_name diff --git a/supervision/assets/list.py b/supervision/assets/list.py index a8ba566b..a2e58ec6 100644 --- a/supervision/assets/list.py +++ b/supervision/assets/list.py @@ -1,6 +1,7 @@ from enum import Enum from typing import Dict, Tuple + BASE_VIDEO_URL = "https://media.roboflow.com/supervision/video-examples/" From c23d00566be0afa69f578398095c0c160d88656e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 24 Oct 2023 14:11:27 +0000 Subject: [PATCH 090/164] :arrow_up: Bump ruff from 0.0.280 to 0.1.1 Bumps [ruff](https://github.com/astral-sh/ruff) from 0.0.280 to 0.1.1. - [Release notes](https://github.com/astral-sh/ruff/releases) - [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md) - [Commits](https://github.com/astral-sh/ruff/compare/v0.0.280...v0.1.1) --- updated-dependencies: - dependency-name: ruff dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- poetry.lock | 38 +++++++++++++++++++------------------- pyproject.toml | 2 +- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/poetry.lock b/poetry.lock index 2920dc27..e96c3977 100644 --- a/poetry.lock +++ b/poetry.lock @@ -3116,28 +3116,28 @@ files = [ [[package]] name = "ruff" -version = "0.0.280" +version = "0.1.1" description = "An extremely fast Python linter, written in Rust." optional = false python-versions = ">=3.7" files = [ - {file = "ruff-0.0.280-py3-none-macosx_10_7_x86_64.whl", hash = "sha256:48ed5aca381050a4e2f6d232db912d2e4e98e61648b513c350990c351125aaec"}, - {file = "ruff-0.0.280-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:ef6ee3e429fd29d6a5ceed295809e376e6ece5b0f13c7e703efaf3d3bcb30b96"}, - {file = "ruff-0.0.280-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d878370f7e9463ac40c253724229314ff6ebe4508cdb96cb536e1af4d5a9cd4f"}, - {file = "ruff-0.0.280-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:83e8f372fa5627eeda5b83b5a9632d2f9c88fc6d78cead7e2a1f6fb05728d137"}, - {file = "ruff-0.0.280-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7008fc6ca1df18b21fa98bdcfc711dad5f94d0fc3c11791f65e460c48ef27c82"}, - {file = "ruff-0.0.280-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:fe7118c1eae3fda17ceb409629c7f3b5a22dffa7caf1f6796776936dca1fe653"}, - {file = "ruff-0.0.280-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:37359cd67d2af8e09110a546507c302cbea11c66a52d2a9b6d841d465f9962d4"}, - {file = "ruff-0.0.280-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:bd58af46b0221efb95966f1f0f7576df711cb53e50d2fdb0e83c2f33360116a4"}, - {file = "ruff-0.0.280-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2e7c15828d09f90e97bea8feefcd2907e8c8ce3a1f959c99f9b4b3469679f33c"}, - {file = "ruff-0.0.280-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:2dae8f2d9c44c5c49af01733c2f7956f808db682a4193180dedb29dd718d7bbe"}, - {file = "ruff-0.0.280-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:5f972567163a20fb8c2d6afc60c2ea5ef8b68d69505760a8bd0377de8984b4f6"}, - {file = "ruff-0.0.280-py3-none-musllinux_1_2_i686.whl", hash = "sha256:8ffa7347ad11643f29de100977c055e47c988cd6d9f5f5ff83027600b11b9189"}, - {file = "ruff-0.0.280-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:7a37dab70114671d273f203268f6c3366c035fe0c8056614069e90a65e614bfc"}, - {file = "ruff-0.0.280-py3-none-win32.whl", hash = "sha256:7784e3606352fcfb193f3cd22b2e2117c444cb879ef6609ec69deabd662b0763"}, - {file = "ruff-0.0.280-py3-none-win_amd64.whl", hash = "sha256:4a7d52457b5dfcd3ab24b0b38eefaead8e2dca62b4fbf10de4cd0938cf20ce30"}, - {file = "ruff-0.0.280-py3-none-win_arm64.whl", hash = "sha256:b7de5b8689575918e130e4384ed9f539ce91d067c0a332aedef6ca7188adac2d"}, - {file = "ruff-0.0.280.tar.gz", hash = "sha256:581c43e4ac5e5a7117ad7da2120d960a4a99e68ec4021ec3cd47fe1cf78f8380"}, + {file = "ruff-0.1.1-py3-none-macosx_10_7_x86_64.whl", hash = "sha256:b7cdc893aef23ccc14c54bd79a8109a82a2c527e11d030b62201d86f6c2b81c5"}, + {file = "ruff-0.1.1-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:620d4b34302538dbd8bbbe8fdb8e8f98d72d29bd47e972e2b59ce6c1e8862257"}, + {file = "ruff-0.1.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2a909d3930afdbc2e9fd893b0034479e90e7981791879aab50ce3d9f55205bd6"}, + {file = "ruff-0.1.1-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:3305d1cb4eb8ff6d3e63a48d1659d20aab43b49fe987b3ca4900528342367145"}, + {file = "ruff-0.1.1-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c34ae501d0ec71acf19ee5d4d889e379863dcc4b796bf8ce2934a9357dc31db7"}, + {file = "ruff-0.1.1-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:6aa7e63c3852cf8fe62698aef31e563e97143a4b801b57f920012d0e07049a8d"}, + {file = "ruff-0.1.1-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:2d68367d1379a6b47e61bc9de144a47bcdb1aad7903bbf256e4c3d31f11a87ae"}, + {file = "ruff-0.1.1-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:bc11955f6ce3398d2afe81ad7e49d0ebf0a581d8bcb27b8c300281737735e3a3"}, + {file = "ruff-0.1.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:cbbd8eead88ea83a250499074e2a8e9d80975f0b324b1e2e679e4594da318c25"}, + {file = "ruff-0.1.1-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:f4780e2bb52f3863a565ec3f699319d3493b83ff95ebbb4993e59c62aaf6e75e"}, + {file = "ruff-0.1.1-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:8f5b24daddf35b6c207619301170cae5d2699955829cda77b6ce1e5fc69340df"}, + {file = "ruff-0.1.1-py3-none-musllinux_1_2_i686.whl", hash = "sha256:d3f9ac658ba29e07b95c80fa742b059a55aefffa8b1e078bc3c08768bdd4b11a"}, + {file = "ruff-0.1.1-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:3521bf910104bf781e6753282282acc145cbe3eff79a1ce6b920404cd756075a"}, + {file = "ruff-0.1.1-py3-none-win32.whl", hash = "sha256:ba3208543ab91d3e4032db2652dcb6c22a25787b85b8dc3aeff084afdc612e5c"}, + {file = "ruff-0.1.1-py3-none-win_amd64.whl", hash = "sha256:3ff3006c97d9dc396b87fb46bb65818e614ad0181f059322df82bbfe6944e264"}, + {file = "ruff-0.1.1-py3-none-win_arm64.whl", hash = "sha256:e140bd717c49164c8feb4f65c644046fe929c46f42493672853e3213d7bdbce2"}, + {file = "ruff-0.1.1.tar.gz", hash = "sha256:c90461ae4abec261609e5ea436de4a4b5f2822921cf04c16d2cc9327182dbbcc"}, ] [[package]] @@ -3593,4 +3593,4 @@ desktop = ["opencv-python"] [metadata] lock-version = "2.0" python-versions = ">=3.8,<3.12.0" -content-hash = "7f29055b1cbde4699f27580f4ff0e115069821746674245274846b26ee48ce0b" +content-hash = "a01716139cb76e2352909ed19139d1ccab063684b1d2b098be4ea8f6a973e509" diff --git a/pyproject.toml b/pyproject.toml index b0add150..1bb9aee9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -57,7 +57,7 @@ pytest = "^7.2.2" wheel = "^0.40.0" notebook = "^6.5.3" build = ">=0.10,<1.1" -ruff = "^0.0.280" +ruff = ">=0.0.280,<0.1.2" isort = "^5.12.0" black = "^23.7.0" mypy = "^1.4.1" From 9ece846f8ed74a6cb48f61a398bbd91dc1265fd6 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Tue, 24 Oct 2023 16:11:46 +0200 Subject: [PATCH 091/164] Update project version in pyproject.toml Increased the version of the project from "0.17.0rc1" to "0.17.0rc2" in the 'pyproject.toml' file. --- docs/assets.md | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/assets.md b/docs/assets.md index 4fded6e7..13e3cbfb 100644 --- a/docs/assets.md +++ b/docs/assets.md @@ -3,7 +3,7 @@ that you can use in your demos. ## install extra -To install the Supervision assets utility, you can use pip. This utility is available +To install the Supervision assets utility, you can use `pip`. This utility is available as an extra within the Supervision package. !!! example "pip install" diff --git a/pyproject.toml b/pyproject.toml index 11eac5a5..ce50bf1d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "supervision" -version = "0.17.0rc1" +version = "0.17.0rc2" description = "A set of easy-to-use utils that will come in handy in any Computer Vision project" authors = ["Piotr Skalski "] maintainers = ["Piotr Skalski "] From 337abe1e710e16e37fc5fb5b2138b9737f50b3e4 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 24 Oct 2023 14:15:06 +0000 Subject: [PATCH 092/164] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/assets/list.py | 1 - 1 file changed, 1 deletion(-) diff --git a/supervision/assets/list.py b/supervision/assets/list.py index a2e58ec6..a8ba566b 100644 --- a/supervision/assets/list.py +++ b/supervision/assets/list.py @@ -1,7 +1,6 @@ from enum import Enum from typing import Dict, Tuple - BASE_VIDEO_URL = "https://media.roboflow.com/supervision/video-examples/" From b77bab39de168561ce912e198a70e40a3a728620 Mon Sep 17 00:00:00 2001 From: Hugo Dutra <67278688+hugoles@users.noreply.github.com> Date: Tue, 24 Oct 2023 12:37:52 -0300 Subject: [PATCH 093/164] Rename script.sh to setup.sh changing the file name. --- examples/traffic_analysis/{script.sh => setup.sh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename examples/traffic_analysis/{script.sh => setup.sh} (100%) diff --git a/examples/traffic_analysis/script.sh b/examples/traffic_analysis/setup.sh similarity index 100% rename from examples/traffic_analysis/script.sh rename to examples/traffic_analysis/setup.sh From bda80934cc2eceda0429522a427c69e3e7b06a63 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 25 Oct 2023 00:41:33 +0000 Subject: [PATCH 094/164] :arrow_up: Bump mkdocstrings from 0.20.0 to 0.23.0 Bumps [mkdocstrings](https://github.com/mkdocstrings/mkdocstrings) from 0.20.0 to 0.23.0. - [Release notes](https://github.com/mkdocstrings/mkdocstrings/releases) - [Changelog](https://github.com/mkdocstrings/mkdocstrings/blob/main/CHANGELOG.md) - [Commits](https://github.com/mkdocstrings/mkdocstrings/compare/0.20.0...0.23.0) --- updated-dependencies: - dependency-name: mkdocstrings dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- poetry.lock | 12 +++++++----- pyproject.toml | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/poetry.lock b/poetry.lock index e96c3977..aed3b857 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1723,16 +1723,17 @@ files = [ [[package]] name = "mkdocstrings" -version = "0.20.0" +version = "0.23.0" description = "Automatic documentation from sources, for MkDocs." optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "mkdocstrings-0.20.0-py3-none-any.whl", hash = "sha256:f17fc2c4f760ec302b069075ef9e31045aa6372ca91d2f35ded3adba8e25a472"}, - {file = "mkdocstrings-0.20.0.tar.gz", hash = "sha256:c757f4f646d4f939491d6bc9256bfe33e36c5f8026392f49eaa351d241c838e5"}, + {file = "mkdocstrings-0.23.0-py3-none-any.whl", hash = "sha256:051fa4014dfcd9ed90254ae91de2dbb4f24e166347dae7be9a997fe16316c65e"}, + {file = "mkdocstrings-0.23.0.tar.gz", hash = "sha256:d9c6a37ffbe7c14a7a54ef1258c70b8d394e6a33a1c80832bce40b9567138d1c"}, ] [package.dependencies] +importlib-metadata = {version = ">=4.6", markers = "python_version < \"3.10\""} Jinja2 = ">=2.11.1" Markdown = ">=3.3" MarkupSafe = ">=1.1" @@ -1740,6 +1741,7 @@ mkdocs = ">=1.2" mkdocs-autorefs = ">=0.3.1" mkdocstrings-python = {version = ">=0.5.2", optional = true, markers = "extra == \"python\""} pymdown-extensions = ">=6.3" +typing-extensions = {version = ">=4.1", markers = "python_version < \"3.10\""} [package.extras] crystal = ["mkdocstrings-crystal (>=0.3.4)"] @@ -3593,4 +3595,4 @@ desktop = ["opencv-python"] [metadata] lock-version = "2.0" python-versions = ">=3.8,<3.12.0" -content-hash = "a01716139cb76e2352909ed19139d1ccab063684b1d2b098be4ea8f6a973e509" +content-hash = "6702def967f2d487e6c093ba1d4802692059165698734acd5d112c296378216b" diff --git a/pyproject.toml b/pyproject.toml index 738b08d2..3f51674a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -67,7 +67,7 @@ flake8 = { version = "*", python = ">=3.8.1,<3.12.0" } [tool.poetry.group.docs.dependencies] mkdocs-material = "^9.1.4" -mkdocstrings = {extras = ["python"], version = "^0.20.0"} +mkdocstrings = {extras = ["python"], version = ">=0.20,<0.24"} [tool.flake8] exclude = ".venv" From cbcd0be74c486b04a85ecc905b0b4ce36423f033 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 25 Oct 2023 00:42:13 +0000 Subject: [PATCH 095/164] :arrow_up: Bump opencv-python-headless from 4.8.0.74 to 4.8.1.78 Bumps [opencv-python-headless](https://github.com/opencv/opencv-python) from 4.8.0.74 to 4.8.1.78. - [Release notes](https://github.com/opencv/opencv-python/releases) - [Commits](https://github.com/opencv/opencv-python/commits) --- updated-dependencies: - dependency-name: opencv-python-headless dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- poetry.lock | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/poetry.lock b/poetry.lock index e96c3977..ff585ed8 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2086,18 +2086,18 @@ numpy = [ [[package]] name = "opencv-python-headless" -version = "4.8.0.74" +version = "4.8.1.78" description = "Wrapper package for OpenCV python bindings." optional = false python-versions = ">=3.6" files = [ - {file = "opencv-python-headless-4.8.0.74.tar.gz", hash = "sha256:a72770b8f2e08358b1faa41c8372b17d040aa9bb3e446ab7090e358f6f4e91ba"}, - {file = "opencv_python_headless-4.8.0.74-cp37-abi3-macosx_10_16_x86_64.whl", hash = "sha256:f645b17667fc9bffec8c3b3a72a217430c8d7090ed3ebb80fd8efc657f372d6c"}, - {file = "opencv_python_headless-4.8.0.74-cp37-abi3-macosx_11_0_arm64.whl", hash = "sha256:7c88744ce922b81747c86f2b7f1b3ec84ff2f53477ee9219a5e75ae2012b443f"}, - {file = "opencv_python_headless-4.8.0.74-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:34e92fef90e8f768d92dca875aefaff8b11556427f82484378a3848eb690d4c0"}, - {file = "opencv_python_headless-4.8.0.74-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f8a88620c43a5d17f7df8317767da93b935656ab9236df92e1e2e0dd23195756"}, - {file = "opencv_python_headless-4.8.0.74-cp37-abi3-win32.whl", hash = "sha256:b52a6eb2d92fff0f660e6aade958cb4373fbfcbafa0488f7ae88c4e6ce3f47f6"}, - {file = "opencv_python_headless-4.8.0.74-cp37-abi3-win_amd64.whl", hash = "sha256:19d30269ae710f67e0ae549361a68b755e28599a572d5f72d0bbb177ab438a28"}, + {file = "opencv-python-headless-4.8.1.78.tar.gz", hash = "sha256:bc7197b42352f6f865c302a49140b889ec7cd957dd697e2d7fc016ad0d3f28f1"}, + {file = "opencv_python_headless-4.8.1.78-cp37-abi3-macosx_10_16_x86_64.whl", hash = "sha256:f3a33f644249f9ce1c913eac580e4b3ef4ce7cab0a71900274708959c2feb5e3"}, + {file = "opencv_python_headless-4.8.1.78-cp37-abi3-macosx_11_0_arm64.whl", hash = "sha256:2c7d45721df9801c4dcd34683a15caa0e30f38b185263fec04a6eb274bc720f0"}, + {file = "opencv_python_headless-4.8.1.78-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3b6bd6e1132b6f5dcb3a5bfe30fc4d341a7bfb26134da349a06c9255288ded94"}, + {file = "opencv_python_headless-4.8.1.78-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:58e70d2f0915fe23e02c6e405588276c9397844a47d38b9c87fac5f7f9ba2dcc"}, + {file = "opencv_python_headless-4.8.1.78-cp37-abi3-win32.whl", hash = "sha256:382f8c7a6a14f80091284eecedd52cee4812231ee0eff1118592197b538d9252"}, + {file = "opencv_python_headless-4.8.1.78-cp37-abi3-win_amd64.whl", hash = "sha256:0a0f1e9f836f7d5bad1dd164694944c8761711cbdf4b36ebbd4815a8ef731079"}, ] [package.dependencies] From 45a19058120cf529ae2825ec721c6cae2913673c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 25 Oct 2023 00:43:41 +0000 Subject: [PATCH 096/164] :arrow_up: Bump matplotlib from 3.7.2 to 3.7.3 Bumps [matplotlib](https://github.com/matplotlib/matplotlib) from 3.7.2 to 3.7.3. - [Release notes](https://github.com/matplotlib/matplotlib/releases) - [Commits](https://github.com/matplotlib/matplotlib/compare/v3.7.2...v3.7.3) --- updated-dependencies: - dependency-name: matplotlib dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- poetry.lock | 117 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 73 insertions(+), 44 deletions(-) diff --git a/poetry.lock b/poetry.lock index e96c3977..f403757b 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1517,52 +1517,58 @@ files = [ [[package]] name = "matplotlib" -version = "3.7.2" +version = "3.7.3" description = "Python plotting package" optional = false python-versions = ">=3.8" files = [ - {file = "matplotlib-3.7.2-cp310-cp310-macosx_10_12_universal2.whl", hash = "sha256:2699f7e73a76d4c110f4f25be9d2496d6ab4f17345307738557d345f099e07de"}, - {file = "matplotlib-3.7.2-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:a8035ba590658bae7562786c9cc6ea1a84aa49d3afab157e414c9e2ea74f496d"}, - {file = "matplotlib-3.7.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:2f8e4a49493add46ad4a8c92f63e19d548b2b6ebbed75c6b4c7f46f57d36cdd1"}, - {file = "matplotlib-3.7.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:71667eb2ccca4c3537d9414b1bc00554cb7f91527c17ee4ec38027201f8f1603"}, - {file = "matplotlib-3.7.2-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:152ee0b569a37630d8628534c628456b28686e085d51394da6b71ef84c4da201"}, - {file = "matplotlib-3.7.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:070f8dddd1f5939e60aacb8fa08f19551f4b0140fab16a3669d5cd6e9cb28fc8"}, - {file = "matplotlib-3.7.2-cp310-cp310-win32.whl", hash = "sha256:fdbb46fad4fb47443b5b8ac76904b2e7a66556844f33370861b4788db0f8816a"}, - {file = "matplotlib-3.7.2-cp310-cp310-win_amd64.whl", hash = "sha256:23fb1750934e5f0128f9423db27c474aa32534cec21f7b2153262b066a581fd1"}, - {file = "matplotlib-3.7.2-cp311-cp311-macosx_10_12_universal2.whl", hash = "sha256:30e1409b857aa8a747c5d4f85f63a79e479835f8dffc52992ac1f3f25837b544"}, - {file = "matplotlib-3.7.2-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:50e0a55ec74bf2d7a0ebf50ac580a209582c2dd0f7ab51bc270f1b4a0027454e"}, - {file = "matplotlib-3.7.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:ac60daa1dc83e8821eed155796b0f7888b6b916cf61d620a4ddd8200ac70cd64"}, - {file = "matplotlib-3.7.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:305e3da477dc8607336ba10bac96986d6308d614706cae2efe7d3ffa60465b24"}, - {file = "matplotlib-3.7.2-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1c308b255efb9b06b23874236ec0f10f026673ad6515f602027cc8ac7805352d"}, - {file = "matplotlib-3.7.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:60c521e21031632aa0d87ca5ba0c1c05f3daacadb34c093585a0be6780f698e4"}, - {file = "matplotlib-3.7.2-cp311-cp311-win32.whl", hash = "sha256:26bede320d77e469fdf1bde212de0ec889169b04f7f1179b8930d66f82b30cbc"}, - {file = "matplotlib-3.7.2-cp311-cp311-win_amd64.whl", hash = "sha256:af4860132c8c05261a5f5f8467f1b269bf1c7c23902d75f2be57c4a7f2394b3e"}, - {file = "matplotlib-3.7.2-cp38-cp38-macosx_10_12_universal2.whl", hash = "sha256:a1733b8e84e7e40a9853e505fe68cc54339f97273bdfe6f3ed980095f769ddc7"}, - {file = "matplotlib-3.7.2-cp38-cp38-macosx_10_12_x86_64.whl", hash = "sha256:d9881356dc48e58910c53af82b57183879129fa30492be69058c5b0d9fddf391"}, - {file = "matplotlib-3.7.2-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:f081c03f413f59390a80b3e351cc2b2ea0205839714dbc364519bcf51f4b56ca"}, - {file = "matplotlib-3.7.2-cp38-cp38-manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:1cd120fca3407a225168238b790bd5c528f0fafde6172b140a2f3ab7a4ea63e9"}, - {file = "matplotlib-3.7.2-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:a2c1590b90aa7bd741b54c62b78de05d4186271e34e2377e0289d943b3522273"}, - {file = "matplotlib-3.7.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6d2ff3c984b8a569bc1383cd468fc06b70d7b59d5c2854ca39f1436ae8394117"}, - {file = "matplotlib-3.7.2-cp38-cp38-win32.whl", hash = "sha256:5dea00b62d28654b71ca92463656d80646675628d0828e08a5f3b57e12869e13"}, - {file = "matplotlib-3.7.2-cp38-cp38-win_amd64.whl", hash = "sha256:0f506a1776ee94f9e131af1ac6efa6e5bc7cb606a3e389b0ccb6e657f60bb676"}, - {file = "matplotlib-3.7.2-cp39-cp39-macosx_10_12_universal2.whl", hash = "sha256:6515e878f91894c2e4340d81f0911857998ccaf04dbc1bba781e3d89cbf70608"}, - {file = "matplotlib-3.7.2-cp39-cp39-macosx_10_12_x86_64.whl", hash = "sha256:71f7a8c6b124e904db550f5b9fe483d28b896d4135e45c4ea381ad3b8a0e3256"}, - {file = "matplotlib-3.7.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:12f01b92ecd518e0697da4d97d163b2b3aa55eb3eb4e2c98235b3396d7dad55f"}, - {file = "matplotlib-3.7.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a7e28d6396563955f7af437894a36bf2b279462239a41028323e04b85179058b"}, - {file = "matplotlib-3.7.2-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:dbcf59334ff645e6a67cd5f78b4b2cdb76384cdf587fa0d2dc85f634a72e1a3e"}, - {file = "matplotlib-3.7.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:318c89edde72ff95d8df67d82aca03861240512994a597a435a1011ba18dbc7f"}, - {file = "matplotlib-3.7.2-cp39-cp39-win32.whl", hash = "sha256:ce55289d5659b5b12b3db4dc9b7075b70cef5631e56530f14b2945e8836f2d20"}, - {file = "matplotlib-3.7.2-cp39-cp39-win_amd64.whl", hash = "sha256:2ecb5be2b2815431c81dc115667e33da0f5a1bcf6143980d180d09a717c4a12e"}, - {file = "matplotlib-3.7.2-pp38-pypy38_pp73-macosx_10_12_x86_64.whl", hash = "sha256:fdcd28360dbb6203fb5219b1a5658df226ac9bebc2542a9e8f457de959d713d0"}, - {file = "matplotlib-3.7.2-pp38-pypy38_pp73-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0c3cca3e842b11b55b52c6fb8bd6a4088693829acbfcdb3e815fa9b7d5c92c1b"}, - {file = "matplotlib-3.7.2-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ebf577c7a6744e9e1bd3fee45fc74a02710b214f94e2bde344912d85e0c9af7c"}, - {file = "matplotlib-3.7.2-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:936bba394682049919dda062d33435b3be211dc3dcaa011e09634f060ec878b2"}, - {file = "matplotlib-3.7.2-pp39-pypy39_pp73-macosx_10_12_x86_64.whl", hash = "sha256:bc221ffbc2150458b1cd71cdd9ddd5bb37962b036e41b8be258280b5b01da1dd"}, - {file = "matplotlib-3.7.2-pp39-pypy39_pp73-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:35d74ebdb3f71f112b36c2629cf32323adfbf42679e2751252acd468f5001c07"}, - {file = "matplotlib-3.7.2-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:717157e61b3a71d3d26ad4e1770dc85156c9af435659a25ee6407dc866cb258d"}, - {file = "matplotlib-3.7.2-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:20f844d6be031948148ba49605c8b96dfe7d3711d1b63592830d650622458c11"}, - {file = "matplotlib-3.7.2.tar.gz", hash = "sha256:a8cdb91dddb04436bd2f098b8fdf4b81352e68cf4d2c6756fcc414791076569b"}, + {file = "matplotlib-3.7.3-cp310-cp310-macosx_10_12_universal2.whl", hash = "sha256:085c33b27561d9c04386789d5aa5eb4a932ddef43cfcdd0e01735f9a6e85ce0c"}, + {file = "matplotlib-3.7.3-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:c568e80e1c17f68a727f30f591926751b97b98314d8e59804f54f86ae6fa6a22"}, + {file = "matplotlib-3.7.3-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:7baf98c5ad59c5c4743ea884bb025cbffa52dacdfdac0da3e6021a285a90377e"}, + {file = "matplotlib-3.7.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:236024f582e40dac39bca592258888b38ae47a9fed7b8de652d68d3d02d47d2b"}, + {file = "matplotlib-3.7.3-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:12b4f6795efea037ce2d41e7c417ad8bd02d5719c6ad4a8450a0708f4a1cfb89"}, + {file = "matplotlib-3.7.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:78b2136cc6c5415b78977e0e8c608647d597204b05b1d9089ccf513c7d913733"}, + {file = "matplotlib-3.7.3-cp310-cp310-win32.whl", hash = "sha256:122dcbf9be0086e2a95d9e5e0632dbf3bd5b65eaa68c369363310a6c87753059"}, + {file = "matplotlib-3.7.3-cp310-cp310-win_amd64.whl", hash = "sha256:4aab27d9e33293389e3c1d7c881d414a72bdfda0fedc3a6bf46c6fa88d9b8015"}, + {file = "matplotlib-3.7.3-cp311-cp311-macosx_10_12_universal2.whl", hash = "sha256:d5adc743de91e8e0b13df60deb1b1c285b8effea3d66223afceb14b63c9b05de"}, + {file = "matplotlib-3.7.3-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:55de4cf7cd0071b8ebf203981b53ab64f988a0a1f897a2dff300a1124e8bcd8b"}, + {file = "matplotlib-3.7.3-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:ac03377fd908aaee2312d0b11735753e907adb6f4d1d102de5e2425249693f6c"}, + {file = "matplotlib-3.7.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:755bafc10a46918ce9a39980009b54b02dd249594e5adf52f9c56acfddb5d0b7"}, + {file = "matplotlib-3.7.3-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1a6094c6f8e8d18db631754df4fe9a34dec3caf074f6869a7db09f18f9b1d6b2"}, + {file = "matplotlib-3.7.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:272dba2f1b107790ed78ebf5385b8d14b27ad9e90419de340364b49fe549a993"}, + {file = "matplotlib-3.7.3-cp311-cp311-win32.whl", hash = "sha256:591c123bed1cb4b9996fb60b41a6d89c2ec4943244540776c5f1283fb6960a53"}, + {file = "matplotlib-3.7.3-cp311-cp311-win_amd64.whl", hash = "sha256:3bf3a178c6504694cee8b88b353df0051583f2f6f8faa146f67115c27c856881"}, + {file = "matplotlib-3.7.3-cp312-cp312-macosx_10_12_universal2.whl", hash = "sha256:edf54cac8ee3603f3093616b40a931e8c063969756a4d78a86e82c2fea9659f7"}, + {file = "matplotlib-3.7.3-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:91e36a85ea639a1ba9f91427041eac064b04829945fe331a92617b6cb21d27e5"}, + {file = "matplotlib-3.7.3-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:caf5eaaf7c68f8d7df269dfbcaf46f48a70ff482bfcebdcc97519671023f2a7d"}, + {file = "matplotlib-3.7.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:74bf57f505efea376097e948b7cdd87191a7ce8180616390aef496639edf601f"}, + {file = "matplotlib-3.7.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ee152a88a0da527840a426535514b6ed8ac4240eb856b1da92cf48124320e346"}, + {file = "matplotlib-3.7.3-cp312-cp312-win_amd64.whl", hash = "sha256:67a410a9c9e07cbc83581eeea144bbe298870bf0ac0ee2f2e10a015ab7efee19"}, + {file = "matplotlib-3.7.3-cp38-cp38-macosx_10_12_universal2.whl", hash = "sha256:259999c05285cb993d7f2a419cea547863fa215379eda81f7254c9e932963729"}, + {file = "matplotlib-3.7.3-cp38-cp38-macosx_10_12_x86_64.whl", hash = "sha256:3f4e7fd5a6157e1d018ce2166ec8e531a481dd4a36f035b5c23edfe05a25419a"}, + {file = "matplotlib-3.7.3-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:faa3d12d8811d08d14080a8b7b9caea9a457dc495350166b56df0db4b9909ef5"}, + {file = "matplotlib-3.7.3-cp38-cp38-manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:336e88900c11441e458da01c8414fc57e04e17f9d3bb94958a76faa2652bcf6b"}, + {file = "matplotlib-3.7.3-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:12f4c0dd8aa280d796c8772ea8265a14f11a04319baa3a16daa5556065e8baea"}, + {file = "matplotlib-3.7.3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1990955b11e7918d256cf3b956b10997f405b7917a3f1c7d8e69c1d15c7b1930"}, + {file = "matplotlib-3.7.3-cp38-cp38-win32.whl", hash = "sha256:e78707b751260b42b721507ad7aa60fe4026d7f51c74cca6b9cd8b123ebb633a"}, + {file = "matplotlib-3.7.3-cp38-cp38-win_amd64.whl", hash = "sha256:e594ee43c59ea39ca5c6244667cac9d017a3527febc31f5532ad9135cf7469ec"}, + {file = "matplotlib-3.7.3-cp39-cp39-macosx_10_12_universal2.whl", hash = "sha256:6eaa1cf0e94c936a26b78f6d756c5fbc12e0a58c8a68b7248a2a31456ce4e234"}, + {file = "matplotlib-3.7.3-cp39-cp39-macosx_10_12_x86_64.whl", hash = "sha256:0a97af9d22e8ebedc9f00b043d9bbd29a375e9e10b656982012dded44c10fd77"}, + {file = "matplotlib-3.7.3-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:1f9c6c16597af660433ab330b59ee2934b832ee1fabcaf5cbde7b2add840f31e"}, + {file = "matplotlib-3.7.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a7240259b4b9cbc62381f6378cff4d57af539162a18e832c1e48042fabc40b6b"}, + {file = "matplotlib-3.7.3-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:747c6191d2e88ae854809e69aa358dbf852ff1a5738401b85c1cc9012309897a"}, + {file = "matplotlib-3.7.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ec726b08a5275d827aa91bb951e68234a4423adb91cf65bc0fcdc0f2777663f7"}, + {file = "matplotlib-3.7.3-cp39-cp39-win32.whl", hash = "sha256:40e3b9b450c6534f07278310c4e34caff41c2a42377e4b9d47b0f8d3ac1083a2"}, + {file = "matplotlib-3.7.3-cp39-cp39-win_amd64.whl", hash = "sha256:dfc118642903a23e309b1da32886bb39a4314147d013e820c86b5fb4cb2e36d0"}, + {file = "matplotlib-3.7.3-pp38-pypy38_pp73-macosx_10_12_x86_64.whl", hash = "sha256:165c8082bf8fc0360c24aa4724a22eaadbfd8c28bf1ccf7e94d685cad48261e4"}, + {file = "matplotlib-3.7.3-pp38-pypy38_pp73-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ebd8470cc2a3594746ff0513aecbfa2c55ff6f58e6cef2efb1a54eb87c88ffa2"}, + {file = "matplotlib-3.7.3-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7153453669c9672b52095119fd21dd032d19225d48413a2871519b17db4b0fde"}, + {file = "matplotlib-3.7.3-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:498a08267dc69dd8f24c4b5d7423fa584d7ce0027ba71f7881df05fc09b89bb7"}, + {file = "matplotlib-3.7.3-pp39-pypy39_pp73-macosx_10_12_x86_64.whl", hash = "sha256:d48999c4b19b5a0c058c9cd828ff6fc7748390679f6cf9a2ad653a3e802c87d3"}, + {file = "matplotlib-3.7.3-pp39-pypy39_pp73-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:22d65d18b4ee8070a5fea5761d59293f1f9e2fac37ec9ce090463b0e629432fd"}, + {file = "matplotlib-3.7.3-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9c40cde976c36693cc0767e27cf5f443f91c23520060bd9496678364adfafe9c"}, + {file = "matplotlib-3.7.3-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:39018a2b17592448fbfdf4b8352955e6c3905359939791d4ff429296494d1a0c"}, + {file = "matplotlib-3.7.3.tar.gz", hash = "sha256:f09b3dd6bdeb588de91f853bbb2d6f0ff8ab693485b0c49035eaa510cb4f142e"}, ] [package.dependencies] @@ -1571,11 +1577,12 @@ cycler = ">=0.10" fonttools = ">=4.22.0" importlib-resources = {version = ">=3.2.0", markers = "python_version < \"3.10\""} kiwisolver = ">=1.0.1" -numpy = ">=1.20" +numpy = ">=1.20,<2" packaging = ">=20.0" pillow = ">=6.2.0" -pyparsing = ">=2.3.1,<3.1" +pyparsing = ">=2.3.1" python-dateutil = ">=2.7" +setuptools_scm = ">=7" [[package]] name = "matplotlib-inline" @@ -3225,6 +3232,28 @@ docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "pygments-g testing = ["build[virtualenv]", "filelock (>=3.4.0)", "flake8-2020", "ini2toml[lite] (>=0.9)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pip (>=19.1)", "pip-run (>=8.8)", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-mypy (>=0.9.1)", "pytest-perf", "pytest-ruff", "pytest-timeout", "pytest-xdist", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel"] testing-integration = ["build[virtualenv]", "filelock (>=3.4.0)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pytest", "pytest-enabler", "pytest-xdist", "tomli", "virtualenv (>=13.0.0)", "wheel"] +[[package]] +name = "setuptools-scm" +version = "8.0.4" +description = "the blessed package to manage your versions by scm tags" +optional = false +python-versions = ">=3.8" +files = [ + {file = "setuptools-scm-8.0.4.tar.gz", hash = "sha256:b5f43ff6800669595193fd09891564ee9d1d7dcb196cab4b2506d53a2e1c95c7"}, + {file = "setuptools_scm-8.0.4-py3-none-any.whl", hash = "sha256:b47844cd2a84b83b3187a5782c71128c28b4c94cad8bfb871da2784a5cb54c4f"}, +] + +[package.dependencies] +packaging = ">=20" +setuptools = "*" +tomli = {version = ">=1", markers = "python_version < \"3.11\""} +typing-extensions = "*" + +[package.extras] +docs = ["entangled-cli[rich]", "mkdocs", "mkdocs-entangled-plugin", "mkdocs-material", "mkdocstrings[python]", "pygments"] +rich = ["rich"] +test = ["build", "pytest", "rich", "wheel"] + [[package]] name = "six" version = "1.16.0" From b17003855ce4af29d27ddc63ff81cd6e5148e805 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 25 Oct 2023 00:44:21 +0000 Subject: [PATCH 097/164] :arrow_up: Bump pre-commit from 3.3.3 to 3.5.0 Bumps [pre-commit](https://github.com/pre-commit/pre-commit) from 3.3.3 to 3.5.0. - [Release notes](https://github.com/pre-commit/pre-commit/releases) - [Changelog](https://github.com/pre-commit/pre-commit/blob/main/CHANGELOG.md) - [Commits](https://github.com/pre-commit/pre-commit/compare/v3.3.3...v3.5.0) --- updated-dependencies: - dependency-name: pre-commit dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- poetry.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/poetry.lock b/poetry.lock index e96c3977..0710f54c 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2328,13 +2328,13 @@ testing = ["pytest", "pytest-benchmark"] [[package]] name = "pre-commit" -version = "3.3.3" +version = "3.5.0" description = "A framework for managing and maintaining multi-language pre-commit hooks." optional = false python-versions = ">=3.8" files = [ - {file = "pre_commit-3.3.3-py2.py3-none-any.whl", hash = "sha256:10badb65d6a38caff29703362271d7dca483d01da88f9d7e05d0b97171c136cb"}, - {file = "pre_commit-3.3.3.tar.gz", hash = "sha256:a2256f489cd913d575c145132ae196fe335da32d91a8294b7afe6622335dd023"}, + {file = "pre_commit-3.5.0-py2.py3-none-any.whl", hash = "sha256:841dc9aef25daba9a0238cd27984041fa0467b4199fc4852e27950664919f660"}, + {file = "pre_commit-3.5.0.tar.gz", hash = "sha256:5804465c675b659b0862f07907f96295d490822a450c4c40e747d0b1c6ebcb32"}, ] [package.dependencies] From 8e91c62103f2c67c0da21ecf881bc25caeb71feb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 25 Oct 2023 11:18:29 +0000 Subject: [PATCH 098/164] :arrow_up: Bump ruff from 0.1.1 to 0.1.2 Bumps [ruff](https://github.com/astral-sh/ruff) from 0.1.1 to 0.1.2. - [Release notes](https://github.com/astral-sh/ruff/releases) - [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md) - [Commits](https://github.com/astral-sh/ruff/compare/v0.1.1...v0.1.2) --- updated-dependencies: - dependency-name: ruff dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- poetry.lock | 38 +++++++++++++++++++------------------- pyproject.toml | 2 +- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/poetry.lock b/poetry.lock index 3e168c8e..369f84cf 100644 --- a/poetry.lock +++ b/poetry.lock @@ -3125,28 +3125,28 @@ files = [ [[package]] name = "ruff" -version = "0.1.1" +version = "0.1.2" description = "An extremely fast Python linter, written in Rust." optional = false python-versions = ">=3.7" files = [ - {file = "ruff-0.1.1-py3-none-macosx_10_7_x86_64.whl", hash = "sha256:b7cdc893aef23ccc14c54bd79a8109a82a2c527e11d030b62201d86f6c2b81c5"}, - {file = "ruff-0.1.1-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:620d4b34302538dbd8bbbe8fdb8e8f98d72d29bd47e972e2b59ce6c1e8862257"}, - {file = "ruff-0.1.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2a909d3930afdbc2e9fd893b0034479e90e7981791879aab50ce3d9f55205bd6"}, - {file = "ruff-0.1.1-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:3305d1cb4eb8ff6d3e63a48d1659d20aab43b49fe987b3ca4900528342367145"}, - {file = "ruff-0.1.1-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c34ae501d0ec71acf19ee5d4d889e379863dcc4b796bf8ce2934a9357dc31db7"}, - {file = "ruff-0.1.1-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:6aa7e63c3852cf8fe62698aef31e563e97143a4b801b57f920012d0e07049a8d"}, - {file = "ruff-0.1.1-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:2d68367d1379a6b47e61bc9de144a47bcdb1aad7903bbf256e4c3d31f11a87ae"}, - {file = "ruff-0.1.1-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:bc11955f6ce3398d2afe81ad7e49d0ebf0a581d8bcb27b8c300281737735e3a3"}, - {file = "ruff-0.1.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:cbbd8eead88ea83a250499074e2a8e9d80975f0b324b1e2e679e4594da318c25"}, - {file = "ruff-0.1.1-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:f4780e2bb52f3863a565ec3f699319d3493b83ff95ebbb4993e59c62aaf6e75e"}, - {file = "ruff-0.1.1-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:8f5b24daddf35b6c207619301170cae5d2699955829cda77b6ce1e5fc69340df"}, - {file = "ruff-0.1.1-py3-none-musllinux_1_2_i686.whl", hash = "sha256:d3f9ac658ba29e07b95c80fa742b059a55aefffa8b1e078bc3c08768bdd4b11a"}, - {file = "ruff-0.1.1-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:3521bf910104bf781e6753282282acc145cbe3eff79a1ce6b920404cd756075a"}, - {file = "ruff-0.1.1-py3-none-win32.whl", hash = "sha256:ba3208543ab91d3e4032db2652dcb6c22a25787b85b8dc3aeff084afdc612e5c"}, - {file = "ruff-0.1.1-py3-none-win_amd64.whl", hash = "sha256:3ff3006c97d9dc396b87fb46bb65818e614ad0181f059322df82bbfe6944e264"}, - {file = "ruff-0.1.1-py3-none-win_arm64.whl", hash = "sha256:e140bd717c49164c8feb4f65c644046fe929c46f42493672853e3213d7bdbce2"}, - {file = "ruff-0.1.1.tar.gz", hash = "sha256:c90461ae4abec261609e5ea436de4a4b5f2822921cf04c16d2cc9327182dbbcc"}, + {file = "ruff-0.1.2-py3-none-macosx_10_7_x86_64.whl", hash = "sha256:0d3ee66b825b713611f89aa35d16de984f76f26c50982a25d52cd0910dff3923"}, + {file = "ruff-0.1.2-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:f85f850a320ff532b8f93e8d1da6a36ef03698c446357c8c43b46ef90bb321eb"}, + {file = "ruff-0.1.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:809c6d4e45683696d19ca79e4c6bd3b2e9204fe9546923f2eb3b126ec314b0dc"}, + {file = "ruff-0.1.2-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:46005e4abb268e93cad065244e17e2ea16b6fcb55a5c473f34fbc1fd01ae34cb"}, + {file = "ruff-0.1.2-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:10cdb302f519664d5e2cf954562ac86c9d20ca05855e5b5c2f9d542228f45da4"}, + {file = "ruff-0.1.2-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:f89ebcbe57a1eab7d7b4ceb57ddf0af9ed13eae24e443a7c1dc078000bd8cc6b"}, + {file = "ruff-0.1.2-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:7344eaca057d4c32373c9c3a7afb7274f56040c225b6193dd495fcf69453b436"}, + {file = "ruff-0.1.2-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:dffa25f6e03c4950b6ac6f216bc0f98a4be9719cb0c5260c8e88d1bac36f1683"}, + {file = "ruff-0.1.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:42ddaea52cb7ba7c785e8593a7532866c193bc774fe570f0e4b1ccedd95b83c5"}, + {file = "ruff-0.1.2-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:a8533efda625bbec0bf27da2886bd641dae0c209104f6c39abc4be5b7b22de2a"}, + {file = "ruff-0.1.2-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:b0b1b82221ba7c50e03b7a86b983157b5d3f4d8d4f16728132bdf02c6d651f77"}, + {file = "ruff-0.1.2-py3-none-musllinux_1_2_i686.whl", hash = "sha256:6c1362eb9288f8cc95535294cb03bd4665c8cef86ec32745476a4e5c6817034c"}, + {file = "ruff-0.1.2-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:ffa7ef5ded0563329a35bd5a1cfdae40f05a75c0cc2dd30f00b1320b1fb461fc"}, + {file = "ruff-0.1.2-py3-none-win32.whl", hash = "sha256:6e8073f85e47072256e2e1909f1ae515cf61ff5a4d24730a63b8b4ac24b6704a"}, + {file = "ruff-0.1.2-py3-none-win_amd64.whl", hash = "sha256:b836ddff662a45385948ee0878b0a04c3a260949905ad861a37b931d6ee1c210"}, + {file = "ruff-0.1.2-py3-none-win_arm64.whl", hash = "sha256:b0c42d00db5639dbd5f7f9923c63648682dd197bf5de1151b595160c96172691"}, + {file = "ruff-0.1.2.tar.gz", hash = "sha256:afd4785ae060ce6edcd52436d0c197628a918d6d09e3107a892a1bad6a4c6608"}, ] [[package]] @@ -3624,4 +3624,4 @@ desktop = ["opencv-python"] [metadata] lock-version = "2.0" python-versions = ">=3.8,<3.12.0" -content-hash = "6702def967f2d487e6c093ba1d4802692059165698734acd5d112c296378216b" +content-hash = "7015859b8447c3b2fac61a26bd6554a89d330c7c40014713273bc3001b05d5e9" diff --git a/pyproject.toml b/pyproject.toml index 3f51674a..d4d6d9ba 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -57,7 +57,7 @@ pytest = "^7.2.2" wheel = "^0.40.0" notebook = "^6.5.3" build = ">=0.10,<1.1" -ruff = ">=0.0.280,<0.1.2" +ruff = ">=0.0.280,<0.1.3" isort = "^5.12.0" black = "^23.7.0" mypy = "^1.4.1" From 22b4444e9ef1e237b66b12d8f026bc3140925cfb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 26 Oct 2023 00:23:12 +0000 Subject: [PATCH 099/164] :arrow_up: Bump black from 23.7.0 to 23.10.1 Bumps [black](https://github.com/psf/black) from 23.7.0 to 23.10.1. - [Release notes](https://github.com/psf/black/releases) - [Changelog](https://github.com/psf/black/blob/main/CHANGES.md) - [Commits](https://github.com/psf/black/compare/23.7.0...23.10.1) --- updated-dependencies: - dependency-name: black dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- poetry.lock | 44 ++++++++++++++++++++------------------------ 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/poetry.lock b/poetry.lock index 369f84cf..5db0c148 100644 --- a/poetry.lock +++ b/poetry.lock @@ -185,33 +185,29 @@ lxml = ["lxml"] [[package]] name = "black" -version = "23.7.0" +version = "23.10.1" description = "The uncompromising code formatter." optional = false python-versions = ">=3.8" files = [ - {file = "black-23.7.0-cp310-cp310-macosx_10_16_arm64.whl", hash = "sha256:5c4bc552ab52f6c1c506ccae05681fab58c3f72d59ae6e6639e8885e94fe2587"}, - {file = "black-23.7.0-cp310-cp310-macosx_10_16_universal2.whl", hash = "sha256:552513d5cd5694590d7ef6f46e1767a4df9af168d449ff767b13b084c020e63f"}, - {file = "black-23.7.0-cp310-cp310-macosx_10_16_x86_64.whl", hash = "sha256:86cee259349b4448adb4ef9b204bb4467aae74a386bce85d56ba4f5dc0da27be"}, - {file = "black-23.7.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:501387a9edcb75d7ae8a4412bb8749900386eaef258f1aefab18adddea1936bc"}, - {file = "black-23.7.0-cp310-cp310-win_amd64.whl", hash = "sha256:fb074d8b213749fa1d077d630db0d5f8cc3b2ae63587ad4116e8a436e9bbe995"}, - {file = "black-23.7.0-cp311-cp311-macosx_10_16_arm64.whl", hash = "sha256:b5b0ee6d96b345a8b420100b7d71ebfdd19fab5e8301aff48ec270042cd40ac2"}, - {file = "black-23.7.0-cp311-cp311-macosx_10_16_universal2.whl", hash = "sha256:893695a76b140881531062d48476ebe4a48f5d1e9388177e175d76234ca247cd"}, - {file = "black-23.7.0-cp311-cp311-macosx_10_16_x86_64.whl", hash = "sha256:c333286dc3ddca6fdff74670b911cccedacb4ef0a60b34e491b8a67c833b343a"}, - {file = "black-23.7.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:831d8f54c3a8c8cf55f64d0422ee875eecac26f5f649fb6c1df65316b67c8926"}, - {file = "black-23.7.0-cp311-cp311-win_amd64.whl", hash = "sha256:7f3bf2dec7d541b4619b8ce526bda74a6b0bffc480a163fed32eb8b3c9aed8ad"}, - {file = "black-23.7.0-cp38-cp38-macosx_10_16_arm64.whl", hash = "sha256:f9062af71c59c004cd519e2fb8f5d25d39e46d3af011b41ab43b9c74e27e236f"}, - {file = "black-23.7.0-cp38-cp38-macosx_10_16_universal2.whl", hash = "sha256:01ede61aac8c154b55f35301fac3e730baf0c9cf8120f65a9cd61a81cfb4a0c3"}, - {file = "black-23.7.0-cp38-cp38-macosx_10_16_x86_64.whl", hash = "sha256:327a8c2550ddc573b51e2c352adb88143464bb9d92c10416feb86b0f5aee5ff6"}, - {file = "black-23.7.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6d1c6022b86f83b632d06f2b02774134def5d4d4f1dac8bef16d90cda18ba28a"}, - {file = "black-23.7.0-cp38-cp38-win_amd64.whl", hash = "sha256:27eb7a0c71604d5de083757fbdb245b1a4fae60e9596514c6ec497eb63f95320"}, - {file = "black-23.7.0-cp39-cp39-macosx_10_16_arm64.whl", hash = "sha256:8417dbd2f57b5701492cd46edcecc4f9208dc75529bcf76c514864e48da867d9"}, - {file = "black-23.7.0-cp39-cp39-macosx_10_16_universal2.whl", hash = "sha256:47e56d83aad53ca140da0af87678fb38e44fd6bc0af71eebab2d1f59b1acf1d3"}, - {file = "black-23.7.0-cp39-cp39-macosx_10_16_x86_64.whl", hash = "sha256:25cc308838fe71f7065df53aedd20327969d05671bac95b38fdf37ebe70ac087"}, - {file = "black-23.7.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:642496b675095d423f9b8448243336f8ec71c9d4d57ec17bf795b67f08132a91"}, - {file = "black-23.7.0-cp39-cp39-win_amd64.whl", hash = "sha256:ad0014efc7acf0bd745792bd0d8857413652979200ab924fbf239062adc12491"}, - {file = "black-23.7.0-py3-none-any.whl", hash = "sha256:9fd59d418c60c0348505f2ddf9609c1e1de8e7493eab96198fc89d9f865e7a96"}, - {file = "black-23.7.0.tar.gz", hash = "sha256:022a582720b0d9480ed82576c920a8c1dde97cc38ff11d8d8859b3bd6ca9eedb"}, + {file = "black-23.10.1-cp310-cp310-macosx_10_16_arm64.whl", hash = "sha256:ec3f8e6234c4e46ff9e16d9ae96f4ef69fa328bb4ad08198c8cee45bb1f08c69"}, + {file = "black-23.10.1-cp310-cp310-macosx_10_16_x86_64.whl", hash = "sha256:1b917a2aa020ca600483a7b340c165970b26e9029067f019e3755b56e8dd5916"}, + {file = "black-23.10.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9c74de4c77b849e6359c6f01987e94873c707098322b91490d24296f66d067dc"}, + {file = "black-23.10.1-cp310-cp310-win_amd64.whl", hash = "sha256:7b4d10b0f016616a0d93d24a448100adf1699712fb7a4efd0e2c32bbb219b173"}, + {file = "black-23.10.1-cp311-cp311-macosx_10_16_arm64.whl", hash = "sha256:b15b75fc53a2fbcac8a87d3e20f69874d161beef13954747e053bca7a1ce53a0"}, + {file = "black-23.10.1-cp311-cp311-macosx_10_16_x86_64.whl", hash = "sha256:e293e4c2f4a992b980032bbd62df07c1bcff82d6964d6c9496f2cd726e246ace"}, + {file = "black-23.10.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7d56124b7a61d092cb52cce34182a5280e160e6aff3137172a68c2c2c4b76bcb"}, + {file = "black-23.10.1-cp311-cp311-win_amd64.whl", hash = "sha256:3f157a8945a7b2d424da3335f7ace89c14a3b0625e6593d21139c2d8214d55ce"}, + {file = "black-23.10.1-cp38-cp38-macosx_10_16_arm64.whl", hash = "sha256:cfcce6f0a384d0da692119f2d72d79ed07c7159879d0bb1bb32d2e443382bf3a"}, + {file = "black-23.10.1-cp38-cp38-macosx_10_16_x86_64.whl", hash = "sha256:33d40f5b06be80c1bbce17b173cda17994fbad096ce60eb22054da021bf933d1"}, + {file = "black-23.10.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:840015166dbdfbc47992871325799fd2dc0dcf9395e401ada6d88fe11498abad"}, + {file = "black-23.10.1-cp38-cp38-win_amd64.whl", hash = "sha256:037e9b4664cafda5f025a1728c50a9e9aedb99a759c89f760bd83730e76ba884"}, + {file = "black-23.10.1-cp39-cp39-macosx_10_16_arm64.whl", hash = "sha256:7cb5936e686e782fddb1c73f8aa6f459e1ad38a6a7b0e54b403f1f05a1507ee9"}, + {file = "black-23.10.1-cp39-cp39-macosx_10_16_x86_64.whl", hash = "sha256:7670242e90dc129c539e9ca17665e39a146a761e681805c54fbd86015c7c84f7"}, + {file = "black-23.10.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5ed45ac9a613fb52dad3b61c8dea2ec9510bf3108d4db88422bacc7d1ba1243d"}, + {file = "black-23.10.1-cp39-cp39-win_amd64.whl", hash = "sha256:6d23d7822140e3fef190734216cefb262521789367fbdc0b3f22af6744058982"}, + {file = "black-23.10.1-py3-none-any.whl", hash = "sha256:d431e6739f727bb2e0495df64a6c7a5310758e87505f5f8cde9ff6c0f2d7e4fe"}, + {file = "black-23.10.1.tar.gz", hash = "sha256:1f8ce316753428ff68749c65a5f7844631aa18c8679dfd3ca9dc1a289979c258"}, ] [package.dependencies] @@ -221,7 +217,7 @@ packaging = ">=22.0" pathspec = ">=0.9.0" platformdirs = ">=2" tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} -typing-extensions = {version = ">=3.10.0.0", markers = "python_version < \"3.10\""} +typing-extensions = {version = ">=4.0.1", markers = "python_version < \"3.11\""} [package.extras] colorama = ["colorama (>=0.4.3)"] From c04129f2b8e3cf728a125b8a0860d1168babcede Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 26 Oct 2023 00:24:09 +0000 Subject: [PATCH 100/164] :arrow_up: Bump pytest from 7.4.2 to 7.4.3 Bumps [pytest](https://github.com/pytest-dev/pytest) from 7.4.2 to 7.4.3. - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest/compare/7.4.2...7.4.3) --- updated-dependencies: - dependency-name: pytest dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- poetry.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/poetry.lock b/poetry.lock index 369f84cf..a90b5808 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2527,13 +2527,13 @@ tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} [[package]] name = "pytest" -version = "7.4.2" +version = "7.4.3" description = "pytest: simple powerful testing with Python" optional = false python-versions = ">=3.7" files = [ - {file = "pytest-7.4.2-py3-none-any.whl", hash = "sha256:1d881c6124e08ff0a1bb75ba3ec0bfd8b5354a01c194ddd5a0a870a48d99b002"}, - {file = "pytest-7.4.2.tar.gz", hash = "sha256:a766259cfab564a2ad52cb1aae1b881a75c3eb7e34ca3779697c23ed47c47069"}, + {file = "pytest-7.4.3-py3-none-any.whl", hash = "sha256:0d009c083ea859a71b76adf7c1d502e4bc170b80a8ef002da5806527b9591fac"}, + {file = "pytest-7.4.3.tar.gz", hash = "sha256:d989d136982de4e3b29dabcc838ad581c64e8ed52c11fbe86ddebd9da0818cd5"}, ] [package.dependencies] From 3356defe9589fb50963eece6d794b9f3b7489a59 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 26 Oct 2023 00:25:05 +0000 Subject: [PATCH 101/164] :arrow_up: Bump pillow from 10.0.1 to 10.1.0 Bumps [pillow](https://github.com/python-pillow/Pillow) from 10.0.1 to 10.1.0. - [Release notes](https://github.com/python-pillow/Pillow/releases) - [Changelog](https://github.com/python-pillow/Pillow/blob/main/CHANGES.rst) - [Commits](https://github.com/python-pillow/Pillow/compare/10.0.1...10.1.0) --- updated-dependencies: - dependency-name: pillow dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- poetry.lock | 110 ++++++++++++++++++++++++++-------------------------- 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/poetry.lock b/poetry.lock index 369f84cf..3339440d 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2215,65 +2215,65 @@ files = [ [[package]] name = "pillow" -version = "10.0.1" +version = "10.1.0" description = "Python Imaging Library (Fork)" optional = false python-versions = ">=3.8" files = [ - {file = "Pillow-10.0.1-cp310-cp310-macosx_10_10_x86_64.whl", hash = "sha256:8f06be50669087250f319b706decf69ca71fdecd829091a37cc89398ca4dc17a"}, - {file = "Pillow-10.0.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:50bd5f1ebafe9362ad622072a1d2f5850ecfa44303531ff14353a4059113b12d"}, - {file = "Pillow-10.0.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e6a90167bcca1216606223a05e2cf991bb25b14695c518bc65639463d7db722d"}, - {file = "Pillow-10.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f11c9102c56ffb9ca87134bd025a43d2aba3f1155f508eff88f694b33a9c6d19"}, - {file = "Pillow-10.0.1-cp310-cp310-manylinux_2_28_aarch64.whl", hash = "sha256:186f7e04248103482ea6354af6d5bcedb62941ee08f7f788a1c7707bc720c66f"}, - {file = "Pillow-10.0.1-cp310-cp310-manylinux_2_28_x86_64.whl", hash = "sha256:0462b1496505a3462d0f35dc1c4d7b54069747d65d00ef48e736acda2c8cbdff"}, - {file = "Pillow-10.0.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:d889b53ae2f030f756e61a7bff13684dcd77e9af8b10c6048fb2c559d6ed6eaf"}, - {file = "Pillow-10.0.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:552912dbca585b74d75279a7570dd29fa43b6d93594abb494ebb31ac19ace6bd"}, - {file = "Pillow-10.0.1-cp310-cp310-win_amd64.whl", hash = "sha256:787bb0169d2385a798888e1122c980c6eff26bf941a8ea79747d35d8f9210ca0"}, - {file = "Pillow-10.0.1-cp311-cp311-macosx_10_10_x86_64.whl", hash = "sha256:fd2a5403a75b54661182b75ec6132437a181209b901446ee5724b589af8edef1"}, - {file = "Pillow-10.0.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:2d7e91b4379f7a76b31c2dda84ab9e20c6220488e50f7822e59dac36b0cd92b1"}, - {file = "Pillow-10.0.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:19e9adb3f22d4c416e7cd79b01375b17159d6990003633ff1d8377e21b7f1b21"}, - {file = "Pillow-10.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:93139acd8109edcdeffd85e3af8ae7d88b258b3a1e13a038f542b79b6d255c54"}, - {file = "Pillow-10.0.1-cp311-cp311-manylinux_2_28_aarch64.whl", hash = "sha256:92a23b0431941a33242b1f0ce6c88a952e09feeea9af4e8be48236a68ffe2205"}, - {file = "Pillow-10.0.1-cp311-cp311-manylinux_2_28_x86_64.whl", hash = "sha256:cbe68deb8580462ca0d9eb56a81912f59eb4542e1ef8f987405e35a0179f4ea2"}, - {file = "Pillow-10.0.1-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:522ff4ac3aaf839242c6f4e5b406634bfea002469656ae8358644fc6c4856a3b"}, - {file = "Pillow-10.0.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:84efb46e8d881bb06b35d1d541aa87f574b58e87f781cbba8d200daa835b42e1"}, - {file = "Pillow-10.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:898f1d306298ff40dc1b9ca24824f0488f6f039bc0e25cfb549d3195ffa17088"}, - {file = "Pillow-10.0.1-cp312-cp312-macosx_10_10_x86_64.whl", hash = "sha256:bcf1207e2f2385a576832af02702de104be71301c2696d0012b1b93fe34aaa5b"}, - {file = "Pillow-10.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:5d6c9049c6274c1bb565021367431ad04481ebb54872edecfcd6088d27edd6ed"}, - {file = "Pillow-10.0.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:28444cb6ad49726127d6b340217f0627abc8732f1194fd5352dec5e6a0105635"}, - {file = "Pillow-10.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:de596695a75496deb3b499c8c4f8e60376e0516e1a774e7bc046f0f48cd620ad"}, - {file = "Pillow-10.0.1-cp312-cp312-manylinux_2_28_aarch64.whl", hash = "sha256:2872f2d7846cf39b3dbff64bc1104cc48c76145854256451d33c5faa55c04d1a"}, - {file = "Pillow-10.0.1-cp312-cp312-manylinux_2_28_x86_64.whl", hash = "sha256:4ce90f8a24e1c15465048959f1e94309dfef93af272633e8f37361b824532e91"}, - {file = "Pillow-10.0.1-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:ee7810cf7c83fa227ba9125de6084e5e8b08c59038a7b2c9045ef4dde61663b4"}, - {file = "Pillow-10.0.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:b1be1c872b9b5fcc229adeadbeb51422a9633abd847c0ff87dc4ef9bb184ae08"}, - {file = "Pillow-10.0.1-cp312-cp312-win_amd64.whl", hash = "sha256:98533fd7fa764e5f85eebe56c8e4094db912ccbe6fbf3a58778d543cadd0db08"}, - {file = "Pillow-10.0.1-cp38-cp38-macosx_10_10_x86_64.whl", hash = "sha256:764d2c0daf9c4d40ad12fbc0abd5da3af7f8aa11daf87e4fa1b834000f4b6b0a"}, - {file = "Pillow-10.0.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:fcb59711009b0168d6ee0bd8fb5eb259c4ab1717b2f538bbf36bacf207ef7a68"}, - {file = "Pillow-10.0.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:697a06bdcedd473b35e50a7e7506b1d8ceb832dc238a336bd6f4f5aa91a4b500"}, - {file = "Pillow-10.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9f665d1e6474af9f9da5e86c2a3a2d2d6204e04d5af9c06b9d42afa6ebde3f21"}, - {file = "Pillow-10.0.1-cp38-cp38-manylinux_2_28_aarch64.whl", hash = "sha256:2fa6dd2661838c66f1a5473f3b49ab610c98a128fc08afbe81b91a1f0bf8c51d"}, - {file = "Pillow-10.0.1-cp38-cp38-manylinux_2_28_x86_64.whl", hash = "sha256:3a04359f308ebee571a3127fdb1bd01f88ba6f6fb6d087f8dd2e0d9bff43f2a7"}, - {file = "Pillow-10.0.1-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:723bd25051454cea9990203405fa6b74e043ea76d4968166dfd2569b0210886a"}, - {file = "Pillow-10.0.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:71671503e3015da1b50bd18951e2f9daf5b6ffe36d16f1eb2c45711a301521a7"}, - {file = "Pillow-10.0.1-cp38-cp38-win_amd64.whl", hash = "sha256:44e7e4587392953e5e251190a964675f61e4dae88d1e6edbe9f36d6243547ff3"}, - {file = "Pillow-10.0.1-cp39-cp39-macosx_10_10_x86_64.whl", hash = "sha256:3855447d98cced8670aaa63683808df905e956f00348732448b5a6df67ee5849"}, - {file = "Pillow-10.0.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:ed2d9c0704f2dc4fa980b99d565c0c9a543fe5101c25b3d60488b8ba80f0cce1"}, - {file = "Pillow-10.0.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f5bb289bb835f9fe1a1e9300d011eef4d69661bb9b34d5e196e5e82c4cb09b37"}, - {file = "Pillow-10.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3a0d3e54ab1df9df51b914b2233cf779a5a10dfd1ce339d0421748232cea9876"}, - {file = "Pillow-10.0.1-cp39-cp39-manylinux_2_28_aarch64.whl", hash = "sha256:2cc6b86ece42a11f16f55fe8903595eff2b25e0358dec635d0a701ac9586588f"}, - {file = "Pillow-10.0.1-cp39-cp39-manylinux_2_28_x86_64.whl", hash = "sha256:ca26ba5767888c84bf5a0c1a32f069e8204ce8c21d00a49c90dabeba00ce0145"}, - {file = "Pillow-10.0.1-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:f0b4b06da13275bc02adfeb82643c4a6385bd08d26f03068c2796f60d125f6f2"}, - {file = "Pillow-10.0.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:bc2e3069569ea9dbe88d6b8ea38f439a6aad8f6e7a6283a38edf61ddefb3a9bf"}, - {file = "Pillow-10.0.1-cp39-cp39-win_amd64.whl", hash = "sha256:8b451d6ead6e3500b6ce5c7916a43d8d8d25ad74b9102a629baccc0808c54971"}, - {file = "Pillow-10.0.1-pp310-pypy310_pp73-macosx_10_10_x86_64.whl", hash = "sha256:32bec7423cdf25c9038fef614a853c9d25c07590e1a870ed471f47fb80b244db"}, - {file = "Pillow-10.0.1-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b7cf63d2c6928b51d35dfdbda6f2c1fddbe51a6bc4a9d4ee6ea0e11670dd981e"}, - {file = "Pillow-10.0.1-pp310-pypy310_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:f6d3d4c905e26354e8f9d82548475c46d8e0889538cb0657aa9c6f0872a37aa4"}, - {file = "Pillow-10.0.1-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:847e8d1017c741c735d3cd1883fa7b03ded4f825a6e5fcb9378fd813edee995f"}, - {file = "Pillow-10.0.1-pp39-pypy39_pp73-macosx_10_10_x86_64.whl", hash = "sha256:7f771e7219ff04b79e231d099c0a28ed83aa82af91fd5fa9fdb28f5b8d5addaf"}, - {file = "Pillow-10.0.1-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:459307cacdd4138edee3875bbe22a2492519e060660eaf378ba3b405d1c66317"}, - {file = "Pillow-10.0.1-pp39-pypy39_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:b059ac2c4c7a97daafa7dc850b43b2d3667def858a4f112d1aa082e5c3d6cf7d"}, - {file = "Pillow-10.0.1-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:d6caf3cd38449ec3cd8a68b375e0c6fe4b6fd04edb6c9766b55ef84a6e8ddf2d"}, - {file = "Pillow-10.0.1.tar.gz", hash = "sha256:d72967b06be9300fed5cfbc8b5bafceec48bf7cdc7dab66b1d2549035287191d"}, + {file = "Pillow-10.1.0-cp310-cp310-macosx_10_10_x86_64.whl", hash = "sha256:1ab05f3db77e98f93964697c8efc49c7954b08dd61cff526b7f2531a22410106"}, + {file = "Pillow-10.1.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:6932a7652464746fcb484f7fc3618e6503d2066d853f68a4bd97193a3996e273"}, + {file = "Pillow-10.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a5f63b5a68daedc54c7c3464508d8c12075e56dcfbd42f8c1bf40169061ae666"}, + {file = "Pillow-10.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c0949b55eb607898e28eaccb525ab104b2d86542a85c74baf3a6dc24002edec2"}, + {file = "Pillow-10.1.0-cp310-cp310-manylinux_2_28_aarch64.whl", hash = "sha256:ae88931f93214777c7a3aa0a8f92a683f83ecde27f65a45f95f22d289a69e593"}, + {file = "Pillow-10.1.0-cp310-cp310-manylinux_2_28_x86_64.whl", hash = "sha256:b0eb01ca85b2361b09480784a7931fc648ed8b7836f01fb9241141b968feb1db"}, + {file = "Pillow-10.1.0-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:d27b5997bdd2eb9fb199982bb7eb6164db0426904020dc38c10203187ae2ff2f"}, + {file = "Pillow-10.1.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:7df5608bc38bd37ef585ae9c38c9cd46d7c81498f086915b0f97255ea60c2818"}, + {file = "Pillow-10.1.0-cp310-cp310-win_amd64.whl", hash = "sha256:41f67248d92a5e0a2076d3517d8d4b1e41a97e2df10eb8f93106c89107f38b57"}, + {file = "Pillow-10.1.0-cp311-cp311-macosx_10_10_x86_64.whl", hash = "sha256:1fb29c07478e6c06a46b867e43b0bcdb241b44cc52be9bc25ce5944eed4648e7"}, + {file = "Pillow-10.1.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:2cdc65a46e74514ce742c2013cd4a2d12e8553e3a2563c64879f7c7e4d28bce7"}, + {file = "Pillow-10.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:50d08cd0a2ecd2a8657bd3d82c71efd5a58edb04d9308185d66c3a5a5bed9610"}, + {file = "Pillow-10.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:062a1610e3bc258bff2328ec43f34244fcec972ee0717200cb1425214fe5b839"}, + {file = "Pillow-10.1.0-cp311-cp311-manylinux_2_28_aarch64.whl", hash = "sha256:61f1a9d247317fa08a308daaa8ee7b3f760ab1809ca2da14ecc88ae4257d6172"}, + {file = "Pillow-10.1.0-cp311-cp311-manylinux_2_28_x86_64.whl", hash = "sha256:a646e48de237d860c36e0db37ecaecaa3619e6f3e9d5319e527ccbc8151df061"}, + {file = "Pillow-10.1.0-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:47e5bf85b80abc03be7455c95b6d6e4896a62f6541c1f2ce77a7d2bb832af262"}, + {file = "Pillow-10.1.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:a92386125e9ee90381c3369f57a2a50fa9e6aa8b1cf1d9c4b200d41a7dd8e992"}, + {file = "Pillow-10.1.0-cp311-cp311-win_amd64.whl", hash = "sha256:0f7c276c05a9767e877a0b4c5050c8bee6a6d960d7f0c11ebda6b99746068c2a"}, + {file = "Pillow-10.1.0-cp312-cp312-macosx_10_10_x86_64.whl", hash = "sha256:a89b8312d51715b510a4fe9fc13686283f376cfd5abca8cd1c65e4c76e21081b"}, + {file = "Pillow-10.1.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:00f438bb841382b15d7deb9a05cc946ee0f2c352653c7aa659e75e592f6fa17d"}, + {file = "Pillow-10.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3d929a19f5469b3f4df33a3df2983db070ebb2088a1e145e18facbc28cae5b27"}, + {file = "Pillow-10.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9a92109192b360634a4489c0c756364c0c3a2992906752165ecb50544c251312"}, + {file = "Pillow-10.1.0-cp312-cp312-manylinux_2_28_aarch64.whl", hash = "sha256:0248f86b3ea061e67817c47ecbe82c23f9dd5d5226200eb9090b3873d3ca32de"}, + {file = "Pillow-10.1.0-cp312-cp312-manylinux_2_28_x86_64.whl", hash = "sha256:9882a7451c680c12f232a422730f986a1fcd808da0fd428f08b671237237d651"}, + {file = "Pillow-10.1.0-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:1c3ac5423c8c1da5928aa12c6e258921956757d976405e9467c5f39d1d577a4b"}, + {file = "Pillow-10.1.0-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:806abdd8249ba3953c33742506fe414880bad78ac25cc9a9b1c6ae97bedd573f"}, + {file = "Pillow-10.1.0-cp312-cp312-win_amd64.whl", hash = "sha256:eaed6977fa73408b7b8a24e8b14e59e1668cfc0f4c40193ea7ced8e210adf996"}, + {file = "Pillow-10.1.0-cp38-cp38-macosx_10_10_x86_64.whl", hash = "sha256:fe1e26e1ffc38be097f0ba1d0d07fcade2bcfd1d023cda5b29935ae8052bd793"}, + {file = "Pillow-10.1.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:7a7e3daa202beb61821c06d2517428e8e7c1aab08943e92ec9e5755c2fc9ba5e"}, + {file = "Pillow-10.1.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:24fadc71218ad2b8ffe437b54876c9382b4a29e030a05a9879f615091f42ffc2"}, + {file = "Pillow-10.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fa1d323703cfdac2036af05191b969b910d8f115cf53093125e4058f62012c9a"}, + {file = "Pillow-10.1.0-cp38-cp38-manylinux_2_28_aarch64.whl", hash = "sha256:912e3812a1dbbc834da2b32299b124b5ddcb664ed354916fd1ed6f193f0e2d01"}, + {file = "Pillow-10.1.0-cp38-cp38-manylinux_2_28_x86_64.whl", hash = "sha256:7dbaa3c7de82ef37e7708521be41db5565004258ca76945ad74a8e998c30af8d"}, + {file = "Pillow-10.1.0-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:9d7bc666bd8c5a4225e7ac71f2f9d12466ec555e89092728ea0f5c0c2422ea80"}, + {file = "Pillow-10.1.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:baada14941c83079bf84c037e2d8b7506ce201e92e3d2fa0d1303507a8538212"}, + {file = "Pillow-10.1.0-cp38-cp38-win_amd64.whl", hash = "sha256:2ef6721c97894a7aa77723740a09547197533146fba8355e86d6d9a4a1056b14"}, + {file = "Pillow-10.1.0-cp39-cp39-macosx_10_10_x86_64.whl", hash = "sha256:0a026c188be3b443916179f5d04548092e253beb0c3e2ee0a4e2cdad72f66099"}, + {file = "Pillow-10.1.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:04f6f6149f266a100374ca3cc368b67fb27c4af9f1cc8cb6306d849dcdf12616"}, + {file = "Pillow-10.1.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bb40c011447712d2e19cc261c82655f75f32cb724788df315ed992a4d65696bb"}, + {file = "Pillow-10.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1a8413794b4ad9719346cd9306118450b7b00d9a15846451549314a58ac42219"}, + {file = "Pillow-10.1.0-cp39-cp39-manylinux_2_28_aarch64.whl", hash = "sha256:c9aeea7b63edb7884b031a35305629a7593272b54f429a9869a4f63a1bf04c34"}, + {file = "Pillow-10.1.0-cp39-cp39-manylinux_2_28_x86_64.whl", hash = "sha256:b4005fee46ed9be0b8fb42be0c20e79411533d1fd58edabebc0dd24626882cfd"}, + {file = "Pillow-10.1.0-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:4d0152565c6aa6ebbfb1e5d8624140a440f2b99bf7afaafbdbf6430426497f28"}, + {file = "Pillow-10.1.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:d921bc90b1defa55c9917ca6b6b71430e4286fc9e44c55ead78ca1a9f9eba5f2"}, + {file = "Pillow-10.1.0-cp39-cp39-win_amd64.whl", hash = "sha256:cfe96560c6ce2f4c07d6647af2d0f3c54cc33289894ebd88cfbb3bcd5391e256"}, + {file = "Pillow-10.1.0-pp310-pypy310_pp73-macosx_10_10_x86_64.whl", hash = "sha256:937bdc5a7f5343d1c97dc98149a0be7eb9704e937fe3dc7140e229ae4fc572a7"}, + {file = "Pillow-10.1.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b1c25762197144e211efb5f4e8ad656f36c8d214d390585d1d21281f46d556ba"}, + {file = "Pillow-10.1.0-pp310-pypy310_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:afc8eef765d948543a4775f00b7b8c079b3321d6b675dde0d02afa2ee23000b4"}, + {file = "Pillow-10.1.0-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:883f216eac8712b83a63f41b76ddfb7b2afab1b74abbb413c5df6680f071a6b9"}, + {file = "Pillow-10.1.0-pp39-pypy39_pp73-macosx_10_10_x86_64.whl", hash = "sha256:b920e4d028f6442bea9a75b7491c063f0b9a3972520731ed26c83e254302eb1e"}, + {file = "Pillow-10.1.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1c41d960babf951e01a49c9746f92c5a7e0d939d1652d7ba30f6b3090f27e412"}, + {file = "Pillow-10.1.0-pp39-pypy39_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:1fafabe50a6977ac70dfe829b2d5735fd54e190ab55259ec8aea4aaea412fa0b"}, + {file = "Pillow-10.1.0-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:3b834f4b16173e5b92ab6566f0473bfb09f939ba14b23b8da1f54fa63e4b623f"}, + {file = "Pillow-10.1.0.tar.gz", hash = "sha256:e6bf8de6c36ed96c86ea3b6e1d5273c53f46ef518a062464cd7ef5dd2cf92e38"}, ] [package.extras] From 82e35479e7a4374667e7d9e5159c75b3b4a29775 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 26 Oct 2023 00:26:40 +0000 Subject: [PATCH 102/164] :arrow_up: Bump flake8 from 6.0.0 to 6.1.0 Bumps [flake8](https://github.com/pycqa/flake8) from 6.0.0 to 6.1.0. - [Commits](https://github.com/pycqa/flake8/compare/6.0.0...6.1.0) --- updated-dependencies: - dependency-name: flake8 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- poetry.lock | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/poetry.lock b/poetry.lock index 369f84cf..e34b1fe6 100644 --- a/poetry.lock +++ b/poetry.lock @@ -745,19 +745,19 @@ testing = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "diff-cover (>=7.5)", "p [[package]] name = "flake8" -version = "6.0.0" +version = "6.1.0" description = "the modular source code checker: pep8 pyflakes and co" optional = false python-versions = ">=3.8.1" files = [ - {file = "flake8-6.0.0-py2.py3-none-any.whl", hash = "sha256:3833794e27ff64ea4e9cf5d410082a8b97ff1a06c16aa3d2027339cd0f1195c7"}, - {file = "flake8-6.0.0.tar.gz", hash = "sha256:c61007e76655af75e6785a931f452915b371dc48f56efd765247c8fe68f2b181"}, + {file = "flake8-6.1.0-py2.py3-none-any.whl", hash = "sha256:ffdfce58ea94c6580c77888a86506937f9a1a227dfcd15f245d694ae20a6b6e5"}, + {file = "flake8-6.1.0.tar.gz", hash = "sha256:d5b3857f07c030bdb5bf41c7f53799571d75c4491748a3adcd47de929e34cd23"}, ] [package.dependencies] mccabe = ">=0.7.0,<0.8.0" -pycodestyle = ">=2.10.0,<2.11.0" -pyflakes = ">=3.0.0,<3.1.0" +pycodestyle = ">=2.11.0,<2.12.0" +pyflakes = ">=3.1.0,<3.2.0" [[package]] name = "fonttools" @@ -2434,13 +2434,13 @@ tests = ["pytest"] [[package]] name = "pycodestyle" -version = "2.10.0" +version = "2.11.1" description = "Python style guide checker" optional = false -python-versions = ">=3.6" +python-versions = ">=3.8" files = [ - {file = "pycodestyle-2.10.0-py2.py3-none-any.whl", hash = "sha256:8a4eaf0d0495c7395bdab3589ac2db602797d76207242c17d470186815706610"}, - {file = "pycodestyle-2.10.0.tar.gz", hash = "sha256:347187bdb476329d98f695c213d7295a846d1152ff4fe9bacb8a9590b8ee7053"}, + {file = "pycodestyle-2.11.1-py2.py3-none-any.whl", hash = "sha256:44fe31000b2d866f2e41841b18528a505fbd7fef9017b04eff4e2648a0fadc67"}, + {file = "pycodestyle-2.11.1.tar.gz", hash = "sha256:41ba0e7afc9752dfb53ced5489e89f8186be00e599e712660695b7a75ff2663f"}, ] [[package]] @@ -2456,13 +2456,13 @@ files = [ [[package]] name = "pyflakes" -version = "3.0.1" +version = "3.1.0" description = "passive checker of Python programs" optional = false -python-versions = ">=3.6" +python-versions = ">=3.8" files = [ - {file = "pyflakes-3.0.1-py2.py3-none-any.whl", hash = "sha256:ec55bf7fe21fff7f1ad2f7da62363d749e2a470500eab1b555334b67aa1ef8cf"}, - {file = "pyflakes-3.0.1.tar.gz", hash = "sha256:ec8b276a6b60bd80defed25add7e439881c19e64850afd9b346283d4165fd0fd"}, + {file = "pyflakes-3.1.0-py2.py3-none-any.whl", hash = "sha256:4132f6d49cb4dae6819e5379898f2b8cce3c5f23994194c24b77d5da2e36f774"}, + {file = "pyflakes-3.1.0.tar.gz", hash = "sha256:a0aae034c444db0071aa077972ba4768d40c830d9539fd45bf4cd3f8f6992efc"}, ] [[package]] From 769f97cd7df130fa614f03cd0048b569623dbb5a Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Sat, 28 Oct 2023 01:12:09 +0200 Subject: [PATCH 103/164] Update object tracking documentation Revise the contents of the 'How to Track Objects' documentation covering the use of supervision for object tracking in video analysis. The revision offers a more detailed guide, including running inference, tracking objects, annotating videos with unique tracking IDs, and annotating videos with traces. The new guide provides a structured walkthrough and tutorial on using Supervision's functionalities, aimed at helping users to annotate videos more effectively and understand the movement patterns and interactions of objects in the videos. --- docs/how_to/track_objects.md | 231 ++++++++++++++++++++++++++--------- 1 file changed, 173 insertions(+), 58 deletions(-) diff --git a/docs/how_to/track_objects.md b/docs/how_to/track_objects.md index 8a2efbdf..f8b40cc6 100644 --- a/docs/how_to/track_objects.md +++ b/docs/how_to/track_objects.md @@ -1,68 +1,183 @@ -## How To: Track Objects -This is a tutorial to track object in a video using [ByteTrack](https://supervision.roboflow.com/trackers/#supervision.tracker.byte_tracker.core.ByteTrack). -### What is Tracking? -Tracking is an essential application of computer vision, which is used in mainly in videos or set of images which contain a sequence of events(the set of images could be simply frames of a video). It takes an initial set of detections from a video as per the requirement of the project, provides some unique identification to the detections and tracks as the position changes with time in a video. Supervision provides some powerful tools to track object in videos. This tutorial would cover how to make detections in a video, track those detections and then label them for unique identification using Supervision. Further, it would also cover how to trace the path covered by the detections. -Before proceeding remember to install Supervision: -``` -pip install supervision -``` -and import it: -``` -import supervision as sv -``` -### Step 1:Building a detection pipeline for videos -First to track objects we need to load the data and make it usable. We are going to do it by generating the frames from the video and using an object detection model, using [sv.get_video_frames_generator()](https://supervision.roboflow.com/utils/video/#get_video_frames_generator). In this tutorial we are going to do it using YOLOv8. -First install ultralytics, import it and initialize the frame_generator. -``` -pip install ultralytics -``` -``` -from ultralytics import YOLO -model = YOLO(...) -frame_generator = sv.get_video_frames_generator(source_path=source_video_path) -``` -Replace '...' with the path of v8 model -### Step 2:Tracking the detections -To track the detections we are going to use [ByteTrack](https://supervision.roboflow.com/trackers/#supervision.tracker.byte_tracker.core.ByteTrack). Further, the detections in each frame are going tbe passed into [sv.Detections.from_ultralytics()](https://supervision.roboflow.com/detection/core/), whose output would be passed on to ByteTrack. -``` -tracker = sv.ByteTrack() +Utilize Supervision to elevate your video analysis capabilities by effortlessly +[tracking](https://supervision.roboflow.com/trackers/) objects identified by various +object detection and segmentation models. This guide will walk you through the process +of running inference using the [Ultralytics](https://github.com/ultralytics/ultralytics) +YOLOv8 model, subsequently tracking these objects, and annotating the video. -for frame in frame_generator: +To make it easier for you to follow our tutorial download the video we will use as an +example. You can do this using +[`supervision[assets]`](https://supervision.roboflow.com/assets/) extension. + +```python +from supervision.assets import download_assets, VideoAssets + +download_assets(VideoAssets.PEOPLE_WALKING) +``` + + + +## Run Inference + +First, you'll need to obtain predictions from your object detection or segmentation +model. In this tutorial, we are using the YOLOv8 model as an example. However, +Supervision is versatile and compatible with various models. Check this +[link](https://supervision.roboflow.com/how_to/detect_and_annotate/#load-predictions-into-supervision) +for guidance on how to plug in other models. + +We will define a `callback` function, which will process each frame of the video +by obtaining model predictions and then annotating the frame based on these predictions. +This `callback` function will be essential in the subsequent steps of the tutorial, as +it will be modified to include tracking, labeling, and trace annotations. + +```{ .py } +import numpy as np +import supervision as sv +from ultralytics import YOLO + +model = YOLO("yolov8n.pt") +box_annotator = sv.BoundingBoxAnnotator() + +def callback(frame: np.ndarray, _: int) -> np.ndarray: + results = model(frame)[0] + detections = sv.Detections.from_ultralytics(results) + return box_annotator.annotate(frame.copy(), detections=detections) + +sv.process_video( + source_path="people-walking.mp4", + target_path="result.mp4", + callback=callback +) +``` + + + +## Tracking + +After running inference and obtaining predictions, the next step is to track the +detected objects throughout the video. Utilizing Supervision’s +[`sv.ByteTrack`](https://supervision.roboflow.com/trackers/#supervision.tracker.byte_tracker.core.ByteTrack) +functionality, each detected object is assigned a unique tracker ID, +enabling the continuous following of the object's motion path across different frames. + +```{ .py hl_lines="6 12" } +import numpy as np +import supervision as sv +from ultralytics import YOLO + +model = YOLO("yolov8n.pt") +tracker = sv.ByteTrack() +box_annotator = sv.BoundingBoxAnnotator() + +def callback(frame: np.ndarray, _: int) -> np.ndarray: results = model(frame)[0] detections = sv.Detections.from_ultralytics(results) detections = tracker.update_with_detections(detections) -``` -### Step 3:Label the detections being tracked -The objects being tracked can be annotated with any [annotator provided by supervision](https://supervision.roboflow.com/annotators/#labelannotator). But, we are going to use label annotator and label the object being tracked with their tracking ids. -``` -label_annotator = sv.LabelAnnotator(text_position=sv.Position.CENTER) + return box_annotator.annotate(frame.copy(), detections=detections) -``` -### Step 4:Tracing the path of the detections -Further, the path of the tracked objects can be traced using [TraceAnnotator](https://supervision.roboflow.com/annotators/#traceannotator) of supervision. To use tracce annotator ensure that the same detections remain in all the frames of the video. +sv.process_video( + source_path="people-walking.mp4", + target_path="result.mp4", + callback=callback +) ``` -label_annotator = sv.LabelAnnotator(text_position=sv.Position.CENTER) -trace_annotator = sv.TraceAnnotator() -``` -### Step 5:Integrating the previous steps and processing the video -At the end, we want to see the output on our video. In order to do that, we'll be passing the annotations from previous iterations into a callback to be used by [sv.process_video](https://supervision.roboflow.com/utils/video/#process_video). -``` +## Annotate Video with Tracking IDs + +Annotating the video with tracking IDs helps in distinguishing and following each object +distinctly. With the +[`sv.LabelAnnotator`](https://supervision.roboflow.com/annotators/#supervision.annotators.core.LabelAnnotator) +in Supervision, we can overlay the tracker IDs and class labels on the detected objects, +offering a clear visual representation of each object's class and unique identifier. + +```{ .py hl_lines="8 15-19 23-24" } +import numpy as np +import supervision as sv from ultralytics import YOLO -model = YOLO(...) ##We YOLO('yolov8n.pt') -frame_generator = sv.get_video_frames_generator(source_path=source_video_path) + +model = YOLO("yolov8n.pt") tracker = sv.ByteTrack() -label_annotator = sv.LabelAnnotator(text_position=sv.Position.CENTER) -trace_annotator = sv.TraceAnnotator() -def callback(frame: np.ndarray, index: int) -> np.ndarray: - results = model(frame)[0] - detections = sv.Detections.from_ultralytics(results) - detections = tracker.update_with_detections(detections) - labels = f"{detections.tracker_id}" - label_annotator.annotate(scene=frame, detections=detections, labels=labels) - return trace_annotator.annotate(scene=frame, detections=detections) -sv.process_video(source_path=VIDEO_PATH, target_path=f"result.mp4", callback=process_frame) +box_annotator = sv.BoundingBoxAnnotator() +label_annotator = sv.LabelAnnotator() + +def callback(frame: np.ndarray, _: int) -> np.ndarray: + results = model(frame)[0] + detections = sv.Detections.from_ultralytics(results) + detections = tracker.update_with_detections(detections) + + labels = [ + f"#{tracker_id} {results.names[class_id]}" + for class_id, tracker_id + in zip(detections.class_id, detections.tracker_id) + ] + + annotated_frame = box_annotator.annotate( + frame.copy(), detections=detections) + return label_annotator.annotate( + annotated_frame, detections=detections, labels=labels) + +sv.process_video( + source_path="people-walking.mp4", + target_path="result.mp4", + callback=callback +) ``` -Check out this [video](https://drive.google.com/file/d/10xaHXz9rpdXkaRni9YzOihhF3S7-Zs4p/view?usp=sharing) to see the end results. -### Conclusion and further ideas -This brings us to the end of the tutorial. The users are strongly encouraged to try out other models for detection and play around with annotators. Check out this [post](https://blog.roboflow.com/yolov8-tracking-and-counting/#object-tracking-with-bytetrack)("Piotr Skalski." Roboflow Blog, Feb 1, 2023. https://blog.roboflow.com/yolov8-tracking-and-counting/) for some more cool stuff. The post was quite useful creation of this tutorial. + + + +## Annotate Video with Traces + +Adding traces to the video involves overlaying the historical paths of the detected +objects. This feature, powered by the +[`sv.TraceAnnotator`](https://supervision.roboflow.com/annotators/#supervision.annotators.core.TraceAnnotator), +allows for visualizing the trajectories of objects, helping in understanding the +movement patterns and interactions between objects in the video. + +```{ .py hl_lines="9 26-27" } +import numpy as np +import supervision as sv +from ultralytics import YOLO + +model = YOLO("yolov8n.pt") +tracker = sv.ByteTrack() +box_annotator = sv.BoundingBoxAnnotator() +label_annotator = sv.LabelAnnotator() +trace_annotator = sv.TraceAnnotator() + +def callback(frame: np.ndarray, _: int) -> np.ndarray: + results = model(frame)[0] + detections = sv.Detections.from_ultralytics(results) + detections = tracker.update_with_detections(detections) + + labels = [ + f"#{tracker_id} {results.names[class_id]}" + for class_id, tracker_id + in zip(detections.class_id, detections.tracker_id) + ] + + annotated_frame = box_annotator.annotate( + frame.copy(), detections=detections) + annotated_frame = label_annotator.annotate( + annotated_frame, detections=detections, labels=labels) + return trace_annotator.annotate( + annotated_frame, detections=detections) + +sv.process_video( + source_path="people-walking.mp4", + target_path="result.mp4", + callback=callback +) +``` + + + +This structured walkthrough should give a detailed pathway to annotate videos +effectively using Supervision’s various functionalities, including object tracking and +trace annotations. \ No newline at end of file From 21fe102bbd4990957d18efa110df2a35c6db28c1 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 27 Oct 2023 23:12:25 +0000 Subject: [PATCH 104/164] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/how_to/track_objects.md | 52 ++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/docs/how_to/track_objects.md b/docs/how_to/track_objects.md index f8b40cc6..ea48b070 100644 --- a/docs/how_to/track_objects.md +++ b/docs/how_to/track_objects.md @@ -1,11 +1,11 @@ -Utilize Supervision to elevate your video analysis capabilities by effortlessly -[tracking](https://supervision.roboflow.com/trackers/) objects identified by various -object detection and segmentation models. This guide will walk you through the process +Utilize Supervision to elevate your video analysis capabilities by effortlessly +[tracking](https://supervision.roboflow.com/trackers/) objects identified by various +object detection and segmentation models. This guide will walk you through the process of running inference using the [Ultralytics](https://github.com/ultralytics/ultralytics) YOLOv8 model, subsequently tracking these objects, and annotating the video. -To make it easier for you to follow our tutorial download the video we will use as an -example. You can do this using +To make it easier for you to follow our tutorial download the video we will use as an +example. You can do this using [`supervision[assets]`](https://supervision.roboflow.com/assets/) extension. ```python @@ -20,15 +20,15 @@ download_assets(VideoAssets.PEOPLE_WALKING) ## Run Inference -First, you'll need to obtain predictions from your object detection or segmentation -model. In this tutorial, we are using the YOLOv8 model as an example. However, -Supervision is versatile and compatible with various models. Check this -[link](https://supervision.roboflow.com/how_to/detect_and_annotate/#load-predictions-into-supervision) +First, you'll need to obtain predictions from your object detection or segmentation +model. In this tutorial, we are using the YOLOv8 model as an example. However, +Supervision is versatile and compatible with various models. Check this +[link](https://supervision.roboflow.com/how_to/detect_and_annotate/#load-predictions-into-supervision) for guidance on how to plug in other models. We will define a `callback` function, which will process each frame of the video by obtaining model predictions and then annotating the frame based on these predictions. -This `callback` function will be essential in the subsequent steps of the tutorial, as +This `callback` function will be essential in the subsequent steps of the tutorial, as it will be modified to include tracking, labeling, and trace annotations. ```{ .py } @@ -57,10 +57,10 @@ sv.process_video( ## Tracking -After running inference and obtaining predictions, the next step is to track the -detected objects throughout the video. Utilizing Supervision’s -[`sv.ByteTrack`](https://supervision.roboflow.com/trackers/#supervision.tracker.byte_tracker.core.ByteTrack) -functionality, each detected object is assigned a unique tracker ID, +After running inference and obtaining predictions, the next step is to track the +detected objects throughout the video. Utilizing Supervision’s +[`sv.ByteTrack`](https://supervision.roboflow.com/trackers/#supervision.tracker.byte_tracker.core.ByteTrack) +functionality, each detected object is assigned a unique tracker ID, enabling the continuous following of the object's motion path across different frames. ```{ .py hl_lines="6 12" } @@ -88,8 +88,8 @@ sv.process_video( ## Annotate Video with Tracking IDs Annotating the video with tracking IDs helps in distinguishing and following each object -distinctly. With the -[`sv.LabelAnnotator`](https://supervision.roboflow.com/annotators/#supervision.annotators.core.LabelAnnotator) +distinctly. With the +[`sv.LabelAnnotator`](https://supervision.roboflow.com/annotators/#supervision.annotators.core.LabelAnnotator) in Supervision, we can overlay the tracker IDs and class labels on the detected objects, offering a clear visual representation of each object's class and unique identifier. @@ -107,13 +107,13 @@ def callback(frame: np.ndarray, _: int) -> np.ndarray: results = model(frame)[0] detections = sv.Detections.from_ultralytics(results) detections = tracker.update_with_detections(detections) - + labels = [ f"#{tracker_id} {results.names[class_id]}" for class_id, tracker_id in zip(detections.class_id, detections.tracker_id) ] - + annotated_frame = box_annotator.annotate( frame.copy(), detections=detections) return label_annotator.annotate( @@ -132,10 +132,10 @@ sv.process_video( ## Annotate Video with Traces -Adding traces to the video involves overlaying the historical paths of the detected -objects. This feature, powered by the +Adding traces to the video involves overlaying the historical paths of the detected +objects. This feature, powered by the [`sv.TraceAnnotator`](https://supervision.roboflow.com/annotators/#supervision.annotators.core.TraceAnnotator), -allows for visualizing the trajectories of objects, helping in understanding the +allows for visualizing the trajectories of objects, helping in understanding the movement patterns and interactions between objects in the video. ```{ .py hl_lines="9 26-27" } @@ -153,13 +153,13 @@ def callback(frame: np.ndarray, _: int) -> np.ndarray: results = model(frame)[0] detections = sv.Detections.from_ultralytics(results) detections = tracker.update_with_detections(detections) - + labels = [ f"#{tracker_id} {results.names[class_id]}" for class_id, tracker_id in zip(detections.class_id, detections.tracker_id) ] - + annotated_frame = box_annotator.annotate( frame.copy(), detections=detections) annotated_frame = label_annotator.annotate( @@ -178,6 +178,6 @@ sv.process_video( -This structured walkthrough should give a detailed pathway to annotate videos -effectively using Supervision’s various functionalities, including object tracking and -trace annotations. \ No newline at end of file +This structured walkthrough should give a detailed pathway to annotate videos +effectively using Supervision’s various functionalities, including object tracking and +trace annotations. From 7f69f6a1682bf101c96b6c91e7fd953aea0b9b2e Mon Sep 17 00:00:00 2001 From: fdloopes Date: Mon, 30 Oct 2023 10:26:09 -0300 Subject: [PATCH 105/164] Add np.maximum when retrieving detections coordinates within the BlurAnnotator.annotate() method. --- supervision/annotators/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index 95cea69e..45da5e72 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -892,7 +892,7 @@ class BlurAnnotator(BaseAnnotator): supervision-annotator-examples/blur-annotator-example-purple.png) """ for detection_idx in range(len(detections)): - x1, y1, x2, y2 = detections.xyxy[detection_idx].astype(int) + x1, y1, x2, y2 = np.maximum(detections.xyxy[detection_idx].astype(int),0) roi = scene[y1:y2, x1:x2] roi = cv2.blur(roi, (self.kernel_size, self.kernel_size)) From c036aa9bd647d9e716ed4202bc7b104cd721688a Mon Sep 17 00:00:00 2001 From: James Gallagher Date: Mon, 30 Oct 2023 15:13:33 +0000 Subject: [PATCH 106/164] add kapa bot --- docs/javascript/init_kapa_widget.js | 10 ++++++++++ mkdocs.yml | 4 ++++ 2 files changed, 14 insertions(+) create mode 100644 docs/javascript/init_kapa_widget.js diff --git a/docs/javascript/init_kapa_widget.js b/docs/javascript/init_kapa_widget.js new file mode 100644 index 00000000..6069098a --- /dev/null +++ b/docs/javascript/init_kapa_widget.js @@ -0,0 +1,10 @@ +document.addEventListener("DOMContentLoaded", function () { + var script = document.createElement("script"); + script.src = "https://widget.kapa.ai/kapa-widget.bundle.js"; + script.setAttribute("data-website-id", "e83c5c60-2968-410b-a2da-08fb104f23df"); + script.setAttribute("data-project-name", "Roboflow"); + script.setAttribute("data-project-color", "#6405C9"); + script.setAttribute("data-project-logo", "https:/media.roboflow.com/chat.png"); + script.async = true; + document.head.appendChild(script); +}); \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index 6f0cbed4..0f51c47f 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -93,3 +93,7 @@ markdown_extensions: alternate_style: true - toc: permalink: true + +extra_javascript: + - "https://widget.kapa.ai/kapa-widget.bundle.js" + - "javascript/init_kapa_widget.js" \ No newline at end of file From 9f265b483367ca5f88431277d818d2032ac5172b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 30 Oct 2023 15:15:14 +0000 Subject: [PATCH 107/164] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/javascript/init_kapa_widget.js | 2 +- mkdocs.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/javascript/init_kapa_widget.js b/docs/javascript/init_kapa_widget.js index 6069098a..a7ab1f97 100644 --- a/docs/javascript/init_kapa_widget.js +++ b/docs/javascript/init_kapa_widget.js @@ -7,4 +7,4 @@ document.addEventListener("DOMContentLoaded", function () { script.setAttribute("data-project-logo", "https:/media.roboflow.com/chat.png"); script.async = true; document.head.appendChild(script); -}); \ No newline at end of file +}); diff --git a/mkdocs.yml b/mkdocs.yml index 0f51c47f..3f78eb96 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -96,4 +96,4 @@ markdown_extensions: extra_javascript: - "https://widget.kapa.ai/kapa-widget.bundle.js" - - "javascript/init_kapa_widget.js" \ No newline at end of file + - "javascript/init_kapa_widget.js" From 030359cb44639e488a460d0dd14057827f539cd1 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 30 Oct 2023 17:39:35 +0000 Subject: [PATCH 108/164] =?UTF-8?q?chore(pre=5Fcommit):=20=E2=AC=86=20pre?= =?UTF-8?q?=5Fcommit=20autoupdate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black: 23.10.0 → 23.10.1](https://github.com/psf/black/compare/23.10.0...23.10.1) - [github.com/astral-sh/ruff-pre-commit: v0.1.1 → v0.1.3](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.1...v0.1.3) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2853b370..e264874b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -65,12 +65,12 @@ repos: - repo: https://github.com/psf/black - rev: 23.10.0 + rev: 23.10.1 hooks: - id: black - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.1 + rev: v0.1.3 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] From 98fa8339c8f3aef7aaa5b7390527ec74a78845ff Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 31 Oct 2023 01:05:37 +0000 Subject: [PATCH 109/164] :arrow_up: Bump wheel from 0.40.0 to 0.41.3 Bumps [wheel](https://github.com/pypa/wheel) from 0.40.0 to 0.41.3. - [Release notes](https://github.com/pypa/wheel/releases) - [Changelog](https://github.com/pypa/wheel/blob/main/docs/news.rst) - [Commits](https://github.com/pypa/wheel/compare/0.40.0...0.41.3) --- updated-dependencies: - dependency-name: wheel dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- poetry.lock | 10 +++++----- pyproject.toml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/poetry.lock b/poetry.lock index c2f393e2..bc069816 100644 --- a/poetry.lock +++ b/poetry.lock @@ -3586,17 +3586,17 @@ test = ["websockets"] [[package]] name = "wheel" -version = "0.40.0" +version = "0.41.3" description = "A built-package format for Python" optional = false python-versions = ">=3.7" files = [ - {file = "wheel-0.40.0-py3-none-any.whl", hash = "sha256:d236b20e7cb522daf2390fa84c55eea81c5c30190f90f29ae2ca1ad8355bf247"}, - {file = "wheel-0.40.0.tar.gz", hash = "sha256:cd1196f3faee2b31968d626e1731c94f99cbdb67cf5a46e4f5656cbee7738873"}, + {file = "wheel-0.41.3-py3-none-any.whl", hash = "sha256:488609bc63a29322326e05560731bf7bfea8e48ad646e1f5e40d366607de0942"}, + {file = "wheel-0.41.3.tar.gz", hash = "sha256:4d4987ce51a49370ea65c0bfd2234e8ce80a12780820d9dc462597a6e60d0841"}, ] [package.extras] -test = ["pytest (>=6.0.0)"] +test = ["pytest (>=6.0.0)", "setuptools (>=65)"] [[package]] name = "zipp" @@ -3620,4 +3620,4 @@ desktop = ["opencv-python"] [metadata] lock-version = "2.0" python-versions = ">=3.8,<3.12.0" -content-hash = "7015859b8447c3b2fac61a26bd6554a89d330c7c40014713273bc3001b05d5e9" +content-hash = "da11244af061468ada0b1ca723ec71fb2fb88cccc3c4bf017ebe395e453a2ed8" diff --git a/pyproject.toml b/pyproject.toml index d4d6d9ba..819f00d7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -54,7 +54,7 @@ assets = ["requests","tqdm"] [tool.poetry.group.dev.dependencies] twine = "^4.0.2" pytest = "^7.2.2" -wheel = "^0.40.0" +wheel = ">=0.40,<0.42" notebook = "^6.5.3" build = ">=0.10,<1.1" ruff = ">=0.0.280,<0.1.3" From 8b88f1f415a7923fb52abdf070d7df26c12bea07 Mon Sep 17 00:00:00 2001 From: fdloopes Date: Tue, 31 Oct 2023 11:50:37 -0300 Subject: [PATCH 110/164] Add space after comma, following pre-commit pattern --- supervision/annotators/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index 45da5e72..b6378bc0 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -892,7 +892,7 @@ class BlurAnnotator(BaseAnnotator): supervision-annotator-examples/blur-annotator-example-purple.png) """ for detection_idx in range(len(detections)): - x1, y1, x2, y2 = np.maximum(detections.xyxy[detection_idx].astype(int),0) + x1, y1, x2, y2 = np.maximum(detections.xyxy[detection_idx].astype(int), 0) roi = scene[y1:y2, x1:x2] roi = cv2.blur(roi, (self.kernel_size, self.kernel_size)) From ec9aae686be47efa2fed2b5da4573f888795bf1a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 31 Oct 2023 15:48:33 +0000 Subject: [PATCH 111/164] :arrow_up: Bump notebook from 6.5.4 to 7.0.6 Bumps [notebook](https://github.com/jupyter/notebook) from 6.5.4 to 7.0.6. - [Release notes](https://github.com/jupyter/notebook/releases) - [Changelog](https://github.com/jupyter/notebook/blob/main/CHANGELOG.md) - [Commits](https://github.com/jupyter/notebook/compare/v6.5.4...@jupyter-notebook/tree@7.0.6) --- updated-dependencies: - dependency-name: notebook dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- poetry.lock | 187 ++++++++++++++++++++++++++++++------------------- pyproject.toml | 2 +- 2 files changed, 117 insertions(+), 72 deletions(-) diff --git a/poetry.lock b/poetry.lock index bc069816..7d0891c4 100644 --- a/poetry.lock +++ b/poetry.lock @@ -119,6 +119,20 @@ six = "*" [package.extras] test = ["astroid", "pytest"] +[[package]] +name = "async-lru" +version = "2.0.4" +description = "Simple LRU cache for asyncio" +optional = false +python-versions = ">=3.8" +files = [ + {file = "async-lru-2.0.4.tar.gz", hash = "sha256:b8a59a5df60805ff63220b2a0c5b5393da5521b113cd5465a44eb037d81a5627"}, + {file = "async_lru-2.0.4-py3-none-any.whl", hash = "sha256:ff02944ce3c288c5be660c42dbcca0742b32c3b279d6dceda655190240b99224"}, +] + +[package.dependencies] +typing-extensions = {version = ">=4.0.0", markers = "python_version < \"3.11\""} + [[package]] name = "attrs" version = "23.1.0" @@ -999,17 +1013,6 @@ qtconsole = ["qtconsole"] test = ["pytest (<7.1)", "pytest-asyncio", "testpath"] test-extra = ["curio", "matplotlib (!=3.2.0)", "nbformat", "numpy (>=1.21)", "pandas", "pytest (<7.1)", "pytest-asyncio", "testpath", "trio"] -[[package]] -name = "ipython-genutils" -version = "0.2.0" -description = "Vestigial utilities from IPython" -optional = false -python-versions = "*" -files = [ - {file = "ipython_genutils-0.2.0-py2.py3-none-any.whl", hash = "sha256:72dd37233799e619666c9f639a9da83c34013a73e8bbc79a7a6348d93c61fab8"}, - {file = "ipython_genutils-0.2.0.tar.gz", hash = "sha256:eb2e116e75ecef9d4d228fdc66af54269afa26ab4463042e33785b887c628ba8"}, -] - [[package]] name = "isoduration" version = "20.11.0" @@ -1110,6 +1113,20 @@ MarkupSafe = ">=2.0" [package.extras] i18n = ["Babel (>=2.7)"] +[[package]] +name = "json5" +version = "0.9.14" +description = "A Python implementation of the JSON5 data format." +optional = false +python-versions = "*" +files = [ + {file = "json5-0.9.14-py2.py3-none-any.whl", hash = "sha256:740c7f1b9e584a468dbb2939d8d458db3427f2c93ae2139d05f47e453eae964f"}, + {file = "json5-0.9.14.tar.gz", hash = "sha256:9ed66c3a6ca3510a976a9ef9b8c0787de24802724ab1860bc0153c7fdd589b02"}, +] + +[package.extras] +dev = ["hypothesis"] + [[package]] name = "jsonpointer" version = "2.4" @@ -1234,6 +1251,21 @@ cli = ["click", "rich"] docs = ["jupyterlite-sphinx", "myst-parser", "pydata-sphinx-theme", "sphinxcontrib-spelling"] test = ["click", "coverage", "pre-commit", "pytest (>=7.0)", "pytest-asyncio (>=0.19.0)", "pytest-console-scripts", "pytest-cov", "rich"] +[[package]] +name = "jupyter-lsp" +version = "2.2.0" +description = "Multi-Language Server WebSocket proxy for Jupyter Notebook/Lab server" +optional = false +python-versions = ">=3.8" +files = [ + {file = "jupyter-lsp-2.2.0.tar.gz", hash = "sha256:8ebbcb533adb41e5d635eb8fe82956b0aafbf0fd443b6c4bfa906edeeb8635a1"}, + {file = "jupyter_lsp-2.2.0-py3-none-any.whl", hash = "sha256:9e06b8b4f7dd50300b70dd1a78c0c3b0c3d8fa68e0f2d8a5d1fbab62072aca3f"}, +] + +[package.dependencies] +importlib-metadata = {version = ">=4.8.3", markers = "python_version < \"3.10\""} +jupyter-server = ">=1.1.2" + [[package]] name = "jupyter-server" version = "2.7.2" @@ -1289,6 +1321,39 @@ terminado = ">=0.8.3" docs = ["jinja2", "jupyter-server", "mistune (<3.0)", "myst-parser", "nbformat", "packaging", "pydata-sphinx-theme", "sphinxcontrib-github-alt", "sphinxcontrib-openapi", "sphinxcontrib-spelling", "sphinxemoji", "tornado"] test = ["coverage", "jupyter-server (>=2.0.0)", "pytest (>=7.0)", "pytest-cov", "pytest-jupyter[server] (>=0.5.3)", "pytest-timeout"] +[[package]] +name = "jupyterlab" +version = "4.0.7" +description = "JupyterLab computational environment" +optional = false +python-versions = ">=3.8" +files = [ + {file = "jupyterlab-4.0.7-py3-none-any.whl", hash = "sha256:08683045117cc495531fdb39c22ababb9aaac6977a45e67cfad20046564c9c7c"}, + {file = "jupyterlab-4.0.7.tar.gz", hash = "sha256:48792efd9f962b2bcda1f87d72168ff122c288b1d97d32109e4a11b33dc862be"}, +] + +[package.dependencies] +async-lru = ">=1.0.0" +importlib-metadata = {version = ">=4.8.3", markers = "python_version < \"3.10\""} +importlib-resources = {version = ">=1.4", markers = "python_version < \"3.9\""} +ipykernel = "*" +jinja2 = ">=3.0.3" +jupyter-core = "*" +jupyter-lsp = ">=2.0.0" +jupyter-server = ">=2.4.0,<3" +jupyterlab-server = ">=2.19.0,<3" +notebook-shim = ">=0.2" +packaging = "*" +tomli = {version = "*", markers = "python_version < \"3.11\""} +tornado = ">=6.2.0" +traitlets = "*" + +[package.extras] +dev = ["black[jupyter] (==23.7.0)", "build", "bump2version", "coverage", "hatch", "pre-commit", "pytest-cov", "ruff (==0.0.286)"] +docs = ["jsx-lexer", "myst-parser", "pydata-sphinx-theme (>=0.13.0)", "pytest", "pytest-check-links", "pytest-tornasync", "sphinx (>=1.8,<7.2.0)", "sphinx-copybutton"] +docs-screenshots = ["altair (==5.0.1)", "ipython (==8.14.0)", "ipywidgets (==8.0.6)", "jupyterlab-geojson (==3.4.0)", "jupyterlab-language-pack-zh-cn (==4.0.post0)", "matplotlib (==3.7.1)", "nbconvert (>=7.0.0)", "pandas (==2.0.2)", "scipy (==1.10.1)", "vega-datasets (==0.9.0)"] +test = ["coverage", "pytest (>=7.0)", "pytest-check-links (>=0.7)", "pytest-console-scripts", "pytest-cov", "pytest-jupyter (>=0.5.3)", "pytest-timeout", "pytest-tornasync", "requests", "requests-cache", "virtualenv"] + [[package]] name = "jupyterlab-pygments" version = "0.2.2" @@ -1300,6 +1365,32 @@ files = [ {file = "jupyterlab_pygments-0.2.2.tar.gz", hash = "sha256:7405d7fde60819d905a9fa8ce89e4cd830e318cdad22a0030f7a901da705585d"}, ] +[[package]] +name = "jupyterlab-server" +version = "2.25.0" +description = "A set of server components for JupyterLab and JupyterLab like applications." +optional = false +python-versions = ">=3.8" +files = [ + {file = "jupyterlab_server-2.25.0-py3-none-any.whl", hash = "sha256:c9f67a98b295c5dee87f41551b0558374e45d449f3edca153dd722140630dcb2"}, + {file = "jupyterlab_server-2.25.0.tar.gz", hash = "sha256:77c2f1f282d610f95e496e20d5bf1d2a7706826dfb7b18f3378ae2870d272fb7"}, +] + +[package.dependencies] +babel = ">=2.10" +importlib-metadata = {version = ">=4.8.3", markers = "python_version < \"3.10\""} +jinja2 = ">=3.0.3" +json5 = ">=0.9.0" +jsonschema = ">=4.18.0" +jupyter-server = ">=1.21,<3" +packaging = ">=21.3" +requests = ">=2.31" + +[package.extras] +docs = ["autodoc-traits", "jinja2 (<3.2.0)", "mistune (<4)", "myst-parser", "pydata-sphinx-theme", "sphinx", "sphinx-copybutton", "sphinxcontrib-openapi (>0.8)"] +openapi = ["openapi-core (>=0.18.0,<0.19.0)", "ruamel-yaml"] +test = ["hatch", "ipykernel", "openapi-core (>=0.18.0,<0.19.0)", "openapi-spec-validator (>=0.6.0,<0.7.0)", "pytest (>=7.0)", "pytest-console-scripts", "pytest-cov", "pytest-jupyter[server] (>=0.6.2)", "pytest-timeout", "requests-mock", "ruamel-yaml", "sphinxcontrib-spelling", "strict-rfc3339", "werkzeug"] + [[package]] name = "keyring" version = "24.2.0" @@ -1834,41 +1925,6 @@ files = [ {file = "mypy_extensions-1.0.0.tar.gz", hash = "sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782"}, ] -[[package]] -name = "nbclassic" -version = "1.0.0" -description = "Jupyter Notebook as a Jupyter Server extension." -optional = false -python-versions = ">=3.7" -files = [ - {file = "nbclassic-1.0.0-py3-none-any.whl", hash = "sha256:f99e4769b4750076cd4235c044b61232110733322384a94a63791d2e7beacc66"}, - {file = "nbclassic-1.0.0.tar.gz", hash = "sha256:0ae11eb2319455d805596bf320336cda9554b41d99ab9a3c31bf8180bffa30e3"}, -] - -[package.dependencies] -argon2-cffi = "*" -ipykernel = "*" -ipython-genutils = "*" -jinja2 = "*" -jupyter-client = ">=6.1.1" -jupyter-core = ">=4.6.1" -jupyter-server = ">=1.8" -nbconvert = ">=5" -nbformat = "*" -nest-asyncio = ">=1.5" -notebook-shim = ">=0.2.3" -prometheus-client = "*" -pyzmq = ">=17" -Send2Trash = ">=1.8.0" -terminado = ">=0.8.3" -tornado = ">=6.1" -traitlets = ">=4.2.1" - -[package.extras] -docs = ["myst-parser", "nbsphinx", "sphinx", "sphinx-rtd-theme", "sphinxcontrib-github-alt"] -json-logging = ["json-logging"] -test = ["coverage", "nbval", "pytest", "pytest-cov", "pytest-jupyter", "pytest-playwright", "pytest-tornasync", "requests", "requests-unixsocket", "testpath"] - [[package]] name = "nbclient" version = "0.8.0" @@ -1977,37 +2033,26 @@ setuptools = "*" [[package]] name = "notebook" -version = "6.5.4" -description = "A web-based notebook environment for interactive computing" +version = "7.0.6" +description = "Jupyter Notebook - A web-based notebook environment for interactive computing" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "notebook-6.5.4-py3-none-any.whl", hash = "sha256:dd17e78aefe64c768737b32bf171c1c766666a21cc79a44d37a1700771cab56f"}, - {file = "notebook-6.5.4.tar.gz", hash = "sha256:517209568bd47261e2def27a140e97d49070602eea0d226a696f42a7f16c9a4e"}, + {file = "notebook-7.0.6-py3-none-any.whl", hash = "sha256:0fe8f67102fea3744fedf652e4c15339390902ca70c5a31c4f547fa23da697cc"}, + {file = "notebook-7.0.6.tar.gz", hash = "sha256:ec6113b06529019f7f287819af06c97a2baf7a95ac21a8f6e32192898e9f9a58"}, ] [package.dependencies] -argon2-cffi = "*" -ipykernel = "*" -ipython-genutils = "*" -jinja2 = "*" -jupyter-client = ">=5.3.4" -jupyter-core = ">=4.6.1" -nbclassic = ">=0.4.7" -nbconvert = ">=5" -nbformat = "*" -nest-asyncio = ">=1.5" -prometheus-client = "*" -pyzmq = ">=17" -Send2Trash = ">=1.8.0" -terminado = ">=0.8.3" -tornado = ">=6.1" -traitlets = ">=4.2.1" +jupyter-server = ">=2.4.0,<3" +jupyterlab = ">=4.0.2,<5" +jupyterlab-server = ">=2.22.1,<3" +notebook-shim = ">=0.2,<0.3" +tornado = ">=6.2.0" [package.extras] -docs = ["myst-parser", "nbsphinx", "sphinx", "sphinx-rtd-theme", "sphinxcontrib-github-alt"] -json-logging = ["json-logging"] -test = ["coverage", "nbval", "pytest", "pytest-cov", "requests", "requests-unixsocket", "selenium (==4.1.5)", "testpath"] +dev = ["hatch", "pre-commit"] +docs = ["myst-parser", "nbsphinx", "pydata-sphinx-theme", "sphinx (>=1.3.6)", "sphinxcontrib-github-alt", "sphinxcontrib-spelling"] +test = ["importlib-resources (>=5.0)", "ipykernel", "jupyter-server[test] (>=2.4.0,<3)", "jupyterlab-server[test] (>=2.22.1,<3)", "nbval", "pytest (>=7.0)", "pytest-console-scripts", "pytest-timeout", "pytest-tornasync", "requests"] [[package]] name = "notebook-shim" @@ -3620,4 +3665,4 @@ desktop = ["opencv-python"] [metadata] lock-version = "2.0" python-versions = ">=3.8,<3.12.0" -content-hash = "da11244af061468ada0b1ca723ec71fb2fb88cccc3c4bf017ebe395e453a2ed8" +content-hash = "eafb48d956d016f7b4ab94c69190aa017e34e5a2de1fd688e0ea86a1f6e7873a" diff --git a/pyproject.toml b/pyproject.toml index 819f00d7..9a574939 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -55,7 +55,7 @@ assets = ["requests","tqdm"] twine = "^4.0.2" pytest = "^7.2.2" wheel = ">=0.40,<0.42" -notebook = "^6.5.3" +notebook = ">=6.5.3,<8.0.0" build = ">=0.10,<1.1" ruff = ">=0.0.280,<0.1.3" isort = "^5.12.0" From 4a5d850f283cde1843507eef374020b987305aa1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 31 Oct 2023 15:53:12 +0000 Subject: [PATCH 112/164] :arrow_up: Bump ruff from 0.1.2 to 0.1.3 Bumps [ruff](https://github.com/astral-sh/ruff) from 0.1.2 to 0.1.3. - [Release notes](https://github.com/astral-sh/ruff/releases) - [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md) - [Commits](https://github.com/astral-sh/ruff/compare/v0.1.2...v0.1.3) --- updated-dependencies: - dependency-name: ruff dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- poetry.lock | 38 +++++++++++++++++++------------------- pyproject.toml | 2 +- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/poetry.lock b/poetry.lock index 0c92ddfa..839e1e29 100644 --- a/poetry.lock +++ b/poetry.lock @@ -3166,28 +3166,28 @@ files = [ [[package]] name = "ruff" -version = "0.1.2" +version = "0.1.3" description = "An extremely fast Python linter, written in Rust." optional = false python-versions = ">=3.7" files = [ - {file = "ruff-0.1.2-py3-none-macosx_10_7_x86_64.whl", hash = "sha256:0d3ee66b825b713611f89aa35d16de984f76f26c50982a25d52cd0910dff3923"}, - {file = "ruff-0.1.2-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:f85f850a320ff532b8f93e8d1da6a36ef03698c446357c8c43b46ef90bb321eb"}, - {file = "ruff-0.1.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:809c6d4e45683696d19ca79e4c6bd3b2e9204fe9546923f2eb3b126ec314b0dc"}, - {file = "ruff-0.1.2-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:46005e4abb268e93cad065244e17e2ea16b6fcb55a5c473f34fbc1fd01ae34cb"}, - {file = "ruff-0.1.2-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:10cdb302f519664d5e2cf954562ac86c9d20ca05855e5b5c2f9d542228f45da4"}, - {file = "ruff-0.1.2-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:f89ebcbe57a1eab7d7b4ceb57ddf0af9ed13eae24e443a7c1dc078000bd8cc6b"}, - {file = "ruff-0.1.2-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:7344eaca057d4c32373c9c3a7afb7274f56040c225b6193dd495fcf69453b436"}, - {file = "ruff-0.1.2-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:dffa25f6e03c4950b6ac6f216bc0f98a4be9719cb0c5260c8e88d1bac36f1683"}, - {file = "ruff-0.1.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:42ddaea52cb7ba7c785e8593a7532866c193bc774fe570f0e4b1ccedd95b83c5"}, - {file = "ruff-0.1.2-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:a8533efda625bbec0bf27da2886bd641dae0c209104f6c39abc4be5b7b22de2a"}, - {file = "ruff-0.1.2-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:b0b1b82221ba7c50e03b7a86b983157b5d3f4d8d4f16728132bdf02c6d651f77"}, - {file = "ruff-0.1.2-py3-none-musllinux_1_2_i686.whl", hash = "sha256:6c1362eb9288f8cc95535294cb03bd4665c8cef86ec32745476a4e5c6817034c"}, - {file = "ruff-0.1.2-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:ffa7ef5ded0563329a35bd5a1cfdae40f05a75c0cc2dd30f00b1320b1fb461fc"}, - {file = "ruff-0.1.2-py3-none-win32.whl", hash = "sha256:6e8073f85e47072256e2e1909f1ae515cf61ff5a4d24730a63b8b4ac24b6704a"}, - {file = "ruff-0.1.2-py3-none-win_amd64.whl", hash = "sha256:b836ddff662a45385948ee0878b0a04c3a260949905ad861a37b931d6ee1c210"}, - {file = "ruff-0.1.2-py3-none-win_arm64.whl", hash = "sha256:b0c42d00db5639dbd5f7f9923c63648682dd197bf5de1151b595160c96172691"}, - {file = "ruff-0.1.2.tar.gz", hash = "sha256:afd4785ae060ce6edcd52436d0c197628a918d6d09e3107a892a1bad6a4c6608"}, + {file = "ruff-0.1.3-py3-none-macosx_10_7_x86_64.whl", hash = "sha256:b46d43d51f7061652eeadb426a9e3caa1e0002470229ab2fc19de8a7b0766901"}, + {file = "ruff-0.1.3-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:b8afeb9abd26b4029c72adc9921b8363374f4e7edb78385ffaa80278313a15f9"}, + {file = "ruff-0.1.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ca3cf365bf32e9ba7e6db3f48a4d3e2c446cd19ebee04f05338bc3910114528b"}, + {file = "ruff-0.1.3-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:4874c165f96c14a00590dcc727a04dca0cfd110334c24b039458c06cf78a672e"}, + {file = "ruff-0.1.3-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:eec2dd31eed114e48ea42dbffc443e9b7221976554a504767ceaee3dd38edeb8"}, + {file = "ruff-0.1.3-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:dc3ec4edb3b73f21b4aa51337e16674c752f1d76a4a543af56d7d04e97769613"}, + {file = "ruff-0.1.3-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:2e3de9ed2e39160800281848ff4670e1698037ca039bda7b9274f849258d26ce"}, + {file = "ruff-0.1.3-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:1c595193881922cc0556a90f3af99b1c5681f0c552e7a2a189956141d8666fe8"}, + {file = "ruff-0.1.3-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0f75e670d529aa2288cd00fc0e9b9287603d95e1536d7a7e0cafe00f75e0dd9d"}, + {file = "ruff-0.1.3-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:76dd49f6cd945d82d9d4a9a6622c54a994689d8d7b22fa1322983389b4892e20"}, + {file = "ruff-0.1.3-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:918b454bc4f8874a616f0d725590277c42949431ceb303950e87fef7a7d94cb3"}, + {file = "ruff-0.1.3-py3-none-musllinux_1_2_i686.whl", hash = "sha256:d8859605e729cd5e53aa38275568dbbdb4fe882d2ea2714c5453b678dca83784"}, + {file = "ruff-0.1.3-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:0b6c55f5ef8d9dd05b230bb6ab80bc4381ecb60ae56db0330f660ea240cb0d4a"}, + {file = "ruff-0.1.3-py3-none-win32.whl", hash = "sha256:3e7afcbdcfbe3399c34e0f6370c30f6e529193c731b885316c5a09c9e4317eef"}, + {file = "ruff-0.1.3-py3-none-win_amd64.whl", hash = "sha256:7a18df6638cec4a5bd75350639b2bb2a2366e01222825562c7346674bdceb7ea"}, + {file = "ruff-0.1.3-py3-none-win_arm64.whl", hash = "sha256:12fd53696c83a194a2db7f9a46337ce06445fb9aa7d25ea6f293cf75b21aca9f"}, + {file = "ruff-0.1.3.tar.gz", hash = "sha256:3ba6145369a151401d5db79f0a47d50e470384d0d89d0d6f7fab0b589ad07c34"}, ] [[package]] @@ -3665,4 +3665,4 @@ desktop = ["opencv-python"] [metadata] lock-version = "2.0" python-versions = ">=3.8,<3.12.0" -content-hash = "eafb48d956d016f7b4ab94c69190aa017e34e5a2de1fd688e0ea86a1f6e7873a" +content-hash = "578a95655c3b6ac0d14d8b8f0e26829d04af60b98a0b6a2a202e440aed7da409" diff --git a/pyproject.toml b/pyproject.toml index 9a574939..f4ea6ef1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -57,7 +57,7 @@ pytest = "^7.2.2" wheel = ">=0.40,<0.42" notebook = ">=6.5.3,<8.0.0" build = ">=0.10,<1.1" -ruff = ">=0.0.280,<0.1.3" +ruff = ">=0.0.280,<0.1.4" isort = "^5.12.0" black = "^23.7.0" mypy = "^1.4.1" From 6e039d7ebda2750a2a8505cbf0c37b480c344322 Mon Sep 17 00:00:00 2001 From: Piotr Skalski Date: Tue, 31 Oct 2023 17:30:02 +0100 Subject: [PATCH 113/164] Update init_kapa_widget.js --- docs/javascript/init_kapa_widget.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/javascript/init_kapa_widget.js b/docs/javascript/init_kapa_widget.js index a7ab1f97..ffa121ac 100644 --- a/docs/javascript/init_kapa_widget.js +++ b/docs/javascript/init_kapa_widget.js @@ -4,7 +4,7 @@ document.addEventListener("DOMContentLoaded", function () { script.setAttribute("data-website-id", "e83c5c60-2968-410b-a2da-08fb104f23df"); script.setAttribute("data-project-name", "Roboflow"); script.setAttribute("data-project-color", "#6405C9"); - script.setAttribute("data-project-logo", "https:/media.roboflow.com/chat.png"); + script.setAttribute("data-project-logo", "https://media.roboflow.com/chat.png"); script.async = true; document.head.appendChild(script); }); From ce7e3a1de4eba124e67aec68a983cdc3ea748303 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Tue, 31 Oct 2023 18:04:13 +0100 Subject: [PATCH 114/164] Refactor clip_boxes function and enhance detections processing Refactored the `clip_boxes` function for clarity by renaming arguments from `boxes_xyxy` and `frame_resolution_wh` to `xyxy` and `resolution_wh`, respectively. These change makes the function arguments more intuitive and improves code readability. The processing of detections in `supervision/annotators/core.py` has been updated to include clipping of detection boxes to the image bounds before processing. This prevents errors and ensures detections beyond the image dimensions are handled correctly. Adjustments were also made in the test cases and in `polygon_zone.py` to match the updated `clip_boxes` function. --- supervision/annotators/core.py | 10 +++++++--- supervision/detection/tools/polygon_zone.py | 2 +- supervision/detection/utils.py | 12 +++++------- test/detection/test_utils.py | 8 ++++---- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index b6378bc0..8da3a659 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -7,6 +7,7 @@ import numpy as np from supervision.annotators.base import BaseAnnotator from supervision.annotators.utils import ColorLookup, Trace, resolve_color from supervision.detection.core import Detections +from supervision.detection.utils import clip_boxes from supervision.draw.color import Color, ColorPalette from supervision.geometry.core import Position @@ -891,10 +892,13 @@ class BlurAnnotator(BaseAnnotator): ![blur-annotator-example](https://media.roboflow.com/ supervision-annotator-examples/blur-annotator-example-purple.png) """ - for detection_idx in range(len(detections)): - x1, y1, x2, y2 = np.maximum(detections.xyxy[detection_idx].astype(int), 0) - roi = scene[y1:y2, x1:x2] + image_height, image_width = scene.shape[:2] + clipped_xyxy = clip_boxes( + xyxy=detections.xyxy, + resolution_wh=(image_width, image_height)).astype(int) + for x1, y1, x2, y2 in clipped_xyxy: + roi = scene[y1:y2, x1:x2] roi = cv2.blur(roi, (self.kernel_size, self.kernel_size)) scene[y1:y2, x1:x2] = roi diff --git a/supervision/detection/tools/polygon_zone.py b/supervision/detection/tools/polygon_zone.py index f1dba839..15ee1aa2 100644 --- a/supervision/detection/tools/polygon_zone.py +++ b/supervision/detection/tools/polygon_zone.py @@ -56,7 +56,7 @@ class PolygonZone: """ clipped_xyxy = clip_boxes( - boxes_xyxy=detections.xyxy, frame_resolution_wh=self.frame_resolution_wh + xyxy=detections.xyxy, resolution_wh=self.frame_resolution_wh ) clipped_detections = replace(detections, xyxy=clipped_xyxy) clipped_anchors = np.ceil( diff --git a/supervision/detection/utils.py b/supervision/detection/utils.py index 7a5eb546..7aa2c846 100644 --- a/supervision/detection/utils.py +++ b/supervision/detection/utils.py @@ -110,17 +110,15 @@ 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(xyxy: np.ndarray, resolution_wh: Tuple[int, int]) -> np.ndarray: """ Clips bounding boxes coordinates to fit within the frame resolution. Args: - boxes_xyxy (np.ndarray): A numpy array of shape `(N, 4)` where each + xyxy (np.ndarray): A numpy array of shape `(N, 4)` where each row corresponds to a bounding box in the format `(x_min, y_min, x_max, y_max)`. - frame_resolution_wh (Tuple[int, int]): A tuple of the form `(width, height)` + resolution_wh (Tuple[int, int]): A tuple of the form `(width, height)` representing the resolution of the frame. Returns: @@ -128,8 +126,8 @@ def clip_boxes( corresponds to a bounding box with coordinates clipped to fit within the frame resolution. """ - result = np.copy(boxes_xyxy) - width, height = frame_resolution_wh + result = np.copy(xyxy) + width, height = resolution_wh result[:, [0, 2]] = result[:, [0, 2]].clip(0, width) result[:, [1, 3]] = result[:, [1, 3]].clip(0, height) return result diff --git a/test/detection/test_utils.py b/test/detection/test_utils.py index 09691adf..6b3249b4 100644 --- a/test/detection/test_utils.py +++ b/test/detection/test_utils.py @@ -122,7 +122,7 @@ def test_non_max_suppression( @pytest.mark.parametrize( - "boxes_xyxy, frame_resolution_wh, expected_result", + "xyxy, resolution_wh, expected_result", [ ( np.empty(shape=(0, 4)), @@ -157,11 +157,11 @@ def test_non_max_suppression( ], ) def test_clip_boxes( - boxes_xyxy: np.ndarray, - frame_resolution_wh: Tuple[int, int], + xyxy: np.ndarray, + resolution_wh: Tuple[int, int], expected_result: np.ndarray, ) -> None: - result = clip_boxes(boxes_xyxy=boxes_xyxy, frame_resolution_wh=frame_resolution_wh) + result = clip_boxes(xyxy=xyxy, resolution_wh=resolution_wh) assert np.array_equal(result, expected_result) From e6a5c514f8408ad750c3ae6743d1c19b7ed030e7 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 31 Oct 2023 17:05:10 +0000 Subject: [PATCH 115/164] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/annotators/core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index 8da3a659..bd5181ab 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -894,8 +894,8 @@ class BlurAnnotator(BaseAnnotator): """ image_height, image_width = scene.shape[:2] clipped_xyxy = clip_boxes( - xyxy=detections.xyxy, - resolution_wh=(image_width, image_height)).astype(int) + xyxy=detections.xyxy, resolution_wh=(image_width, image_height) + ).astype(int) for x1, y1, x2, y2 in clipped_xyxy: roi = scene[y1:y2, x1:x2] From 8d1e091a3b68d6220f89c9a7ce874c19e6e33a94 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 Nov 2023 00:35:42 +0000 Subject: [PATCH 116/164] :arrow_up: Bump mkdocs-material from 9.4.6 to 9.4.7 Bumps [mkdocs-material](https://github.com/squidfunk/mkdocs-material) from 9.4.6 to 9.4.7. - [Release notes](https://github.com/squidfunk/mkdocs-material/releases) - [Changelog](https://github.com/squidfunk/mkdocs-material/blob/master/CHANGELOG) - [Commits](https://github.com/squidfunk/mkdocs-material/compare/9.4.6...9.4.7) --- updated-dependencies: - dependency-name: mkdocs-material dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- poetry.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/poetry.lock b/poetry.lock index 839e1e29..9a850870 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1777,13 +1777,13 @@ mkdocs = ">=1.1" [[package]] name = "mkdocs-material" -version = "9.4.6" +version = "9.4.7" description = "Documentation that simply works" optional = false python-versions = ">=3.8" files = [ - {file = "mkdocs_material-9.4.6-py3-none-any.whl", hash = "sha256:78802035d5768a78139c84ad7dce0c6493e8f7dc4861727d36ed91d1520a54da"}, - {file = "mkdocs_material-9.4.6.tar.gz", hash = "sha256:09665e60df7ee9e5ff3a54af173f6d45be718b1ee7dd962bcff3102b81fb0c14"}, + {file = "mkdocs_material-9.4.7-py3-none-any.whl", hash = "sha256:4d698d52bb6a6a3c452ab854481c4cdb68453a0420956a6aee2de55fe15fe610"}, + {file = "mkdocs_material-9.4.7.tar.gz", hash = "sha256:e704e001c9ef17291e1d3462c202425217601653e18f68f85d28eff4690e662b"}, ] [package.dependencies] @@ -1792,7 +1792,7 @@ colorama = ">=0.4,<1.0" jinja2 = ">=3.0,<4.0" markdown = ">=3.2,<4.0" mkdocs = ">=1.5.3,<2.0" -mkdocs-material-extensions = ">=1.2,<2.0" +mkdocs-material-extensions = ">=1.3,<2.0" paginate = ">=0.5,<1.0" pygments = ">=2.16,<3.0" pymdown-extensions = ">=10.2,<11.0" From f9b8709568d0345844712cbb2326cee419ddaeeb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 Nov 2023 00:37:17 +0000 Subject: [PATCH 117/164] :arrow_up: Bump mypy from 1.4.1 to 1.6.1 Bumps [mypy](https://github.com/python/mypy) from 1.4.1 to 1.6.1. - [Changelog](https://github.com/python/mypy/blob/master/CHANGELOG.md) - [Commits](https://github.com/python/mypy/compare/v1.4.1...v1.6.1) --- updated-dependencies: - dependency-name: mypy dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- poetry.lock | 58 ++++++++++++++++++++++++++--------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/poetry.lock b/poetry.lock index 839e1e29..b36de352 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1870,37 +1870,38 @@ files = [ [[package]] name = "mypy" -version = "1.4.1" +version = "1.6.1" description = "Optional static typing for Python" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "mypy-1.4.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:566e72b0cd6598503e48ea610e0052d1b8168e60a46e0bfd34b3acf2d57f96a8"}, - {file = "mypy-1.4.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:ca637024ca67ab24a7fd6f65d280572c3794665eaf5edcc7e90a866544076878"}, - {file = "mypy-1.4.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0dde1d180cd84f0624c5dcaaa89c89775550a675aff96b5848de78fb11adabcd"}, - {file = "mypy-1.4.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:8c4d8e89aa7de683e2056a581ce63c46a0c41e31bd2b6d34144e2c80f5ea53dc"}, - {file = "mypy-1.4.1-cp310-cp310-win_amd64.whl", hash = "sha256:bfdca17c36ae01a21274a3c387a63aa1aafe72bff976522886869ef131b937f1"}, - {file = "mypy-1.4.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:7549fbf655e5825d787bbc9ecf6028731973f78088fbca3a1f4145c39ef09462"}, - {file = "mypy-1.4.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:98324ec3ecf12296e6422939e54763faedbfcc502ea4a4c38502082711867258"}, - {file = "mypy-1.4.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:141dedfdbfe8a04142881ff30ce6e6653c9685b354876b12e4fe6c78598b45e2"}, - {file = "mypy-1.4.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:8207b7105829eca6f3d774f64a904190bb2231de91b8b186d21ffd98005f14a7"}, - {file = "mypy-1.4.1-cp311-cp311-win_amd64.whl", hash = "sha256:16f0db5b641ba159eff72cff08edc3875f2b62b2fa2bc24f68c1e7a4e8232d01"}, - {file = "mypy-1.4.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:470c969bb3f9a9efcedbadcd19a74ffb34a25f8e6b0e02dae7c0e71f8372f97b"}, - {file = "mypy-1.4.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e5952d2d18b79f7dc25e62e014fe5a23eb1a3d2bc66318df8988a01b1a037c5b"}, - {file = "mypy-1.4.1-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:190b6bab0302cec4e9e6767d3eb66085aef2a1cc98fe04936d8a42ed2ba77bb7"}, - {file = "mypy-1.4.1-cp37-cp37m-win_amd64.whl", hash = "sha256:9d40652cc4fe33871ad3338581dca3297ff5f2213d0df345bcfbde5162abf0c9"}, - {file = "mypy-1.4.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:01fd2e9f85622d981fd9063bfaef1aed6e336eaacca00892cd2d82801ab7c042"}, - {file = "mypy-1.4.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:2460a58faeea905aeb1b9b36f5065f2dc9a9c6e4c992a6499a2360c6c74ceca3"}, - {file = "mypy-1.4.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a2746d69a8196698146a3dbe29104f9eb6a2a4d8a27878d92169a6c0b74435b6"}, - {file = "mypy-1.4.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:ae704dcfaa180ff7c4cfbad23e74321a2b774f92ca77fd94ce1049175a21c97f"}, - {file = "mypy-1.4.1-cp38-cp38-win_amd64.whl", hash = "sha256:43d24f6437925ce50139a310a64b2ab048cb2d3694c84c71c3f2a1626d8101dc"}, - {file = "mypy-1.4.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:c482e1246726616088532b5e964e39765b6d1520791348e6c9dc3af25b233828"}, - {file = "mypy-1.4.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:43b592511672017f5b1a483527fd2684347fdffc041c9ef53428c8dc530f79a3"}, - {file = "mypy-1.4.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:34a9239d5b3502c17f07fd7c0b2ae6b7dd7d7f6af35fbb5072c6208e76295816"}, - {file = "mypy-1.4.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:5703097c4936bbb9e9bce41478c8d08edd2865e177dc4c52be759f81ee4dd26c"}, - {file = "mypy-1.4.1-cp39-cp39-win_amd64.whl", hash = "sha256:e02d700ec8d9b1859790c0475df4e4092c7bf3272a4fd2c9f33d87fac4427b8f"}, - {file = "mypy-1.4.1-py3-none-any.whl", hash = "sha256:45d32cec14e7b97af848bddd97d85ea4f0db4d5a149ed9676caa4eb2f7402bb4"}, - {file = "mypy-1.4.1.tar.gz", hash = "sha256:9bbcd9ab8ea1f2e1c8031c21445b511442cc45c89951e49bbf852cbb70755b1b"}, + {file = "mypy-1.6.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:e5012e5cc2ac628177eaac0e83d622b2dd499e28253d4107a08ecc59ede3fc2c"}, + {file = "mypy-1.6.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:d8fbb68711905f8912e5af474ca8b78d077447d8f3918997fecbf26943ff3cbb"}, + {file = "mypy-1.6.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:21a1ad938fee7d2d96ca666c77b7c494c3c5bd88dff792220e1afbebb2925b5e"}, + {file = "mypy-1.6.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:b96ae2c1279d1065413965c607712006205a9ac541895004a1e0d4f281f2ff9f"}, + {file = "mypy-1.6.1-cp310-cp310-win_amd64.whl", hash = "sha256:40b1844d2e8b232ed92e50a4bd11c48d2daa351f9deee6c194b83bf03e418b0c"}, + {file = "mypy-1.6.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:81af8adaa5e3099469e7623436881eff6b3b06db5ef75e6f5b6d4871263547e5"}, + {file = "mypy-1.6.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:8c223fa57cb154c7eab5156856c231c3f5eace1e0bed9b32a24696b7ba3c3245"}, + {file = "mypy-1.6.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a8032e00ce71c3ceb93eeba63963b864bf635a18f6c0c12da6c13c450eedb183"}, + {file = "mypy-1.6.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:4c46b51de523817a0045b150ed11b56f9fff55f12b9edd0f3ed35b15a2809de0"}, + {file = "mypy-1.6.1-cp311-cp311-win_amd64.whl", hash = "sha256:19f905bcfd9e167159b3d63ecd8cb5e696151c3e59a1742e79bc3bcb540c42c7"}, + {file = "mypy-1.6.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:82e469518d3e9a321912955cc702d418773a2fd1e91c651280a1bda10622f02f"}, + {file = "mypy-1.6.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:d4473c22cc296425bbbce7e9429588e76e05bc7342da359d6520b6427bf76660"}, + {file = "mypy-1.6.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:59a0d7d24dfb26729e0a068639a6ce3500e31d6655df8557156c51c1cb874ce7"}, + {file = "mypy-1.6.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:cfd13d47b29ed3bbaafaff7d8b21e90d827631afda134836962011acb5904b71"}, + {file = "mypy-1.6.1-cp312-cp312-win_amd64.whl", hash = "sha256:eb4f18589d196a4cbe5290b435d135dee96567e07c2b2d43b5c4621b6501531a"}, + {file = "mypy-1.6.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:41697773aa0bf53ff917aa077e2cde7aa50254f28750f9b88884acea38a16169"}, + {file = "mypy-1.6.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:7274b0c57737bd3476d2229c6389b2ec9eefeb090bbaf77777e9d6b1b5a9d143"}, + {file = "mypy-1.6.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bbaf4662e498c8c2e352da5f5bca5ab29d378895fa2d980630656178bd607c46"}, + {file = "mypy-1.6.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:bb8ccb4724f7d8601938571bf3f24da0da791fe2db7be3d9e79849cb64e0ae85"}, + {file = "mypy-1.6.1-cp38-cp38-win_amd64.whl", hash = "sha256:68351911e85145f582b5aa6cd9ad666c8958bcae897a1bfda8f4940472463c45"}, + {file = "mypy-1.6.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:49ae115da099dcc0922a7a895c1eec82c1518109ea5c162ed50e3b3594c71208"}, + {file = "mypy-1.6.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:8b27958f8c76bed8edaa63da0739d76e4e9ad4ed325c814f9b3851425582a3cd"}, + {file = "mypy-1.6.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:925cd6a3b7b55dfba252b7c4561892311c5358c6b5a601847015a1ad4eb7d332"}, + {file = "mypy-1.6.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:8f57e6b6927a49550da3d122f0cb983d400f843a8a82e65b3b380d3d7259468f"}, + {file = "mypy-1.6.1-cp39-cp39-win_amd64.whl", hash = "sha256:a43ef1c8ddfdb9575691720b6352761f3f53d85f1b57d7745701041053deff30"}, + {file = "mypy-1.6.1-py3-none-any.whl", hash = "sha256:4cbe68ef919c28ea561165206a2dcb68591c50f3bcf777932323bc208d949cf1"}, + {file = "mypy-1.6.1.tar.gz", hash = "sha256:4d01c00d09a0be62a4ca3f933e315455bde83f37f892ba4b08ce92f3cf44bcc1"}, ] [package.dependencies] @@ -1911,7 +1912,6 @@ typing-extensions = ">=4.1.0" [package.extras] dmypy = ["psutil (>=4.0)"] install-types = ["pip"] -python2 = ["typed-ast (>=1.4.0,<2)"] reports = ["lxml"] [[package]] From ad458cf7056c9ddfa74e0053cb7b3c249e13f39d Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Thu, 2 Nov 2023 20:38:17 +0300 Subject: [PATCH 118/164] =?UTF-8?q?docs:=20=F0=9F=9A=80=20hacktoberfest=20?= =?UTF-8?q?2023=20finished.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thank you all who participate to hacktoberfest to make supervision awesome ! 🎉 🎉 🎉 🎉 --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index 78d8fbf0..3a95ff13 100644 --- a/README.md +++ b/README.md @@ -24,10 +24,6 @@
- - - - ## 👋 hello **We write your reusable computer vision tools.** Whether you need to load your dataset from your hard drive, draw detections on an image or video, or count how many detections are in a zone. You can count on us! 🤝 From 899d88676bb5d9940d125e3dfbe767a693bb6e38 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 Nov 2023 00:54:42 +0000 Subject: [PATCH 119/164] :arrow_up: Bump mkdocs-material from 9.4.7 to 9.4.8 Bumps [mkdocs-material](https://github.com/squidfunk/mkdocs-material) from 9.4.7 to 9.4.8. - [Release notes](https://github.com/squidfunk/mkdocs-material/releases) - [Changelog](https://github.com/squidfunk/mkdocs-material/blob/master/CHANGELOG) - [Commits](https://github.com/squidfunk/mkdocs-material/compare/9.4.7...9.4.8) --- updated-dependencies: - dependency-name: mkdocs-material dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- poetry.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/poetry.lock b/poetry.lock index b438cf11..24e90ea6 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1777,13 +1777,13 @@ mkdocs = ">=1.1" [[package]] name = "mkdocs-material" -version = "9.4.7" +version = "9.4.8" description = "Documentation that simply works" optional = false python-versions = ">=3.8" files = [ - {file = "mkdocs_material-9.4.7-py3-none-any.whl", hash = "sha256:4d698d52bb6a6a3c452ab854481c4cdb68453a0420956a6aee2de55fe15fe610"}, - {file = "mkdocs_material-9.4.7.tar.gz", hash = "sha256:e704e001c9ef17291e1d3462c202425217601653e18f68f85d28eff4690e662b"}, + {file = "mkdocs_material-9.4.8-py3-none-any.whl", hash = "sha256:8b20f6851bddeef37dced903893cd176cf13a21a482e97705a103c45f06ce9b9"}, + {file = "mkdocs_material-9.4.8.tar.gz", hash = "sha256:f0c101453e8bc12b040e8b64ca39a405d950d8402609b1378cc2b98976e74b5f"}, ] [package.dependencies] From 06945856a3b2a23d5e8716a1bf037f2dcac6544e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 Nov 2023 00:57:31 +0000 Subject: [PATCH 120/164] :arrow_up: Bump ruff from 0.1.3 to 0.1.4 Bumps [ruff](https://github.com/astral-sh/ruff) from 0.1.3 to 0.1.4. - [Release notes](https://github.com/astral-sh/ruff/releases) - [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md) - [Commits](https://github.com/astral-sh/ruff/compare/v0.1.3...v0.1.4) --- updated-dependencies: - dependency-name: ruff dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- poetry.lock | 40 ++++++++++++++++++++-------------------- pyproject.toml | 2 +- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/poetry.lock b/poetry.lock index b438cf11..bec3edd7 100644 --- a/poetry.lock +++ b/poetry.lock @@ -3166,28 +3166,28 @@ files = [ [[package]] name = "ruff" -version = "0.1.3" -description = "An extremely fast Python linter, written in Rust." +version = "0.1.4" +description = "An extremely fast Python linter and code formatter, written in Rust." optional = false python-versions = ">=3.7" files = [ - {file = "ruff-0.1.3-py3-none-macosx_10_7_x86_64.whl", hash = "sha256:b46d43d51f7061652eeadb426a9e3caa1e0002470229ab2fc19de8a7b0766901"}, - {file = "ruff-0.1.3-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:b8afeb9abd26b4029c72adc9921b8363374f4e7edb78385ffaa80278313a15f9"}, - {file = "ruff-0.1.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ca3cf365bf32e9ba7e6db3f48a4d3e2c446cd19ebee04f05338bc3910114528b"}, - {file = "ruff-0.1.3-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:4874c165f96c14a00590dcc727a04dca0cfd110334c24b039458c06cf78a672e"}, - {file = "ruff-0.1.3-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:eec2dd31eed114e48ea42dbffc443e9b7221976554a504767ceaee3dd38edeb8"}, - {file = "ruff-0.1.3-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:dc3ec4edb3b73f21b4aa51337e16674c752f1d76a4a543af56d7d04e97769613"}, - {file = "ruff-0.1.3-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:2e3de9ed2e39160800281848ff4670e1698037ca039bda7b9274f849258d26ce"}, - {file = "ruff-0.1.3-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:1c595193881922cc0556a90f3af99b1c5681f0c552e7a2a189956141d8666fe8"}, - {file = "ruff-0.1.3-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0f75e670d529aa2288cd00fc0e9b9287603d95e1536d7a7e0cafe00f75e0dd9d"}, - {file = "ruff-0.1.3-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:76dd49f6cd945d82d9d4a9a6622c54a994689d8d7b22fa1322983389b4892e20"}, - {file = "ruff-0.1.3-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:918b454bc4f8874a616f0d725590277c42949431ceb303950e87fef7a7d94cb3"}, - {file = "ruff-0.1.3-py3-none-musllinux_1_2_i686.whl", hash = "sha256:d8859605e729cd5e53aa38275568dbbdb4fe882d2ea2714c5453b678dca83784"}, - {file = "ruff-0.1.3-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:0b6c55f5ef8d9dd05b230bb6ab80bc4381ecb60ae56db0330f660ea240cb0d4a"}, - {file = "ruff-0.1.3-py3-none-win32.whl", hash = "sha256:3e7afcbdcfbe3399c34e0f6370c30f6e529193c731b885316c5a09c9e4317eef"}, - {file = "ruff-0.1.3-py3-none-win_amd64.whl", hash = "sha256:7a18df6638cec4a5bd75350639b2bb2a2366e01222825562c7346674bdceb7ea"}, - {file = "ruff-0.1.3-py3-none-win_arm64.whl", hash = "sha256:12fd53696c83a194a2db7f9a46337ce06445fb9aa7d25ea6f293cf75b21aca9f"}, - {file = "ruff-0.1.3.tar.gz", hash = "sha256:3ba6145369a151401d5db79f0a47d50e470384d0d89d0d6f7fab0b589ad07c34"}, + {file = "ruff-0.1.4-py3-none-macosx_10_7_x86_64.whl", hash = "sha256:864958706b669cce31d629902175138ad8a069d99ca53514611521f532d91495"}, + {file = "ruff-0.1.4-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:9fdd61883bb34317c788af87f4cd75dfee3a73f5ded714b77ba928e418d6e39e"}, + {file = "ruff-0.1.4-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b4eaca8c9cc39aa7f0f0d7b8fe24ecb51232d1bb620fc4441a61161be4a17539"}, + {file = "ruff-0.1.4-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:a9a1301dc43cbf633fb603242bccd0aaa34834750a14a4c1817e2e5c8d60de17"}, + {file = "ruff-0.1.4-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:78e8db8ab6f100f02e28b3d713270c857d370b8d61871d5c7d1702ae411df683"}, + {file = "ruff-0.1.4-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:80fea754eaae06335784b8ea053d6eb8e9aac75359ebddd6fee0858e87c8d510"}, + {file = "ruff-0.1.4-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:6bc02a480d4bfffd163a723698da15d1a9aec2fced4c06f2a753f87f4ce6969c"}, + {file = "ruff-0.1.4-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9862811b403063765b03e716dac0fda8fdbe78b675cd947ed5873506448acea4"}, + {file = "ruff-0.1.4-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:58826efb8b3efbb59bb306f4b19640b7e366967a31c049d49311d9eb3a4c60cb"}, + {file = "ruff-0.1.4-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:fdfd453fc91d9d86d6aaa33b1bafa69d114cf7421057868f0b79104079d3e66e"}, + {file = "ruff-0.1.4-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:e8791482d508bd0b36c76481ad3117987301b86072158bdb69d796503e1c84a8"}, + {file = "ruff-0.1.4-py3-none-musllinux_1_2_i686.whl", hash = "sha256:01206e361021426e3c1b7fba06ddcb20dbc5037d64f6841e5f2b21084dc51800"}, + {file = "ruff-0.1.4-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:645591a613a42cb7e5c2b667cbefd3877b21e0252b59272ba7212c3d35a5819f"}, + {file = "ruff-0.1.4-py3-none-win32.whl", hash = "sha256:99908ca2b3b85bffe7e1414275d004917d1e0dfc99d497ccd2ecd19ad115fd0d"}, + {file = "ruff-0.1.4-py3-none-win_amd64.whl", hash = "sha256:1dfd6bf8f6ad0a4ac99333f437e0ec168989adc5d837ecd38ddb2cc4a2e3db8a"}, + {file = "ruff-0.1.4-py3-none-win_arm64.whl", hash = "sha256:d98ae9ebf56444e18a3e3652b3383204748f73e247dea6caaf8b52d37e6b32da"}, + {file = "ruff-0.1.4.tar.gz", hash = "sha256:21520ecca4cc555162068d87c747b8f95e1e95f8ecfcbbe59e8dd00710586315"}, ] [[package]] @@ -3665,4 +3665,4 @@ desktop = ["opencv-python"] [metadata] lock-version = "2.0" python-versions = ">=3.8,<3.12.0" -content-hash = "578a95655c3b6ac0d14d8b8f0e26829d04af60b98a0b6a2a202e440aed7da409" +content-hash = "703468d28a0c1d50be97221b930c20aee63c325f788729bed06c36dd926743eb" diff --git a/pyproject.toml b/pyproject.toml index f4ea6ef1..a672ce4f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -57,7 +57,7 @@ pytest = "^7.2.2" wheel = ">=0.40,<0.42" notebook = ">=6.5.3,<8.0.0" build = ">=0.10,<1.1" -ruff = ">=0.0.280,<0.1.4" +ruff = ">=0.0.280,<0.1.5" isort = "^5.12.0" black = "^23.7.0" mypy = "^1.4.1" From 7946f54b95223cd87bfd6e54ae133a04a7cda3aa Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 6 Nov 2023 17:37:29 +0000 Subject: [PATCH 121/164] =?UTF-8?q?chore(pre=5Fcommit):=20=E2=AC=86=20pre?= =?UTF-8?q?=5Fcommit=20autoupdate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.3 → v0.1.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.3...v0.1.4) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e264874b..28d135ae 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -70,7 +70,7 @@ repos: - id: black - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.3 + rev: v0.1.4 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] From b89487d8e8b7f1de5b8c0abfda85c54042e3a740 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 9 Nov 2023 00:46:29 +0000 Subject: [PATCH 122/164] :arrow_up: Bump black from 23.10.1 to 23.11.0 Bumps [black](https://github.com/psf/black) from 23.10.1 to 23.11.0. - [Release notes](https://github.com/psf/black/releases) - [Changelog](https://github.com/psf/black/blob/main/CHANGES.md) - [Commits](https://github.com/psf/black/compare/23.10.1...23.11.0) --- updated-dependencies: - dependency-name: black dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- poetry.lock | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/poetry.lock b/poetry.lock index fff4f4a2..8243903e 100644 --- a/poetry.lock +++ b/poetry.lock @@ -199,29 +199,29 @@ lxml = ["lxml"] [[package]] name = "black" -version = "23.10.1" +version = "23.11.0" description = "The uncompromising code formatter." optional = false python-versions = ">=3.8" files = [ - {file = "black-23.10.1-cp310-cp310-macosx_10_16_arm64.whl", hash = "sha256:ec3f8e6234c4e46ff9e16d9ae96f4ef69fa328bb4ad08198c8cee45bb1f08c69"}, - {file = "black-23.10.1-cp310-cp310-macosx_10_16_x86_64.whl", hash = "sha256:1b917a2aa020ca600483a7b340c165970b26e9029067f019e3755b56e8dd5916"}, - {file = "black-23.10.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9c74de4c77b849e6359c6f01987e94873c707098322b91490d24296f66d067dc"}, - {file = "black-23.10.1-cp310-cp310-win_amd64.whl", hash = "sha256:7b4d10b0f016616a0d93d24a448100adf1699712fb7a4efd0e2c32bbb219b173"}, - {file = "black-23.10.1-cp311-cp311-macosx_10_16_arm64.whl", hash = "sha256:b15b75fc53a2fbcac8a87d3e20f69874d161beef13954747e053bca7a1ce53a0"}, - {file = "black-23.10.1-cp311-cp311-macosx_10_16_x86_64.whl", hash = "sha256:e293e4c2f4a992b980032bbd62df07c1bcff82d6964d6c9496f2cd726e246ace"}, - {file = "black-23.10.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7d56124b7a61d092cb52cce34182a5280e160e6aff3137172a68c2c2c4b76bcb"}, - {file = "black-23.10.1-cp311-cp311-win_amd64.whl", hash = "sha256:3f157a8945a7b2d424da3335f7ace89c14a3b0625e6593d21139c2d8214d55ce"}, - {file = "black-23.10.1-cp38-cp38-macosx_10_16_arm64.whl", hash = "sha256:cfcce6f0a384d0da692119f2d72d79ed07c7159879d0bb1bb32d2e443382bf3a"}, - {file = "black-23.10.1-cp38-cp38-macosx_10_16_x86_64.whl", hash = "sha256:33d40f5b06be80c1bbce17b173cda17994fbad096ce60eb22054da021bf933d1"}, - {file = "black-23.10.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:840015166dbdfbc47992871325799fd2dc0dcf9395e401ada6d88fe11498abad"}, - {file = "black-23.10.1-cp38-cp38-win_amd64.whl", hash = "sha256:037e9b4664cafda5f025a1728c50a9e9aedb99a759c89f760bd83730e76ba884"}, - {file = "black-23.10.1-cp39-cp39-macosx_10_16_arm64.whl", hash = "sha256:7cb5936e686e782fddb1c73f8aa6f459e1ad38a6a7b0e54b403f1f05a1507ee9"}, - {file = "black-23.10.1-cp39-cp39-macosx_10_16_x86_64.whl", hash = "sha256:7670242e90dc129c539e9ca17665e39a146a761e681805c54fbd86015c7c84f7"}, - {file = "black-23.10.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5ed45ac9a613fb52dad3b61c8dea2ec9510bf3108d4db88422bacc7d1ba1243d"}, - {file = "black-23.10.1-cp39-cp39-win_amd64.whl", hash = "sha256:6d23d7822140e3fef190734216cefb262521789367fbdc0b3f22af6744058982"}, - {file = "black-23.10.1-py3-none-any.whl", hash = "sha256:d431e6739f727bb2e0495df64a6c7a5310758e87505f5f8cde9ff6c0f2d7e4fe"}, - {file = "black-23.10.1.tar.gz", hash = "sha256:1f8ce316753428ff68749c65a5f7844631aa18c8679dfd3ca9dc1a289979c258"}, + {file = "black-23.11.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:dbea0bb8575c6b6303cc65017b46351dc5953eea5c0a59d7b7e3a2d2f433a911"}, + {file = "black-23.11.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:412f56bab20ac85927f3a959230331de5614aecda1ede14b373083f62ec24e6f"}, + {file = "black-23.11.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d136ef5b418c81660ad847efe0e55c58c8208b77a57a28a503a5f345ccf01394"}, + {file = "black-23.11.0-cp310-cp310-win_amd64.whl", hash = "sha256:6c1cac07e64433f646a9a838cdc00c9768b3c362805afc3fce341af0e6a9ae9f"}, + {file = "black-23.11.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:cf57719e581cfd48c4efe28543fea3d139c6b6f1238b3f0102a9c73992cbb479"}, + {file = "black-23.11.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:698c1e0d5c43354ec5d6f4d914d0d553a9ada56c85415700b81dc90125aac244"}, + {file = "black-23.11.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:760415ccc20f9e8747084169110ef75d545f3b0932ee21368f63ac0fee86b221"}, + {file = "black-23.11.0-cp311-cp311-win_amd64.whl", hash = "sha256:58e5f4d08a205b11800332920e285bd25e1a75c54953e05502052738fe16b3b5"}, + {file = "black-23.11.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:45aa1d4675964946e53ab81aeec7a37613c1cb71647b5394779e6efb79d6d187"}, + {file = "black-23.11.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:4c44b7211a3a0570cc097e81135faa5f261264f4dfaa22bd5ee2875a4e773bd6"}, + {file = "black-23.11.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2a9acad1451632021ee0d146c8765782a0c3846e0e0ea46659d7c4f89d9b212b"}, + {file = "black-23.11.0-cp38-cp38-win_amd64.whl", hash = "sha256:fc7f6a44d52747e65a02558e1d807c82df1d66ffa80a601862040a43ec2e3142"}, + {file = "black-23.11.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:7f622b6822f02bfaf2a5cd31fdb7cd86fcf33dab6ced5185c35f5db98260b055"}, + {file = "black-23.11.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:250d7e60f323fcfc8ea6c800d5eba12f7967400eb6c2d21ae85ad31c204fb1f4"}, + {file = "black-23.11.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5133f5507007ba08d8b7b263c7aa0f931af5ba88a29beacc4b2dc23fcefe9c06"}, + {file = "black-23.11.0-cp39-cp39-win_amd64.whl", hash = "sha256:421f3e44aa67138ab1b9bfbc22ee3780b22fa5b291e4db8ab7eee95200726b07"}, + {file = "black-23.11.0-py3-none-any.whl", hash = "sha256:54caaa703227c6e0c87b76326d0862184729a69b73d3b7305b6288e1d830067e"}, + {file = "black-23.11.0.tar.gz", hash = "sha256:4c68855825ff432d197229846f971bc4d6666ce90492e5b02013bcaca4d9ab05"}, ] [package.dependencies] From ed41153c190ae591d51e54049759bb0162f390c1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 9 Nov 2023 00:48:59 +0000 Subject: [PATCH 123/164] :arrow_up: Bump ruff from 0.1.4 to 0.1.5 Bumps [ruff](https://github.com/astral-sh/ruff) from 0.1.4 to 0.1.5. - [Release notes](https://github.com/astral-sh/ruff/releases) - [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md) - [Commits](https://github.com/astral-sh/ruff/compare/v0.1.4...v0.1.5) --- updated-dependencies: - dependency-name: ruff dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- poetry.lock | 38 +++++++++++++++++++------------------- pyproject.toml | 2 +- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/poetry.lock b/poetry.lock index fff4f4a2..bc6dd6c6 100644 --- a/poetry.lock +++ b/poetry.lock @@ -3166,28 +3166,28 @@ files = [ [[package]] name = "ruff" -version = "0.1.4" +version = "0.1.5" description = "An extremely fast Python linter and code formatter, written in Rust." optional = false python-versions = ">=3.7" files = [ - {file = "ruff-0.1.4-py3-none-macosx_10_7_x86_64.whl", hash = "sha256:864958706b669cce31d629902175138ad8a069d99ca53514611521f532d91495"}, - {file = "ruff-0.1.4-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:9fdd61883bb34317c788af87f4cd75dfee3a73f5ded714b77ba928e418d6e39e"}, - {file = "ruff-0.1.4-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b4eaca8c9cc39aa7f0f0d7b8fe24ecb51232d1bb620fc4441a61161be4a17539"}, - {file = "ruff-0.1.4-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:a9a1301dc43cbf633fb603242bccd0aaa34834750a14a4c1817e2e5c8d60de17"}, - {file = "ruff-0.1.4-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:78e8db8ab6f100f02e28b3d713270c857d370b8d61871d5c7d1702ae411df683"}, - {file = "ruff-0.1.4-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:80fea754eaae06335784b8ea053d6eb8e9aac75359ebddd6fee0858e87c8d510"}, - {file = "ruff-0.1.4-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:6bc02a480d4bfffd163a723698da15d1a9aec2fced4c06f2a753f87f4ce6969c"}, - {file = "ruff-0.1.4-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9862811b403063765b03e716dac0fda8fdbe78b675cd947ed5873506448acea4"}, - {file = "ruff-0.1.4-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:58826efb8b3efbb59bb306f4b19640b7e366967a31c049d49311d9eb3a4c60cb"}, - {file = "ruff-0.1.4-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:fdfd453fc91d9d86d6aaa33b1bafa69d114cf7421057868f0b79104079d3e66e"}, - {file = "ruff-0.1.4-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:e8791482d508bd0b36c76481ad3117987301b86072158bdb69d796503e1c84a8"}, - {file = "ruff-0.1.4-py3-none-musllinux_1_2_i686.whl", hash = "sha256:01206e361021426e3c1b7fba06ddcb20dbc5037d64f6841e5f2b21084dc51800"}, - {file = "ruff-0.1.4-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:645591a613a42cb7e5c2b667cbefd3877b21e0252b59272ba7212c3d35a5819f"}, - {file = "ruff-0.1.4-py3-none-win32.whl", hash = "sha256:99908ca2b3b85bffe7e1414275d004917d1e0dfc99d497ccd2ecd19ad115fd0d"}, - {file = "ruff-0.1.4-py3-none-win_amd64.whl", hash = "sha256:1dfd6bf8f6ad0a4ac99333f437e0ec168989adc5d837ecd38ddb2cc4a2e3db8a"}, - {file = "ruff-0.1.4-py3-none-win_arm64.whl", hash = "sha256:d98ae9ebf56444e18a3e3652b3383204748f73e247dea6caaf8b52d37e6b32da"}, - {file = "ruff-0.1.4.tar.gz", hash = "sha256:21520ecca4cc555162068d87c747b8f95e1e95f8ecfcbbe59e8dd00710586315"}, + {file = "ruff-0.1.5-py3-none-macosx_10_7_x86_64.whl", hash = "sha256:32d47fc69261c21a4c48916f16ca272bf2f273eb635d91c65d5cd548bf1f3d96"}, + {file = "ruff-0.1.5-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:171276c1df6c07fa0597fb946139ced1c2978f4f0b8254f201281729981f3c17"}, + {file = "ruff-0.1.5-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:17ef33cd0bb7316ca65649fc748acc1406dfa4da96a3d0cde6d52f2e866c7b39"}, + {file = "ruff-0.1.5-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:b2c205827b3f8c13b4a432e9585750b93fd907986fe1aec62b2a02cf4401eee6"}, + {file = "ruff-0.1.5-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:bb408e3a2ad8f6881d0f2e7ad70cddb3ed9f200eb3517a91a245bbe27101d379"}, + {file = "ruff-0.1.5-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:f20dc5e5905ddb407060ca27267c7174f532375c08076d1a953cf7bb016f5a24"}, + {file = "ruff-0.1.5-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:aafb9d2b671ed934998e881e2c0f5845a4295e84e719359c71c39a5363cccc91"}, + {file = "ruff-0.1.5-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a4894dddb476597a0ba4473d72a23151b8b3b0b5f958f2cf4d3f1c572cdb7af7"}, + {file = "ruff-0.1.5-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a00a7ec893f665ed60008c70fe9eeb58d210e6b4d83ec6654a9904871f982a2a"}, + {file = "ruff-0.1.5-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:a8c11206b47f283cbda399a654fd0178d7a389e631f19f51da15cbe631480c5b"}, + {file = "ruff-0.1.5-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:fa29e67b3284b9a79b1a85ee66e293a94ac6b7bb068b307a8a373c3d343aa8ec"}, + {file = "ruff-0.1.5-py3-none-musllinux_1_2_i686.whl", hash = "sha256:9b97fd6da44d6cceb188147b68db69a5741fbc736465b5cea3928fdac0bc1aeb"}, + {file = "ruff-0.1.5-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:721f4b9d3b4161df8dc9f09aa8562e39d14e55a4dbaa451a8e55bdc9590e20f4"}, + {file = "ruff-0.1.5-py3-none-win32.whl", hash = "sha256:f80c73bba6bc69e4fdc73b3991db0b546ce641bdcd5b07210b8ad6f64c79f1ab"}, + {file = "ruff-0.1.5-py3-none-win_amd64.whl", hash = "sha256:c21fe20ee7d76206d290a76271c1af7a5096bc4c73ab9383ed2ad35f852a0087"}, + {file = "ruff-0.1.5-py3-none-win_arm64.whl", hash = "sha256:82bfcb9927e88c1ed50f49ac6c9728dab3ea451212693fe40d08d314663e412f"}, + {file = "ruff-0.1.5.tar.gz", hash = "sha256:5cbec0ef2ae1748fb194f420fb03fb2c25c3258c86129af7172ff8f198f125ab"}, ] [[package]] @@ -3665,4 +3665,4 @@ desktop = ["opencv-python"] [metadata] lock-version = "2.0" python-versions = ">=3.8,<3.12.0" -content-hash = "703468d28a0c1d50be97221b930c20aee63c325f788729bed06c36dd926743eb" +content-hash = "b69d0991b98b566ecb1a0fd9b8d615750e305d1e18b1c6356798c90207db313f" diff --git a/pyproject.toml b/pyproject.toml index a672ce4f..f0684344 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -57,7 +57,7 @@ pytest = "^7.2.2" wheel = ">=0.40,<0.42" notebook = ">=6.5.3,<8.0.0" build = ">=0.10,<1.1" -ruff = ">=0.0.280,<0.1.5" +ruff = ">=0.0.280,<0.1.6" isort = "^5.12.0" black = "^23.7.0" mypy = "^1.4.1" From f9ead5543bf09c52b4af694cf67d566c38545319 Mon Sep 17 00:00:00 2001 From: Cody Chen Date: Thu, 9 Nov 2023 20:24:11 -0800 Subject: [PATCH 124/164] Ignore empty newlines in yolo label file --- supervision/dataset/formats/yolo.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/supervision/dataset/formats/yolo.py b/supervision/dataset/formats/yolo.py index d93b0465..577e8eb5 100644 --- a/supervision/dataset/formats/yolo.py +++ b/supervision/dataset/formats/yolo.py @@ -79,6 +79,8 @@ def yolo_annotations_to_detections( w, h = resolution_wh for line in lines: values = line.split() + if(len(values)==0): + continue class_id.append(int(values[0])) if len(values) == 5: box = _parse_box(values=values[1:]) From 1dce43747f790551c5d22fe67a252200590ee268 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 10 Nov 2023 04:41:50 +0000 Subject: [PATCH 125/164] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/dataset/formats/yolo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/supervision/dataset/formats/yolo.py b/supervision/dataset/formats/yolo.py index 577e8eb5..11aac4fc 100644 --- a/supervision/dataset/formats/yolo.py +++ b/supervision/dataset/formats/yolo.py @@ -79,7 +79,7 @@ def yolo_annotations_to_detections( w, h = resolution_wh for line in lines: values = line.split() - if(len(values)==0): + if len(values) == 0: continue class_id.append(int(values[0])) if len(values) == 5: From e416ef4c0efccb85b3aac42d5b4f3c3b6279e990 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Fri, 10 Nov 2023 10:15:08 -0800 Subject: [PATCH 126/164] Refactor import paths and improve text file reading Refactored import paths for test utility methods across multiple test files to align with a recent package restructure. Enriched 'read_txt_file' functionality in 'file.py' allowing to optionally skip empty lines, enhancing flexibility for various use-cases. Added tests for the new 'read_txt_file' behavior in a new 'test_file.py'. Renamed 'utils.py' in test package to 'test_utils.py' for better differentiation from the util package in the source code. --- supervision/dataset/formats/yolo.py | 4 +- supervision/utils/file.py | 11 ++- test/annotators/test_utils.py | 2 +- test/dataset/formats/test_pascal_voc.py | 2 +- test/dataset/test_core.py | 2 +- test/dataset/test_utils.py | 2 +- test/detection/test_core.py | 2 +- test/metrics/test_detection.py | 2 +- test/{utils.py => test_utils.py} | 0 test/utils/__init__.py | 0 test/utils/test_file.py | 95 +++++++++++++++++++++++++ 11 files changed, 110 insertions(+), 12 deletions(-) rename test/{utils.py => test_utils.py} (100%) create mode 100644 test/utils/__init__.py create mode 100644 test/utils/test_file.py diff --git a/supervision/dataset/formats/yolo.py b/supervision/dataset/formats/yolo.py index 11aac4fc..254f034d 100644 --- a/supervision/dataset/formats/yolo.py +++ b/supervision/dataset/formats/yolo.py @@ -79,8 +79,6 @@ def yolo_annotations_to_detections( w, h = resolution_wh for line in lines: values = line.split() - if len(values) == 0: - continue class_id.append(int(values[0])) if len(values) == 5: box = _parse_box(values=values[1:]) @@ -151,7 +149,7 @@ def load_yolo_annotations( annotations[image_path] = Detections.empty() continue - lines = read_txt_file(str(annotation_path)) + lines = read_txt_file(file_path=annotation_path, skip_empty=True) h, w, _ = image.shape resolution_wh = (w, h) diff --git a/supervision/utils/file.py b/supervision/utils/file.py index 3954f9d5..c0521236 100644 --- a/supervision/utils/file.py +++ b/supervision/utils/file.py @@ -57,19 +57,24 @@ def list_files_with_extensions( return files_with_extensions -def read_txt_file(file_path: str) -> List[str]: +def read_txt_file(file_path: str, skip_empty: bool = False) -> List[str]: """ Read a text file and return a list of strings without newline characters. + Optionally skip empty lines. Args: file_path (str): The path to the text file. + skip_empty (bool): If True, skip lines that are empty or contain only + whitespace. Default is False. Returns: List[str]: A list of strings representing the lines in the text file. """ with open(file_path, "r") as file: - lines = file.readlines() - lines = [line.rstrip("\n") for line in lines] + if skip_empty: + lines = [line.rstrip("\n") for line in file if line.strip()] + else: + lines = [line.rstrip("\n") for line in file] return lines diff --git a/test/annotators/test_utils.py b/test/annotators/test_utils.py index 98d9be6b..1344d213 100644 --- a/test/annotators/test_utils.py +++ b/test/annotators/test_utils.py @@ -1,5 +1,5 @@ from contextlib import ExitStack as DoesNotRaise -from test.utils import mock_detections +from test.test_utils import mock_detections from typing import Optional import numpy as np diff --git a/test/dataset/formats/test_pascal_voc.py b/test/dataset/formats/test_pascal_voc.py index 67d26c57..042748e9 100644 --- a/test/dataset/formats/test_pascal_voc.py +++ b/test/dataset/formats/test_pascal_voc.py @@ -1,6 +1,6 @@ import xml.etree.ElementTree as ET from contextlib import ExitStack as DoesNotRaise -from test.utils import mock_detections +from test.test_utils import mock_detections from typing import List, Optional import numpy as np diff --git a/test/dataset/test_core.py b/test/dataset/test_core.py index 72ae27f3..4a75225c 100644 --- a/test/dataset/test_core.py +++ b/test/dataset/test_core.py @@ -1,5 +1,5 @@ from contextlib import ExitStack as DoesNotRaise -from test.utils import mock_detections +from test.test_utils import mock_detections from typing import List, Optional import numpy as np diff --git a/test/dataset/test_utils.py b/test/dataset/test_utils.py index 6d0db2e5..5ca96ca5 100644 --- a/test/dataset/test_utils.py +++ b/test/dataset/test_utils.py @@ -1,5 +1,5 @@ from contextlib import ExitStack as DoesNotRaise -from test.utils import mock_detections +from test.test_utils import mock_detections from typing import Dict, List, Optional, Tuple, TypeVar import pytest diff --git a/test/detection/test_core.py b/test/detection/test_core.py index 02595d97..9708f338 100644 --- a/test/detection/test_core.py +++ b/test/detection/test_core.py @@ -1,5 +1,5 @@ from contextlib import ExitStack as DoesNotRaise -from test.utils import mock_detections +from test.test_utils import mock_detections from typing import List, Optional, Union import numpy as np diff --git a/test/metrics/test_detection.py b/test/metrics/test_detection.py index 796e6c81..7cb92c46 100644 --- a/test/metrics/test_detection.py +++ b/test/metrics/test_detection.py @@ -1,5 +1,5 @@ from contextlib import ExitStack as DoesNotRaise -from test.utils import assert_almost_equal, mock_detections +from test.test_utils import assert_almost_equal, mock_detections from typing import Optional, Union import numpy as np diff --git a/test/utils.py b/test/test_utils.py similarity index 100% rename from test/utils.py rename to test/test_utils.py diff --git a/test/utils/__init__.py b/test/utils/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/test/utils/test_file.py b/test/utils/test_file.py new file mode 100644 index 00000000..4780c073 --- /dev/null +++ b/test/utils/test_file.py @@ -0,0 +1,95 @@ +from contextlib import ExitStack as DoesNotRaise +from typing import List, Optional + +import pytest +import os + +from supervision.utils.file import read_txt_file + + +FILE_1_CONTENT = """Line 1 +Line 2 +Line 3 +""" + +FILE_2_CONTENT = """ +Line 2 + +Line 4 + +""" + +FILE_3_CONTENT = """ +Line 2 + +Line 4 + +""" + + +@pytest.fixture(scope="module", autouse=True) +def setup_and_teardown_files(): + with open("file_1.txt", "w") as file: + file.write(FILE_1_CONTENT) + with open("file_2.txt", "w") as file: + file.write(FILE_2_CONTENT) + with open("file_3.txt", "w") as file: + file.write(FILE_3_CONTENT) + + yield + + os.remove("file_1.txt") + os.remove("file_2.txt") + os.remove("file_3.txt") + + +@pytest.mark.parametrize( + "file_name, skip_empty, expected_result, exception", + [ + ( + "file_1.txt", + False, + ["Line 1", "Line 2", "Line 3"], + DoesNotRaise() + ), + ( + "file_2.txt", + True, + ["Line 2", "Line 4"], + DoesNotRaise() + ), + ( + "file_2.txt", + False, + [" ", "Line 2", "", "Line 4", ""], + DoesNotRaise() + ), + ( + "file_3.txt", + True, + ["Line 2", "Line 4"], + DoesNotRaise() + ), + ( + "file_3.txt", + False, + ["", "Line 2", "", "Line 4", ""], + DoesNotRaise() + ), + ( + "file_4.txt", + True, + None, + pytest.raises(FileNotFoundError) + ) + ] +) +def test_read_txt_file( + file_name: str, + skip_empty: bool, + expected_result: Optional[List[str]], + exception: Exception +): + with exception: + result = read_txt_file(file_name, skip_empty) + assert result == expected_result From 6211139201b992b708d21d5fba610773eb216d05 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 10 Nov 2023 18:15:38 +0000 Subject: [PATCH 127/164] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/utils/test_file.py | 51 ++++++++--------------------------------- 1 file changed, 10 insertions(+), 41 deletions(-) diff --git a/test/utils/test_file.py b/test/utils/test_file.py index 4780c073..681665c8 100644 --- a/test/utils/test_file.py +++ b/test/utils/test_file.py @@ -1,18 +1,17 @@ +import os from contextlib import ExitStack as DoesNotRaise from typing import List, Optional import pytest -import os from supervision.utils.file import read_txt_file - FILE_1_CONTENT = """Line 1 Line 2 Line 3 """ -FILE_2_CONTENT = """ +FILE_2_CONTENT = """ Line 2 Line 4 @@ -46,49 +45,19 @@ def setup_and_teardown_files(): @pytest.mark.parametrize( "file_name, skip_empty, expected_result, exception", [ - ( - "file_1.txt", - False, - ["Line 1", "Line 2", "Line 3"], - DoesNotRaise() - ), - ( - "file_2.txt", - True, - ["Line 2", "Line 4"], - DoesNotRaise() - ), - ( - "file_2.txt", - False, - [" ", "Line 2", "", "Line 4", ""], - DoesNotRaise() - ), - ( - "file_3.txt", - True, - ["Line 2", "Line 4"], - DoesNotRaise() - ), - ( - "file_3.txt", - False, - ["", "Line 2", "", "Line 4", ""], - DoesNotRaise() - ), - ( - "file_4.txt", - True, - None, - pytest.raises(FileNotFoundError) - ) - ] + ("file_1.txt", False, ["Line 1", "Line 2", "Line 3"], DoesNotRaise()), + ("file_2.txt", True, ["Line 2", "Line 4"], DoesNotRaise()), + ("file_2.txt", False, [" ", "Line 2", "", "Line 4", ""], DoesNotRaise()), + ("file_3.txt", True, ["Line 2", "Line 4"], DoesNotRaise()), + ("file_3.txt", False, ["", "Line 2", "", "Line 4", ""], DoesNotRaise()), + ("file_4.txt", True, None, pytest.raises(FileNotFoundError)), + ], ) def test_read_txt_file( file_name: str, skip_empty: bool, expected_result: Optional[List[str]], - exception: Exception + exception: Exception, ): with exception: result = read_txt_file(file_name, skip_empty) From 95f4b5c0b8be3919962f5c105dea44acfee3dccb Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Fri, 10 Nov 2023 10:25:59 -0800 Subject: [PATCH 128/164] Add linting rule exceptions for test_file.py Added linting rule exceptions for 'test/utils/test_file.py' in 'pyproject.toml'. Specifically, the 'W291' error which checks for trailing whitespace is ignored for this test file. This is necessary to test whether 'read_txt_file' function in 'test_utils.py' correctly ignores trailing whitespaces in varies test scenarios. --- pyproject.toml | 2 ++ test/utils/test_file.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index f0684344..9dc69b6e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -82,6 +82,7 @@ extend-ignore = """ per-file-ignores = """ __init__.py: F401 supervision/assets/list.py: E501 + test/utils/test_file.py: W291 """ [tool.isort] @@ -172,6 +173,7 @@ convention = "google" [tool.ruff.per-file-ignores] "__init__.py" = ["E402","F401"] "supervision/assets/list.py" = ["E501"] +"test/utils/test_file.py" = ["W291"] [tool.ruff.pylint] max-args = 20 diff --git a/test/utils/test_file.py b/test/utils/test_file.py index 681665c8..0d544aa9 100644 --- a/test/utils/test_file.py +++ b/test/utils/test_file.py @@ -11,7 +11,7 @@ Line 2 Line 3 """ -FILE_2_CONTENT = """ +FILE_2_CONTENT = """ Line 2 Line 4 From 08a48a4f5d0463cd8905f26917bd2cf452fb34a4 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 10 Nov 2023 18:26:25 +0000 Subject: [PATCH 129/164] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/utils/test_file.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/utils/test_file.py b/test/utils/test_file.py index 0d544aa9..681665c8 100644 --- a/test/utils/test_file.py +++ b/test/utils/test_file.py @@ -11,7 +11,7 @@ Line 2 Line 3 """ -FILE_2_CONTENT = """ +FILE_2_CONTENT = """ Line 2 Line 4 From 94a95110ce7d3a9a6f5f5c7ec419ac8ad79492c2 Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Fri, 10 Nov 2023 21:47:40 +0300 Subject: [PATCH 130/164] =?UTF-8?q?fix:=20=F0=9F=90=9E=20pre-commit=20fix?= =?UTF-8?q?=20and=20ignore=20removed=20(not=20needed)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Onuralp SEZER --- pyproject.toml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 9dc69b6e..f0c7ff4d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -82,7 +82,6 @@ extend-ignore = """ per-file-ignores = """ __init__.py: F401 supervision/assets/list.py: E501 - test/utils/test_file.py: W291 """ [tool.isort] @@ -173,7 +172,7 @@ convention = "google" [tool.ruff.per-file-ignores] "__init__.py" = ["E402","F401"] "supervision/assets/list.py" = ["E501"] -"test/utils/test_file.py" = ["W291"] + [tool.ruff.pylint] max-args = 20 From e8f0ceab71ceab4d166377b117abd77d6425769a Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Fri, 10 Nov 2023 22:07:47 +0300 Subject: [PATCH 131/164] =?UTF-8?q?fix:=20=F0=9F=90=9E=20test=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Onuralp SEZER --- test/utils/test_file.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/utils/test_file.py b/test/utils/test_file.py index 681665c8..30033362 100644 --- a/test/utils/test_file.py +++ b/test/utils/test_file.py @@ -47,7 +47,7 @@ def setup_and_teardown_files(): [ ("file_1.txt", False, ["Line 1", "Line 2", "Line 3"], DoesNotRaise()), ("file_2.txt", True, ["Line 2", "Line 4"], DoesNotRaise()), - ("file_2.txt", False, [" ", "Line 2", "", "Line 4", ""], DoesNotRaise()), + ("file_2.txt", False, ["", "Line 2", "", "Line 4", ""], DoesNotRaise()), ("file_3.txt", True, ["Line 2", "Line 4"], DoesNotRaise()), ("file_3.txt", False, ["", "Line 2", "", "Line 4", ""], DoesNotRaise()), ("file_4.txt", True, None, pytest.raises(FileNotFoundError)), From 7de7281e0e7bfef82b9f47539a9507be5ac6a600 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 13 Nov 2023 00:53:30 +0000 Subject: [PATCH 132/164] :arrow_up: Bump mypy from 1.6.1 to 1.7.0 Bumps [mypy](https://github.com/python/mypy) from 1.6.1 to 1.7.0. - [Changelog](https://github.com/python/mypy/blob/master/CHANGELOG.md) - [Commits](https://github.com/python/mypy/compare/v1.6.1...v1.7.0) --- updated-dependencies: - dependency-name: mypy dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- poetry.lock | 57 +++++++++++++++++++++++++++-------------------------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/poetry.lock b/poetry.lock index d28a4bb9..2fb1e252 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1870,38 +1870,38 @@ files = [ [[package]] name = "mypy" -version = "1.6.1" +version = "1.7.0" description = "Optional static typing for Python" optional = false python-versions = ">=3.8" files = [ - {file = "mypy-1.6.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:e5012e5cc2ac628177eaac0e83d622b2dd499e28253d4107a08ecc59ede3fc2c"}, - {file = "mypy-1.6.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:d8fbb68711905f8912e5af474ca8b78d077447d8f3918997fecbf26943ff3cbb"}, - {file = "mypy-1.6.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:21a1ad938fee7d2d96ca666c77b7c494c3c5bd88dff792220e1afbebb2925b5e"}, - {file = "mypy-1.6.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:b96ae2c1279d1065413965c607712006205a9ac541895004a1e0d4f281f2ff9f"}, - {file = "mypy-1.6.1-cp310-cp310-win_amd64.whl", hash = "sha256:40b1844d2e8b232ed92e50a4bd11c48d2daa351f9deee6c194b83bf03e418b0c"}, - {file = "mypy-1.6.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:81af8adaa5e3099469e7623436881eff6b3b06db5ef75e6f5b6d4871263547e5"}, - {file = "mypy-1.6.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:8c223fa57cb154c7eab5156856c231c3f5eace1e0bed9b32a24696b7ba3c3245"}, - {file = "mypy-1.6.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a8032e00ce71c3ceb93eeba63963b864bf635a18f6c0c12da6c13c450eedb183"}, - {file = "mypy-1.6.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:4c46b51de523817a0045b150ed11b56f9fff55f12b9edd0f3ed35b15a2809de0"}, - {file = "mypy-1.6.1-cp311-cp311-win_amd64.whl", hash = "sha256:19f905bcfd9e167159b3d63ecd8cb5e696151c3e59a1742e79bc3bcb540c42c7"}, - {file = "mypy-1.6.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:82e469518d3e9a321912955cc702d418773a2fd1e91c651280a1bda10622f02f"}, - {file = "mypy-1.6.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:d4473c22cc296425bbbce7e9429588e76e05bc7342da359d6520b6427bf76660"}, - {file = "mypy-1.6.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:59a0d7d24dfb26729e0a068639a6ce3500e31d6655df8557156c51c1cb874ce7"}, - {file = "mypy-1.6.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:cfd13d47b29ed3bbaafaff7d8b21e90d827631afda134836962011acb5904b71"}, - {file = "mypy-1.6.1-cp312-cp312-win_amd64.whl", hash = "sha256:eb4f18589d196a4cbe5290b435d135dee96567e07c2b2d43b5c4621b6501531a"}, - {file = "mypy-1.6.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:41697773aa0bf53ff917aa077e2cde7aa50254f28750f9b88884acea38a16169"}, - {file = "mypy-1.6.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:7274b0c57737bd3476d2229c6389b2ec9eefeb090bbaf77777e9d6b1b5a9d143"}, - {file = "mypy-1.6.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bbaf4662e498c8c2e352da5f5bca5ab29d378895fa2d980630656178bd607c46"}, - {file = "mypy-1.6.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:bb8ccb4724f7d8601938571bf3f24da0da791fe2db7be3d9e79849cb64e0ae85"}, - {file = "mypy-1.6.1-cp38-cp38-win_amd64.whl", hash = "sha256:68351911e85145f582b5aa6cd9ad666c8958bcae897a1bfda8f4940472463c45"}, - {file = "mypy-1.6.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:49ae115da099dcc0922a7a895c1eec82c1518109ea5c162ed50e3b3594c71208"}, - {file = "mypy-1.6.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:8b27958f8c76bed8edaa63da0739d76e4e9ad4ed325c814f9b3851425582a3cd"}, - {file = "mypy-1.6.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:925cd6a3b7b55dfba252b7c4561892311c5358c6b5a601847015a1ad4eb7d332"}, - {file = "mypy-1.6.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:8f57e6b6927a49550da3d122f0cb983d400f843a8a82e65b3b380d3d7259468f"}, - {file = "mypy-1.6.1-cp39-cp39-win_amd64.whl", hash = "sha256:a43ef1c8ddfdb9575691720b6352761f3f53d85f1b57d7745701041053deff30"}, - {file = "mypy-1.6.1-py3-none-any.whl", hash = "sha256:4cbe68ef919c28ea561165206a2dcb68591c50f3bcf777932323bc208d949cf1"}, - {file = "mypy-1.6.1.tar.gz", hash = "sha256:4d01c00d09a0be62a4ca3f933e315455bde83f37f892ba4b08ce92f3cf44bcc1"}, + {file = "mypy-1.7.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:5da84d7bf257fd8f66b4f759a904fd2c5a765f70d8b52dde62b521972a0a2357"}, + {file = "mypy-1.7.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:a3637c03f4025f6405737570d6cbfa4f1400eb3c649317634d273687a09ffc2f"}, + {file = "mypy-1.7.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b633f188fc5ae1b6edca39dae566974d7ef4e9aaaae00bc36efe1f855e5173ac"}, + {file = "mypy-1.7.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:d6ed9a3997b90c6f891138e3f83fb8f475c74db4ccaa942a1c7bf99e83a989a1"}, + {file = "mypy-1.7.0-cp310-cp310-win_amd64.whl", hash = "sha256:1fe46e96ae319df21359c8db77e1aecac8e5949da4773c0274c0ef3d8d1268a9"}, + {file = "mypy-1.7.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:df67fbeb666ee8828f675fee724cc2cbd2e4828cc3df56703e02fe6a421b7401"}, + {file = "mypy-1.7.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:a79cdc12a02eb526d808a32a934c6fe6df07b05f3573d210e41808020aed8b5d"}, + {file = "mypy-1.7.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f65f385a6f43211effe8c682e8ec3f55d79391f70a201575def73d08db68ead1"}, + {file = "mypy-1.7.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:0e81ffd120ee24959b449b647c4b2fbfcf8acf3465e082b8d58fd6c4c2b27e46"}, + {file = "mypy-1.7.0-cp311-cp311-win_amd64.whl", hash = "sha256:f29386804c3577c83d76520abf18cfcd7d68264c7e431c5907d250ab502658ee"}, + {file = "mypy-1.7.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:87c076c174e2c7ef8ab416c4e252d94c08cd4980a10967754f91571070bf5fbe"}, + {file = "mypy-1.7.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:6cb8d5f6d0fcd9e708bb190b224089e45902cacef6f6915481806b0c77f7786d"}, + {file = "mypy-1.7.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d93e76c2256aa50d9c82a88e2f569232e9862c9982095f6d54e13509f01222fc"}, + {file = "mypy-1.7.0-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:cddee95dea7990e2215576fae95f6b78a8c12f4c089d7e4367564704e99118d3"}, + {file = "mypy-1.7.0-cp312-cp312-win_amd64.whl", hash = "sha256:d01921dbd691c4061a3e2ecdbfbfad029410c5c2b1ee88946bf45c62c6c91210"}, + {file = "mypy-1.7.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:185cff9b9a7fec1f9f7d8352dff8a4c713b2e3eea9c6c4b5ff7f0edf46b91e41"}, + {file = "mypy-1.7.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:7a7b1e399c47b18feb6f8ad4a3eef3813e28c1e871ea7d4ea5d444b2ac03c418"}, + {file = "mypy-1.7.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fc9fe455ad58a20ec68599139ed1113b21f977b536a91b42bef3ffed5cce7391"}, + {file = "mypy-1.7.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:d0fa29919d2e720c8dbaf07d5578f93d7b313c3e9954c8ec05b6d83da592e5d9"}, + {file = "mypy-1.7.0-cp38-cp38-win_amd64.whl", hash = "sha256:2b53655a295c1ed1af9e96b462a736bf083adba7b314ae775563e3fb4e6795f5"}, + {file = "mypy-1.7.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:c1b06b4b109e342f7dccc9efda965fc3970a604db70f8560ddfdee7ef19afb05"}, + {file = "mypy-1.7.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:bf7a2f0a6907f231d5e41adba1a82d7d88cf1f61a70335889412dec99feeb0f8"}, + {file = "mypy-1.7.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:551d4a0cdcbd1d2cccdcc7cb516bb4ae888794929f5b040bb51aae1846062901"}, + {file = "mypy-1.7.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:55d28d7963bef00c330cb6461db80b0b72afe2f3c4e2963c99517cf06454e665"}, + {file = "mypy-1.7.0-cp39-cp39-win_amd64.whl", hash = "sha256:870bd1ffc8a5862e593185a4c169804f2744112b4a7c55b93eb50f48e7a77010"}, + {file = "mypy-1.7.0-py3-none-any.whl", hash = "sha256:96650d9a4c651bc2a4991cf46f100973f656d69edc7faf91844e87fe627f7e96"}, + {file = "mypy-1.7.0.tar.gz", hash = "sha256:1e280b5697202efa698372d2f39e9a6713a0395a756b1c6bd48995f8d72690dc"}, ] [package.dependencies] @@ -1912,6 +1912,7 @@ typing-extensions = ">=4.1.0" [package.extras] dmypy = ["psutil (>=4.0)"] install-types = ["pip"] +mypyc = ["setuptools (>=50)"] reports = ["lxml"] [[package]] From dd39360221c680d89208ec3754906db8362898f5 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 13 Nov 2023 17:46:54 +0000 Subject: [PATCH 133/164] =?UTF-8?q?chore(pre=5Fcommit):=20=E2=AC=86=20pre?= =?UTF-8?q?=5Fcommit=20autoupdate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0) - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.5](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.4...v0.1.5) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 28d135ae..22589884 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -65,12 +65,12 @@ repos: - repo: https://github.com/psf/black - rev: 23.10.1 + rev: 23.11.0 hooks: - id: black - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.4 + rev: v0.1.5 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] From 7f081f43144d1a492b6143bb1aab70b0b528703d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 14 Nov 2023 00:36:36 +0000 Subject: [PATCH 134/164] :arrow_up: Bump actions/github-script from 6 to 7 Bumps [actions/github-script](https://github.com/actions/github-script) from 6 to 7. - [Release notes](https://github.com/actions/github-script/releases) - [Commits](https://github.com/actions/github-script/compare/v6...v7) --- updated-dependencies: - dependency-name: actions/github-script dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/clear-cache.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/clear-cache.yml b/.github/workflows/clear-cache.yml index 76aed5cf..5b96de42 100644 --- a/.github/workflows/clear-cache.yml +++ b/.github/workflows/clear-cache.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Clear cache - uses: actions/github-script@v6 + uses: actions/github-script@v7 with: script: | console.log("About to clear") From 6ad1f701dd70ca924b5e350be2d96f3db4c97c51 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 15 Nov 2023 00:32:33 +0000 Subject: [PATCH 135/164] :arrow_up: Bump mkdocstrings from 0.23.0 to 0.24.0 Bumps [mkdocstrings](https://github.com/mkdocstrings/mkdocstrings) from 0.23.0 to 0.24.0. - [Release notes](https://github.com/mkdocstrings/mkdocstrings/releases) - [Changelog](https://github.com/mkdocstrings/mkdocstrings/blob/main/CHANGELOG.md) - [Commits](https://github.com/mkdocstrings/mkdocstrings/compare/0.23.0...0.24.0) --- updated-dependencies: - dependency-name: mkdocstrings dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- poetry.lock | 12 +++++++----- pyproject.toml | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/poetry.lock b/poetry.lock index d28a4bb9..e9a251da 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1817,23 +1817,25 @@ files = [ [[package]] name = "mkdocstrings" -version = "0.23.0" +version = "0.24.0" description = "Automatic documentation from sources, for MkDocs." optional = false python-versions = ">=3.8" files = [ - {file = "mkdocstrings-0.23.0-py3-none-any.whl", hash = "sha256:051fa4014dfcd9ed90254ae91de2dbb4f24e166347dae7be9a997fe16316c65e"}, - {file = "mkdocstrings-0.23.0.tar.gz", hash = "sha256:d9c6a37ffbe7c14a7a54ef1258c70b8d394e6a33a1c80832bce40b9567138d1c"}, + {file = "mkdocstrings-0.24.0-py3-none-any.whl", hash = "sha256:f4908560c10f587326d8f5165d1908817b2e280bbf707607f601c996366a2264"}, + {file = "mkdocstrings-0.24.0.tar.gz", hash = "sha256:222b1165be41257b494a9d29b14135d2b7ca43f38161d5b10caae03b87bd4f7e"}, ] [package.dependencies] +click = ">=7.0" importlib-metadata = {version = ">=4.6", markers = "python_version < \"3.10\""} Jinja2 = ">=2.11.1" Markdown = ">=3.3" MarkupSafe = ">=1.1" -mkdocs = ">=1.2" +mkdocs = ">=1.4" mkdocs-autorefs = ">=0.3.1" mkdocstrings-python = {version = ">=0.5.2", optional = true, markers = "extra == \"python\""} +platformdirs = ">=2.2.0" pymdown-extensions = ">=6.3" typing-extensions = {version = ">=4.1", markers = "python_version < \"3.10\""} @@ -3665,4 +3667,4 @@ desktop = ["opencv-python"] [metadata] lock-version = "2.0" python-versions = ">=3.8,<3.12.0" -content-hash = "b69d0991b98b566ecb1a0fd9b8d615750e305d1e18b1c6356798c90207db313f" +content-hash = "f2d0f1827c652b0ae160a093050bca163b13f2d166968893a0c5a02d27bfb856" diff --git a/pyproject.toml b/pyproject.toml index f0684344..c597daeb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -67,7 +67,7 @@ flake8 = { version = "*", python = ">=3.8.1,<3.12.0" } [tool.poetry.group.docs.dependencies] mkdocs-material = "^9.1.4" -mkdocstrings = {extras = ["python"], version = ">=0.20,<0.24"} +mkdocstrings = {extras = ["python"], version = ">=0.20,<0.25"} [tool.flake8] exclude = ".venv" From c28aa5aebda953b55c9d282098f0e2c9c9778425 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Wed, 15 Nov 2023 14:37:02 +0100 Subject: [PATCH 136/164] Updated tests to reflect changes in file content handling --- test/utils/test_file.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/utils/test_file.py b/test/utils/test_file.py index 30033362..0d544aa9 100644 --- a/test/utils/test_file.py +++ b/test/utils/test_file.py @@ -11,7 +11,7 @@ Line 2 Line 3 """ -FILE_2_CONTENT = """ +FILE_2_CONTENT = """ Line 2 Line 4 @@ -47,7 +47,7 @@ def setup_and_teardown_files(): [ ("file_1.txt", False, ["Line 1", "Line 2", "Line 3"], DoesNotRaise()), ("file_2.txt", True, ["Line 2", "Line 4"], DoesNotRaise()), - ("file_2.txt", False, ["", "Line 2", "", "Line 4", ""], DoesNotRaise()), + ("file_2.txt", False, [" ", "Line 2", "", "Line 4", ""], DoesNotRaise()), ("file_3.txt", True, ["Line 2", "Line 4"], DoesNotRaise()), ("file_3.txt", False, ["", "Line 2", "", "Line 4", ""], DoesNotRaise()), ("file_4.txt", True, None, pytest.raises(FileNotFoundError)), From fcfb57612fb9fdde140af842a7b1994277030834 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 15 Nov 2023 13:37:50 +0000 Subject: [PATCH 137/164] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/utils/test_file.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/utils/test_file.py b/test/utils/test_file.py index 0d544aa9..681665c8 100644 --- a/test/utils/test_file.py +++ b/test/utils/test_file.py @@ -11,7 +11,7 @@ Line 2 Line 3 """ -FILE_2_CONTENT = """ +FILE_2_CONTENT = """ Line 2 Line 4 From d3fb4ad9321d1f316614bd668e3c277766e1d653 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Wed, 15 Nov 2023 14:41:38 +0100 Subject: [PATCH 138/164] Ignoring W291 for test_file.py --- pyproject.toml | 2 ++ test/utils/test_file.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index f0c7ff4d..57a586ba 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -82,6 +82,7 @@ extend-ignore = """ per-file-ignores = """ __init__.py: F401 supervision/assets/list.py: E501 + test/utils/test_file.py: W291 """ [tool.isort] @@ -172,6 +173,7 @@ convention = "google" [tool.ruff.per-file-ignores] "__init__.py" = ["E402","F401"] "supervision/assets/list.py" = ["E501"] +"test/utils/test_file.py" = ["W291"] [tool.ruff.pylint] diff --git a/test/utils/test_file.py b/test/utils/test_file.py index 681665c8..0d544aa9 100644 --- a/test/utils/test_file.py +++ b/test/utils/test_file.py @@ -11,7 +11,7 @@ Line 2 Line 3 """ -FILE_2_CONTENT = """ +FILE_2_CONTENT = """ Line 2 Line 4 From 8025b468a277b508d8ae395df87597096c49d2ec Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 15 Nov 2023 13:42:25 +0000 Subject: [PATCH 139/164] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/utils/test_file.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/utils/test_file.py b/test/utils/test_file.py index 0d544aa9..681665c8 100644 --- a/test/utils/test_file.py +++ b/test/utils/test_file.py @@ -11,7 +11,7 @@ Line 2 Line 3 """ -FILE_2_CONTENT = """ +FILE_2_CONTENT = """ Line 2 Line 4 From b9573605c735cb08b2fe538ef9dfee4d6cb47c4b Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Wed, 15 Nov 2023 17:01:57 +0300 Subject: [PATCH 140/164] =?UTF-8?q?fix(test):=20=F0=9F=A7=AA=20pre-commit'?= =?UTF-8?q?s=20whitespace=20exclude=20and=20test=20case=20fix=20for=20whie?= =?UTF-8?q?space?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Onuralp SEZER --- .pre-commit-config.yaml | 1 + pyproject.toml | 2 -- test/utils/test_file.py | 4 ++-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 28d135ae..4ae65d64 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,6 +11,7 @@ repos: hooks: - id: end-of-file-fixer - id: trailing-whitespace + exclude: test/.*\.py - id: check-yaml - id: check-docstring-first - id: check-executables-have-shebangs diff --git a/pyproject.toml b/pyproject.toml index 57a586ba..f0c7ff4d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -82,7 +82,6 @@ extend-ignore = """ per-file-ignores = """ __init__.py: F401 supervision/assets/list.py: E501 - test/utils/test_file.py: W291 """ [tool.isort] @@ -173,7 +172,6 @@ convention = "google" [tool.ruff.per-file-ignores] "__init__.py" = ["E402","F401"] "supervision/assets/list.py" = ["E501"] -"test/utils/test_file.py" = ["W291"] [tool.ruff.pylint] diff --git a/test/utils/test_file.py b/test/utils/test_file.py index 681665c8..7a8dd37f 100644 --- a/test/utils/test_file.py +++ b/test/utils/test_file.py @@ -11,12 +11,12 @@ Line 2 Line 3 """ -FILE_2_CONTENT = """ +FILE_2_CONTENT = """ Line 2 Line 4 -""" +""" # noqa FILE_3_CONTENT = """ Line 2 From e40532cf3ef7ce90a1e6549ad716188df41f9c2c Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Wed, 15 Nov 2023 17:09:27 +0100 Subject: [PATCH 141/164] Add PolygonAnnotator and update documentation Implemented the PolygonAnnotator class in the core.py file under the supervision/annotators directory to support drawing polygons over detected objects. This was done by dividing the masks into multiple polygons and drawing them on the image. --- docs/annotators.md | 4 ++ supervision/annotators/core.py | 116 +++++++++++++++++++++++++++++---- 2 files changed, 106 insertions(+), 14 deletions(-) diff --git a/docs/annotators.md b/docs/annotators.md index efb77d11..7689845a 100644 --- a/docs/annotators.md +++ b/docs/annotators.md @@ -304,6 +304,10 @@ :::supervision.annotators.core.MaskAnnotator +## PolygonAnnotator + +:::supervision.annotators.core.PolygonAnnotator + ## LabelAnnotator :::supervision.annotators.core.LabelAnnotator diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index bd5181ab..7d2ab280 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -7,8 +7,9 @@ import numpy as np from supervision.annotators.base import BaseAnnotator from supervision.annotators.utils import ColorLookup, Trace, resolve_color from supervision.detection.core import Detections -from supervision.detection.utils import clip_boxes +from supervision.detection.utils import clip_boxes, mask_to_polygons from supervision.draw.color import Color, ColorPalette +from supervision.draw.utils import draw_polygon from supervision.geometry.core import Position @@ -51,7 +52,7 @@ class BoundingBoxAnnotator(BaseAnnotator): Allows to override the default color mapping strategy. Returns: - np.ndarray: The annotated image. + The annotated image. Example: ```python @@ -93,6 +94,10 @@ class BoundingBoxAnnotator(BaseAnnotator): class MaskAnnotator(BaseAnnotator): """ A class for drawing masks on an image using provided detections. + + !!! warning + + This annotator utilizes the `sv.Detections.mask`. """ def __init__( @@ -129,7 +134,7 @@ class MaskAnnotator(BaseAnnotator): Allows to override the default color mapping strategy. Returns: - np.ndarray: The annotated image. + The annotated image. Example: ```python @@ -170,6 +175,89 @@ class MaskAnnotator(BaseAnnotator): return scene +class PolygonAnnotator(BaseAnnotator): + """ + A class for drawing polygons on an image using provided detections. + + !!! warning + + This annotator utilizes the `sv.Detections.mask`. + """ + + def __init__( + self, + color: Union[Color, ColorPalette] = ColorPalette.default(), + thickness: int = 2, + color_lookup: ColorLookup = ColorLookup.CLASS, + ): + """ + Args: + color (Union[Color, ColorPalette]): The color or color palette to use for + annotating detections. + thickness (int): Thickness of the polygon lines. + color_lookup (str): Strategy for mapping colors to annotations. + Options are `INDEX`, `CLASS`, `TRACE`. + """ + self.color: Union[Color, ColorPalette] = color + self.thickness: int = thickness + self.color_lookup: ColorLookup = color_lookup + + def annotate( + self, + scene: np.ndarray, + detections: Detections, + custom_color_lookup: Optional[np.ndarray] = None + ) -> np.ndarray: + """ + Annotates the given scene with polygons based on the provided detections. + + Args: + scene (np.ndarray): The image where polygons will be drawn. + detections (Detections): Object detections to annotate. + custom_color_lookup (Optional[np.ndarray]): Custom color lookup array. + Allows to override the default color mapping strategy. + + Returns: + The annotated image. + + Example: + ```python + >>> import supervision as sv + + >>> image = ... + >>> detections = sv.Detections(...) + + >>> polygon_annotator = sv.PolygonAnnotator() + >>> annotated_frame = polygon_annotator.annotate( + ... scene=image.copy(), + ... detections=detections + ... ) + ``` + """ + if detections.mask is None: + return scene + + for detection_idx in range(len(detections)): + mask = detections.mask[detection_idx] + color = resolve_color( + color=self.color, + detections=detections, + detection_idx=detection_idx, + color_lookup=self.color_lookup + if custom_color_lookup is None + else custom_color_lookup, + ) + for polygon in mask_to_polygons(mask=mask): + scene = draw_polygon( + scene=scene, + polygon=polygon, + color=color, + thickness=self.thickness, + ) + + return scene + + class BoxMaskAnnotator(BaseAnnotator): """ A class for drawing box masks on an image using provided detections. @@ -209,7 +297,7 @@ class BoxMaskAnnotator(BaseAnnotator): Allows to override the default color mapping strategy. Returns: - np.ndarray: The annotated image. + The annotated image. Example: ```python @@ -295,7 +383,7 @@ class HaloAnnotator(BaseAnnotator): Allows to override the default color mapping strategy. Returns: - np.ndarray: The annotated image. + The annotated image. Example: ```python @@ -389,7 +477,7 @@ class EllipseAnnotator(BaseAnnotator): Allows to override the default color mapping strategy. Returns: - np.ndarray: The annotated image. + The annotated image. Example: ```python @@ -476,7 +564,7 @@ class BoxCornerAnnotator(BaseAnnotator): Allows to override the default color mapping strategy. Returns: - np.ndarray: The annotated image. + The annotated image. Example: ```python @@ -560,7 +648,7 @@ class CircleAnnotator(BaseAnnotator): Allows to override the default color mapping strategy. Returns: - np.ndarray: The annotated image. + The annotated image. Example: ```python @@ -646,7 +734,7 @@ class DotAnnotator(BaseAnnotator): Allows to override the default color mapping strategy. Returns: - np.ndarray: The annotated image. + The annotated image. Example: ```python @@ -776,7 +864,7 @@ class LabelAnnotator: Allows to override the default color mapping strategy. Returns: - np.ndarray: The annotated image. + The annotated image. Example: ```python @@ -873,7 +961,7 @@ class BlurAnnotator(BaseAnnotator): detections (Detections): Object detections to annotate. Returns: - np.ndarray: The annotated image. + The annotated image. Example: ```python @@ -911,7 +999,7 @@ class TraceAnnotator: !!! warning - This annotator utilizes the `tracker_id`. Read + This annotator utilizes the `sv.Detections.tracker_id`. Read [here](https://supervision.roboflow.com/trackers/) to learn how to plug tracking into your inference pipeline. """ @@ -959,7 +1047,7 @@ class TraceAnnotator: Allows to override the default color mapping strategy. Returns: - np.ndarray: The image with the trace paths drawn on it. + The annotated image. Example: ```python @@ -1055,7 +1143,7 @@ class HeatMapAnnotator: detections (Detections): Object detections to annotate. Returns: - np.ndarray: Annotated image. + Annotated image. Example: ```python From 777e8d3e5b9cb1c4e30cd0e981713828db264f60 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 15 Nov 2023 16:11:10 +0000 Subject: [PATCH 142/164] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/annotators/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index 7d2ab280..2ee1f968 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -206,7 +206,7 @@ class PolygonAnnotator(BaseAnnotator): self, scene: np.ndarray, detections: Detections, - custom_color_lookup: Optional[np.ndarray] = None + custom_color_lookup: Optional[np.ndarray] = None, ) -> np.ndarray: """ Annotates the given scene with polygons based on the provided detections. From c1beb0f5fdb0fd08d4b86179d9f2042daf5b6942 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Wed, 15 Nov 2023 17:30:06 +0100 Subject: [PATCH 143/164] Add PolygonAnnotator to supervision annotators --- supervision/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/supervision/__init__.py b/supervision/__init__.py index f4e70ead..44f25f7f 100644 --- a/supervision/__init__.py +++ b/supervision/__init__.py @@ -18,6 +18,7 @@ from supervision.annotators.core import ( HeatMapAnnotator, LabelAnnotator, MaskAnnotator, + PolygonAnnotator, TraceAnnotator, ) from supervision.annotators.utils import ColorLookup From 2ed4e16ab5de8c7e5a10c24c416c41530d53a5a3 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Wed, 15 Nov 2023 17:49:17 +0100 Subject: [PATCH 144/164] Added a visual and code example for `PolygonAnnotator` in `supervision/annotators/core.py` and `docs/annotators.md`. --- docs/annotators.md | 21 +++++++++++++++++++++ supervision/annotators/core.py | 7 +++++++ 2 files changed, 28 insertions(+) diff --git a/docs/annotators.md b/docs/annotators.md index 7689845a..7dd8124d 100644 --- a/docs/annotators.md +++ b/docs/annotators.md @@ -166,6 +166,27 @@ +=== "Polygon" + + ```python + >>> import supervision as sv + + >>> image = ... + >>> detections = sv.Detections(...) + + >>> polygon_annotator = sv.PolygonAnnotator() + >>> annotated_frame = polygon_annotator.annotate( + ... scene=image.copy(), + ... detections=detections + ... ) + ``` + +
+ + ![polygon-annotator-example](https://media.roboflow.com/supervision-annotator-examples/polygon-annotator-example-purple.png){ align=center width="800" } + +
+ === "Label" ```python diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index 2ee1f968..0e34cc16 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -233,6 +233,9 @@ class PolygonAnnotator(BaseAnnotator): ... detections=detections ... ) ``` + + ![polygon-annotator-example](https://media.roboflow.com/ + supervision-annotator-examples/polygon-annotator-example-purple.png) """ if detections.mask is None: return scene @@ -343,6 +346,10 @@ class BoxMaskAnnotator(BaseAnnotator): class HaloAnnotator(BaseAnnotator): """ A class for drawing Halos on an image using provided detections. + + !!! warning + + This annotator utilizes the `sv.Detections.mask`. """ def __init__( From 95006dca14e9b5aa4e2312565b4f736157496d96 Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Wed, 15 Nov 2023 22:11:32 +0300 Subject: [PATCH 145/164] =?UTF-8?q?fix:=20=F0=9F=90=9E=20gh-pages=20permis?= =?UTF-8?q?sion=20fix=20for=20deployment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/docs.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index c15768df..85c8c51b 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -6,6 +6,12 @@ on: - master - main - develop + +permissions: + contents: write + pages: write + pull-requests: write + jobs: deploy: runs-on: ubuntu-latest From 50e561a4fb80231ad0331404d8aa05158a910879 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Thu, 16 Nov 2023 13:52:32 +0100 Subject: [PATCH 146/164] Add centroid calculation for binary masks Added `calculate_centroids` function to compute center of mass for binary mask representations. Method added to `utils.py` and method import added to `core.py`. `Position` enumeration updated with `CENTER_OF_MASS` constant. Test function is added with test cases covering different mask scenarios. Update allows for masks to carry center of mass information too, useful in object detection. --- supervision/detection/core.py | 11 +++- supervision/detection/utils.py | 30 +++++++++++ supervision/geometry/core.py | 1 + test/detection/test_utils.py | 98 +++++++++++++++++++++++++++++++++- 4 files changed, 137 insertions(+), 3 deletions(-) diff --git a/supervision/detection/core.py b/supervision/detection/core.py index 77bfca9d..63f21fbf 100644 --- a/supervision/detection/core.py +++ b/supervision/detection/core.py @@ -9,7 +9,7 @@ from supervision.detection.utils import ( extract_ultralytics_masks, non_max_suppression, process_roboflow_result, - xywh_to_xyxy, + xywh_to_xyxy, calculate_centroids, ) from supervision.geometry.core import Position @@ -627,6 +627,15 @@ class Detections: (self.xyxy[:, 1] + self.xyxy[:, 3]) / 2, ] ).transpose() + if anchor == Position.CENTER_OF_MASS: + if self.mask is None: + return np.array( + [ + (self.xyxy[:, 0] + self.xyxy[:, 2]) / 2, + (self.xyxy[:, 1] + self.xyxy[:, 3]) / 2, + ] + ).transpose() + return calculate_centroids(masks=self.mask) elif anchor == Position.CENTER_LEFT: return np.array( [ diff --git a/supervision/detection/utils.py b/supervision/detection/utils.py index 7aa2c846..54780f70 100644 --- a/supervision/detection/utils.py +++ b/supervision/detection/utils.py @@ -393,3 +393,33 @@ def move_boxes(xyxy: np.ndarray, offset: np.ndarray) -> np.ndarray: (np.ndarray) repositioned bounding boxes """ return xyxy + np.hstack([offset, offset]) + + +def calculate_centroids(masks: np.ndarray) -> np.ndarray: + """ + Calculate the centroids of binary masks in a tensor. + + Parameters: + masks (np.ndarray): A 3D NumPy array of shape (num_masks, height, width). + Each 2D array in the tensor represents a binary mask. + + Returns: + A 2D NumPy array of shape (num_masks, 2), where each row contains the x and y + coordinates (in that order) of the centroid of the corresponding mask. + """ + num_masks, height, width = masks.shape + total_pixels = masks.sum(axis=(1, 2)) + + # offset for 1-based indexing + vertical_indices, horizontal_indices = np.indices((height, width)) + 0.5 + # avoid division by zero for empty masks + total_pixels[total_pixels == 0] = 1 + + def sum_over_mask(indices: np.ndarray, axis: tuple) -> np.ndarray: + return np.tensordot(masks, indices, axes=axis) + + aggregation_axis = ([1, 2], [0, 1]) + centroid_x = sum_over_mask(horizontal_indices, aggregation_axis) / total_pixels + centroid_y = sum_over_mask(vertical_indices, aggregation_axis) / total_pixels + + return np.column_stack((centroid_x, centroid_y)).astype(int) diff --git a/supervision/geometry/core.py b/supervision/geometry/core.py index 1771a356..d118b5a4 100644 --- a/supervision/geometry/core.py +++ b/supervision/geometry/core.py @@ -19,6 +19,7 @@ class Position(Enum): BOTTOM_LEFT = "BOTTOM_LEFT" BOTTOM_CENTER = "BOTTOM_CENTER" BOTTOM_RIGHT = "BOTTOM_RIGHT" + CENTER_OF_MASS = "CENTER_OF_MASS" @classmethod def list(cls): diff --git a/test/detection/test_utils.py b/test/detection/test_utils.py index 6b3249b4..a986ce5b 100644 --- a/test/detection/test_utils.py +++ b/test/detection/test_utils.py @@ -10,6 +10,7 @@ from supervision.detection.utils import ( move_boxes, non_max_suppression, process_roboflow_result, + calculate_centroids, ) TEST_MASK = np.zeros((1, 1000, 1000), dtype=bool) @@ -498,5 +499,98 @@ def test_move_boxes( expected_result: np.ndarray, exception: Exception, ) -> None: - result = move_boxes(xyxy=xyxy, offset=offset) - assert np.array_equal(result, expected_result) + with exception: + result = move_boxes(xyxy=xyxy, offset=offset) + assert np.array_equal(result, expected_result) + + +@pytest.mark.parametrize( + "masks, expected_result, exception", + [ + ( + np.array([ + [ + [0, 0, 0, 0], + [0, 0, 0, 0], + [0, 0, 0, 0], + [0, 0, 0, 0], + ] + ]), + np.array([ + [0, 0] + ]), + DoesNotRaise(), + ), # single mask with all zeros + ( + np.array([ + [ + [1, 1, 1, 1], + [1, 1, 1, 1], + [1, 1, 1, 1], + [1, 1, 1, 1], + ] + ]), + np.array([ + [2, 2] + ]), + DoesNotRaise(), + ), # single mask with all ones + ( + np.array([ + [ + [0, 1, 1, 0], + [1, 1, 1, 1], + [1, 1, 1, 1], + [0, 1, 1, 0], + ] + ]), + np.array([ + [2, 2] + ]), + DoesNotRaise(), + ), # single mask with symmetric ones + ( + np.array([ + [ + [0, 0, 0, 0], + [0, 0, 1, 1], + [0, 0, 1, 1], + [0, 0, 0, 0], + ] + ]), + np.array([ + [3, 2] + ]), + DoesNotRaise(), + ), # single mask with asymmetric ones + ( + np.array([ + [ + [0, 1, 1, 0], + [1, 1, 1, 1], + [1, 1, 1, 1], + [0, 1, 1, 0], + ], + [ + [0, 0, 0, 0], + [0, 0, 1, 1], + [0, 0, 1, 1], + [0, 0, 0, 0], + ] + ]), + np.array([ + [2, 2], + [3, 2] + ]), + DoesNotRaise(), + ), # two masks + ] +) +def test_calculate_centroids( + masks: np.ndarray, + expected_result: np.ndarray, + exception: Exception, +) -> None: + with exception: + result = calculate_centroids(masks=masks) + assert np.array_equal(result, expected_result) From 72ab46687fdc505e819845030a788b6eb4fa658b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 16 Nov 2023 12:59:15 +0000 Subject: [PATCH 147/164] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/detection/core.py | 3 +- test/detection/test_utils.py | 107 +++++++++++++++++----------------- 2 files changed, 55 insertions(+), 55 deletions(-) diff --git a/supervision/detection/core.py b/supervision/detection/core.py index 63f21fbf..40dc9d20 100644 --- a/supervision/detection/core.py +++ b/supervision/detection/core.py @@ -6,10 +6,11 @@ from typing import Any, Iterator, List, Optional, Tuple, Union import numpy as np from supervision.detection.utils import ( + calculate_centroids, extract_ultralytics_masks, non_max_suppression, process_roboflow_result, - xywh_to_xyxy, calculate_centroids, + xywh_to_xyxy, ) from supervision.geometry.core import Position diff --git a/test/detection/test_utils.py b/test/detection/test_utils.py index a986ce5b..d0e9fd84 100644 --- a/test/detection/test_utils.py +++ b/test/detection/test_utils.py @@ -5,12 +5,12 @@ import numpy as np import pytest from supervision.detection.utils import ( + calculate_centroids, clip_boxes, filter_polygons_by_area, move_boxes, non_max_suppression, process_roboflow_result, - calculate_centroids, ) TEST_MASK = np.zeros((1, 1000, 1000), dtype=bool) @@ -508,83 +508,82 @@ def test_move_boxes( "masks, expected_result, exception", [ ( - np.array([ + np.array( [ - [0, 0, 0, 0], - [0, 0, 0, 0], - [0, 0, 0, 0], - [0, 0, 0, 0], + [ + [0, 0, 0, 0], + [0, 0, 0, 0], + [0, 0, 0, 0], + [0, 0, 0, 0], + ] ] - ]), - np.array([ - [0, 0] - ]), + ), + np.array([[0, 0]]), DoesNotRaise(), ), # single mask with all zeros ( - np.array([ + np.array( [ - [1, 1, 1, 1], - [1, 1, 1, 1], - [1, 1, 1, 1], - [1, 1, 1, 1], + [ + [1, 1, 1, 1], + [1, 1, 1, 1], + [1, 1, 1, 1], + [1, 1, 1, 1], + ] ] - ]), - np.array([ - [2, 2] - ]), + ), + np.array([[2, 2]]), DoesNotRaise(), ), # single mask with all ones ( - np.array([ + np.array( [ - [0, 1, 1, 0], - [1, 1, 1, 1], - [1, 1, 1, 1], - [0, 1, 1, 0], + [ + [0, 1, 1, 0], + [1, 1, 1, 1], + [1, 1, 1, 1], + [0, 1, 1, 0], + ] ] - ]), - np.array([ - [2, 2] - ]), + ), + np.array([[2, 2]]), DoesNotRaise(), ), # single mask with symmetric ones ( - np.array([ + np.array( [ - [0, 0, 0, 0], - [0, 0, 1, 1], - [0, 0, 1, 1], - [0, 0, 0, 0], + [ + [0, 0, 0, 0], + [0, 0, 1, 1], + [0, 0, 1, 1], + [0, 0, 0, 0], + ] ] - ]), - np.array([ - [3, 2] - ]), + ), + np.array([[3, 2]]), DoesNotRaise(), ), # single mask with asymmetric ones ( - np.array([ + np.array( [ - [0, 1, 1, 0], - [1, 1, 1, 1], - [1, 1, 1, 1], - [0, 1, 1, 0], - ], - [ - [0, 0, 0, 0], - [0, 0, 1, 1], - [0, 0, 1, 1], - [0, 0, 0, 0], + [ + [0, 1, 1, 0], + [1, 1, 1, 1], + [1, 1, 1, 1], + [0, 1, 1, 0], + ], + [ + [0, 0, 0, 0], + [0, 0, 1, 1], + [0, 0, 1, 1], + [0, 0, 0, 0], + ], ] - ]), - np.array([ - [2, 2], - [3, 2] - ]), + ), + np.array([[2, 2], [3, 2]]), DoesNotRaise(), ), # two masks - ] + ], ) def test_calculate_centroids( masks: np.ndarray, From 7750856c18002f150f0501d30fd87b030553c92f Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Thu, 16 Nov 2023 15:23:55 +0100 Subject: [PATCH 148/164] Fix method names and improve code formatting Renamed methods to improve clarity. `get_anchor_coordinates` changed to `get_anchors_coordinates` and `calculate_centroids` changed to `calculate_masks_centroids`. Indentation for method arguments was adjusted in `core.py` and other files for better readability. Functionality remains the same, these changes are meant to improve code maintainability and readability. --- supervision/annotators/core.py | 291 ++++++++++---------- supervision/annotators/utils.py | 2 +- supervision/detection/core.py | 17 +- supervision/detection/tools/polygon_zone.py | 2 +- supervision/detection/utils.py | 2 +- test/detection/test_core.py | 2 +- test/detection/test_utils.py | 6 +- 7 files changed, 159 insertions(+), 163 deletions(-) diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index 0e34cc16..cc8bfe4c 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -19,10 +19,10 @@ class BoundingBoxAnnotator(BaseAnnotator): """ def __init__( - self, - color: Union[Color, ColorPalette] = ColorPalette.default(), - thickness: int = 2, - color_lookup: ColorLookup = ColorLookup.CLASS, + self, + color: Union[Color, ColorPalette] = ColorPalette.default(), + thickness: int = 2, + color_lookup: ColorLookup = ColorLookup.CLASS, ): """ Args: @@ -37,10 +37,10 @@ class BoundingBoxAnnotator(BaseAnnotator): self.color_lookup: ColorLookup = color_lookup def annotate( - self, - scene: np.ndarray, - detections: Detections, - custom_color_lookup: Optional[np.ndarray] = None, + self, + scene: np.ndarray, + detections: Detections, + custom_color_lookup: Optional[np.ndarray] = None, ) -> np.ndarray: """ Annotates the given scene with bounding boxes based on the provided detections. @@ -101,10 +101,10 @@ class MaskAnnotator(BaseAnnotator): """ def __init__( - self, - color: Union[Color, ColorPalette] = ColorPalette.default(), - opacity: float = 0.5, - color_lookup: ColorLookup = ColorLookup.CLASS, + self, + color: Union[Color, ColorPalette] = ColorPalette.default(), + opacity: float = 0.5, + color_lookup: ColorLookup = ColorLookup.CLASS, ): """ Args: @@ -119,10 +119,10 @@ class MaskAnnotator(BaseAnnotator): self.color_lookup: ColorLookup = color_lookup def annotate( - self, - scene: np.ndarray, - detections: Detections, - custom_color_lookup: Optional[np.ndarray] = None, + self, + scene: np.ndarray, + detections: Detections, + custom_color_lookup: Optional[np.ndarray] = None, ) -> np.ndarray: """ Annotates the given scene with masks based on the provided detections. @@ -185,10 +185,10 @@ class PolygonAnnotator(BaseAnnotator): """ def __init__( - self, - color: Union[Color, ColorPalette] = ColorPalette.default(), - thickness: int = 2, - color_lookup: ColorLookup = ColorLookup.CLASS, + self, + color: Union[Color, ColorPalette] = ColorPalette.default(), + thickness: int = 2, + color_lookup: ColorLookup = ColorLookup.CLASS, ): """ Args: @@ -203,10 +203,10 @@ class PolygonAnnotator(BaseAnnotator): self.color_lookup: ColorLookup = color_lookup def annotate( - self, - scene: np.ndarray, - detections: Detections, - custom_color_lookup: Optional[np.ndarray] = None, + self, + scene: np.ndarray, + detections: Detections, + custom_color_lookup: Optional[np.ndarray] = None, ) -> np.ndarray: """ Annotates the given scene with polygons based on the provided detections. @@ -267,10 +267,10 @@ class BoxMaskAnnotator(BaseAnnotator): """ def __init__( - self, - color: Union[Color, ColorPalette] = ColorPalette.default(), - opacity: float = 0.5, - color_lookup: ColorLookup = ColorLookup.CLASS, + self, + color: Union[Color, ColorPalette] = ColorPalette.default(), + opacity: float = 0.5, + color_lookup: ColorLookup = ColorLookup.CLASS, ): """ Args: @@ -285,10 +285,10 @@ class BoxMaskAnnotator(BaseAnnotator): self.opacity = opacity def annotate( - self, - scene: np.ndarray, - detections: Detections, - custom_color_lookup: Optional[np.ndarray] = None, + self, + scene: np.ndarray, + detections: Detections, + custom_color_lookup: Optional[np.ndarray] = None, ) -> np.ndarray: """ Annotates the given scene with box masks based on the provided detections. @@ -353,11 +353,11 @@ class HaloAnnotator(BaseAnnotator): """ def __init__( - self, - color: Union[Color, ColorPalette] = ColorPalette.default(), - opacity: float = 0.8, - kernel_size: int = 40, - color_lookup: ColorLookup = ColorLookup.CLASS, + self, + color: Union[Color, ColorPalette] = ColorPalette.default(), + opacity: float = 0.8, + kernel_size: int = 40, + color_lookup: ColorLookup = ColorLookup.CLASS, ): """ Args: @@ -375,10 +375,10 @@ class HaloAnnotator(BaseAnnotator): self.kernel_size: int = kernel_size def annotate( - self, - scene: np.ndarray, - detections: Detections, - custom_color_lookup: Optional[np.ndarray] = None, + self, + scene: np.ndarray, + detections: Detections, + custom_color_lookup: Optional[np.ndarray] = None, ) -> np.ndarray: """ Annotates the given scene with halos based on the provided detections. @@ -445,12 +445,12 @@ class EllipseAnnotator(BaseAnnotator): """ def __init__( - self, - color: Union[Color, ColorPalette] = ColorPalette.default(), - thickness: int = 2, - start_angle: int = -45, - end_angle: int = 235, - color_lookup: ColorLookup = ColorLookup.CLASS, + self, + color: Union[Color, ColorPalette] = ColorPalette.default(), + thickness: int = 2, + start_angle: int = -45, + end_angle: int = 235, + color_lookup: ColorLookup = ColorLookup.CLASS, ): """ Args: @@ -469,10 +469,10 @@ class EllipseAnnotator(BaseAnnotator): self.color_lookup: ColorLookup = color_lookup def annotate( - self, - scene: np.ndarray, - detections: Detections, - custom_color_lookup: Optional[np.ndarray] = None, + self, + scene: np.ndarray, + detections: Detections, + custom_color_lookup: Optional[np.ndarray] = None, ) -> np.ndarray: """ Annotates the given scene with ellipses based on the provided detections. @@ -535,11 +535,11 @@ class BoxCornerAnnotator(BaseAnnotator): """ def __init__( - self, - color: Union[Color, ColorPalette] = ColorPalette.default(), - thickness: int = 4, - corner_length: int = 15, - color_lookup: ColorLookup = ColorLookup.CLASS, + self, + color: Union[Color, ColorPalette] = ColorPalette.default(), + thickness: int = 4, + corner_length: int = 15, + color_lookup: ColorLookup = ColorLookup.CLASS, ): """ Args: @@ -556,10 +556,10 @@ class BoxCornerAnnotator(BaseAnnotator): self.color_lookup: ColorLookup = color_lookup def annotate( - self, - scene: np.ndarray, - detections: Detections, - custom_color_lookup: Optional[np.ndarray] = None, + self, + scene: np.ndarray, + detections: Detections, + custom_color_lookup: Optional[np.ndarray] = None, ) -> np.ndarray: """ Annotates the given scene with box corners based on the provided detections. @@ -621,10 +621,10 @@ class CircleAnnotator(BaseAnnotator): """ def __init__( - self, - color: Union[Color, ColorPalette] = ColorPalette.default(), - thickness: int = 2, - color_lookup: ColorLookup = ColorLookup.CLASS, + self, + color: Union[Color, ColorPalette] = ColorPalette.default(), + thickness: int = 2, + color_lookup: ColorLookup = ColorLookup.CLASS, ): """ Args: @@ -640,10 +640,10 @@ class CircleAnnotator(BaseAnnotator): self.color_lookup: ColorLookup = color_lookup def annotate( - self, - scene: np.ndarray, - detections: Detections, - custom_color_lookup: Optional[np.ndarray] = None, + self, + scene: np.ndarray, + detections: Detections, + custom_color_lookup: Optional[np.ndarray] = None, ) -> np.ndarray: """ Annotates the given scene with circles based on the provided detections. @@ -705,11 +705,11 @@ class DotAnnotator(BaseAnnotator): """ def __init__( - self, - color: Union[Color, ColorPalette] = ColorPalette.default(), - radius: int = 4, - position: Position = Position.CENTER, - color_lookup: ColorLookup = ColorLookup.CLASS, + self, + color: Union[Color, ColorPalette] = ColorPalette.default(), + radius: int = 4, + position: Position = Position.CENTER, + color_lookup: ColorLookup = ColorLookup.CLASS, ): """ Args: @@ -726,10 +726,10 @@ class DotAnnotator(BaseAnnotator): self.color_lookup: ColorLookup = color_lookup def annotate( - self, - scene: np.ndarray, - detections: Detections, - custom_color_lookup: Optional[np.ndarray] = None, + self, + scene: np.ndarray, + detections: Detections, + custom_color_lookup: Optional[np.ndarray] = None, ) -> np.ndarray: """ Annotates the given scene with dots based on the provided detections. @@ -760,7 +760,7 @@ class DotAnnotator(BaseAnnotator): ![dot-annotator-example](https://media.roboflow.com/ supervision-annotator-examples/dot-annotator-example-purple.png) """ - xy = detections.get_anchor_coordinates(anchor=self.position) + xy = detections.get_anchors_coordinates(anchor=self.position) for detection_idx in range(len(detections)): color = resolve_color( color=self.color, @@ -781,14 +781,14 @@ class LabelAnnotator: """ def __init__( - self, - color: Union[Color, ColorPalette] = ColorPalette.default(), - text_color: Color = Color.black(), - text_scale: float = 0.5, - text_thickness: int = 1, - text_padding: int = 10, - text_position: Position = Position.TOP_LEFT, - color_lookup: ColorLookup = ColorLookup.CLASS, + self, + color: Union[Color, ColorPalette] = ColorPalette.default(), + text_color: Color = Color.black(), + text_scale: float = 0.5, + text_thickness: int = 1, + text_padding: int = 10, + text_position: Position = Position.TOP_LEFT, + color_lookup: ColorLookup = ColorLookup.CLASS, ): """ Args: @@ -808,57 +808,54 @@ class LabelAnnotator: self.text_scale: float = text_scale self.text_thickness: int = text_thickness self.text_padding: int = text_padding - self.text_position: Position = text_position + self.text_anchor: Position = text_position self.color_lookup: ColorLookup = color_lookup @staticmethod def resolve_text_background_xyxy( - detection_xyxy: Tuple[int, int, int, int], - text_wh: Tuple[int, int], - text_padding: int, - position: Position, + center_coordinates: Tuple[int, int], + text_wh: Tuple[int, int], + position: Position, ) -> Tuple[int, int, int, int]: - padded_text_wh = (text_wh[0] + 2 * text_padding, text_wh[1] + 2 * text_padding) - x1, y1, x2, y2 = detection_xyxy - center_x = (x1 + x2) // 2 - center_y = (y1 + y2) // 2 + center_x, center_y = center_coordinates + text_w, text_h = text_wh if position == Position.TOP_LEFT: - return x1, y1 - padded_text_wh[1], x1 + padded_text_wh[0], y1 + return center_x, center_y - text_h, center_x + text_w, center_y elif position == Position.TOP_RIGHT: - return x2 - padded_text_wh[0], y1 - padded_text_wh[1], x2, y1 + return center_x - text_w, center_y - text_h, center_x, center_y elif position == Position.TOP_CENTER: return ( - center_x - padded_text_wh[0] // 2, - y1 - padded_text_wh[1], - center_x + padded_text_wh[0] // 2, - y1, + center_x - text_w // 2, + center_y - text_h, + center_x + text_w // 2, + center_y ) - elif position == Position.CENTER: + elif position == Position.CENTER or position == Position.CENTER_OF_MASS: return ( - center_x - padded_text_wh[0] // 2, - center_y - padded_text_wh[1] // 2, - center_x + padded_text_wh[0] // 2, - center_y + padded_text_wh[1] // 2, + center_x - text_w // 2, + center_y - text_h // 2, + center_x + text_w // 2, + center_y + text_h // 2 ) elif position == Position.BOTTOM_LEFT: - return x1, y2, x1 + padded_text_wh[0], y2 + padded_text_wh[1] + return center_x, center_y, center_x + text_w, center_y + text_h elif position == Position.BOTTOM_RIGHT: - return x2 - padded_text_wh[0], y2, x2, y2 + padded_text_wh[1] + return center_x - text_w, center_y, center_x, center_y + text_h elif position == Position.BOTTOM_CENTER: return ( - center_x - padded_text_wh[0] // 2, - y2, - center_x + padded_text_wh[0] // 2, - y2 + padded_text_wh[1], + center_x - text_w // 2, + center_y, + center_x + text_w // 2, + center_y + text_h ) def annotate( - self, - scene: np.ndarray, - detections: Detections, - labels: List[str] = None, - custom_color_lookup: Optional[np.ndarray] = None, + self, + scene: np.ndarray, + detections: Detections, + labels: List[str] = None, + custom_color_lookup: Optional[np.ndarray] = None, ) -> np.ndarray: """ Annotates the given scene with labels based on the provided detections. @@ -891,8 +888,9 @@ class LabelAnnotator: supervision-annotator-examples/label-annotator-example-purple.png) """ font = cv2.FONT_HERSHEY_SIMPLEX - for detection_idx in range(len(detections)): - detection_xyxy = detections.xyxy[detection_idx].astype(int) + anchors_coordinates = detections.get_anchors_coordinates( + anchor=self.text_anchor) + for center_coordinates, detection_idx in enumerate(anchors_coordinates): color = resolve_color( color=self.color, detections=detections, @@ -906,22 +904,23 @@ class LabelAnnotator: if (labels is None or len(detections) != len(labels)) else labels[detection_idx] ) - text_wh = cv2.getTextSize( + text_w, text_h = cv2.getTextSize( text=text, fontFace=font, fontScale=self.text_scale, thickness=self.text_thickness, )[0] + text_w_padded = text_w + 2 * self.text_padding + text_h_padded = text_h + 2 * self.text_padding text_background_xyxy = self.resolve_text_background_xyxy( - detection_xyxy=detection_xyxy, - text_wh=text_wh, - text_padding=self.text_padding, - position=self.text_position, + center_coordinates=center_coordinates.totuple(), + text_wh=(text_w_padded, text_h_padded), + position=self.text_anchor, ) text_x = text_background_xyxy[0] + self.text_padding - text_y = text_background_xyxy[1] + self.text_padding + text_wh[1] + text_y = text_background_xyxy[1] + self.text_padding + text_h cv2.rectangle( img=scene, @@ -956,9 +955,9 @@ class BlurAnnotator(BaseAnnotator): self.kernel_size: int = kernel_size def annotate( - self, - scene: np.ndarray, - detections: Detections, + self, + scene: np.ndarray, + detections: Detections, ) -> np.ndarray: """ Annotates the given scene by blurring regions based on the provided detections. @@ -1012,12 +1011,12 @@ class TraceAnnotator: """ def __init__( - self, - color: Union[Color, ColorPalette] = ColorPalette.default(), - position: Position = Position.CENTER, - trace_length: int = 30, - thickness: int = 2, - color_lookup: ColorLookup = ColorLookup.CLASS, + self, + color: Union[Color, ColorPalette] = ColorPalette.default(), + position: Position = Position.CENTER, + trace_length: int = 30, + thickness: int = 2, + color_lookup: ColorLookup = ColorLookup.CLASS, ): """ Args: @@ -1038,10 +1037,10 @@ class TraceAnnotator: self.color_lookup: ColorLookup = color_lookup def annotate( - self, - scene: np.ndarray, - detections: Detections, - custom_color_lookup: Optional[np.ndarray] = None, + self, + scene: np.ndarray, + detections: Detections, + custom_color_lookup: Optional[np.ndarray] = None, ) -> np.ndarray: """ Draws trace paths on the frame based on the detection coordinates provided. @@ -1115,13 +1114,13 @@ class HeatMapAnnotator: """ def __init__( - self, - position: Position = Position.BOTTOM_CENTER, - opacity: float = 0.2, - radius: int = 40, - kernel_size: int = 25, - top_hue: int = 0, - low_hue: int = 125, + self, + position: Position = Position.BOTTOM_CENTER, + opacity: float = 0.2, + radius: int = 40, + kernel_size: int = 25, + top_hue: int = 0, + low_hue: int = 125, ): """ Args: @@ -1181,7 +1180,7 @@ class HeatMapAnnotator: if self.heat_mask is None: self.heat_mask = np.zeros(scene.shape[:2]) mask = np.zeros(scene.shape[:2]) - for xy in detections.get_anchor_coordinates(self.position): + for xy in detections.get_anchors_coordinates(self.position): cv2.circle(mask, (int(xy[0]), int(xy[1])), self.radius, 1, -1) self.heat_mask = mask + self.heat_mask temp = self.heat_mask.copy() diff --git a/supervision/annotators/utils.py b/supervision/annotators/utils.py index 5b4e86cb..e206c8cb 100644 --- a/supervision/annotators/utils.py +++ b/supervision/annotators/utils.py @@ -102,7 +102,7 @@ class Trace: frame_id = np.full(len(detections), self.current_frame_id, dtype=int) self.frame_id = np.concatenate([self.frame_id, frame_id]) self.xy = np.concatenate( - [self.xy, detections.get_anchor_coordinates(self.anchor)] + [self.xy, detections.get_anchors_coordinates(self.anchor)] ) self.tracker_id = np.concatenate([self.tracker_id, detections.tracker_id]) diff --git a/supervision/detection/core.py b/supervision/detection/core.py index 40dc9d20..4079f896 100644 --- a/supervision/detection/core.py +++ b/supervision/detection/core.py @@ -6,7 +6,7 @@ from typing import Any, Iterator, List, Optional, Tuple, Union import numpy as np from supervision.detection.utils import ( - calculate_centroids, + calculate_masks_centroids, extract_ultralytics_masks, non_max_suppression, process_roboflow_result, @@ -601,7 +601,7 @@ class Detections: tracker_id=tracker_id, ) - def get_anchor_coordinates(self, anchor: Position) -> np.ndarray: + def get_anchors_coordinates(self, anchor: Position) -> np.ndarray: """ Calculates and returns the coordinates of a specific anchor point within the bounding boxes defined by the `xyxy` attribute. The anchor @@ -628,15 +628,12 @@ class Detections: (self.xyxy[:, 1] + self.xyxy[:, 3]) / 2, ] ).transpose() - if anchor == Position.CENTER_OF_MASS: + elif anchor == Position.CENTER_OF_MASS: if self.mask is None: - return np.array( - [ - (self.xyxy[:, 0] + self.xyxy[:, 2]) / 2, - (self.xyxy[:, 1] + self.xyxy[:, 3]) / 2, - ] - ).transpose() - return calculate_centroids(masks=self.mask) + raise ValueError( + "Cannot use `Position.CENTER_OF_MASS` without a detection mask." + ) + return calculate_masks_centroids(masks=self.mask) elif anchor == Position.CENTER_LEFT: return np.array( [ diff --git a/supervision/detection/tools/polygon_zone.py b/supervision/detection/tools/polygon_zone.py index 15ee1aa2..8e18d8bd 100644 --- a/supervision/detection/tools/polygon_zone.py +++ b/supervision/detection/tools/polygon_zone.py @@ -60,7 +60,7 @@ class PolygonZone: ) clipped_detections = replace(detections, xyxy=clipped_xyxy) clipped_anchors = np.ceil( - clipped_detections.get_anchor_coordinates(anchor=self.triggering_position) + clipped_detections.get_anchors_coordinates(anchor=self.triggering_position) ).astype(int) is_in_zone = self.mask[clipped_anchors[:, 1], clipped_anchors[:, 0]] self.current_count = int(np.sum(is_in_zone)) diff --git a/supervision/detection/utils.py b/supervision/detection/utils.py index 54780f70..1e5fdc35 100644 --- a/supervision/detection/utils.py +++ b/supervision/detection/utils.py @@ -395,7 +395,7 @@ def move_boxes(xyxy: np.ndarray, offset: np.ndarray) -> np.ndarray: return xyxy + np.hstack([offset, offset]) -def calculate_centroids(masks: np.ndarray) -> np.ndarray: +def calculate_masks_centroids(masks: np.ndarray) -> np.ndarray: """ Calculate the centroids of binary masks in a tensor. diff --git a/test/detection/test_core.py b/test/detection/test_core.py index 9708f338..0d17e09b 100644 --- a/test/detection/test_core.py +++ b/test/detection/test_core.py @@ -270,6 +270,6 @@ def test_get_anchor_coordinates( expected_result: np.ndarray, exception: Exception, ) -> None: - result = detections.get_anchor_coordinates(anchor) + result = detections.get_anchors_coordinates(anchor) with exception: assert np.array_equal(result, expected_result) diff --git a/test/detection/test_utils.py b/test/detection/test_utils.py index d0e9fd84..dc8e9e16 100644 --- a/test/detection/test_utils.py +++ b/test/detection/test_utils.py @@ -5,7 +5,7 @@ import numpy as np import pytest from supervision.detection.utils import ( - calculate_centroids, + calculate_masks_centroids, clip_boxes, filter_polygons_by_area, move_boxes, @@ -585,11 +585,11 @@ def test_move_boxes( ), # two masks ], ) -def test_calculate_centroids( +def test_calculate_masks_centroids( masks: np.ndarray, expected_result: np.ndarray, exception: Exception, ) -> None: with exception: - result = calculate_centroids(masks=masks) + result = calculate_masks_centroids(masks=masks) assert np.array_equal(result, expected_result) From b92ffeff82c260adbd55ea6b449275fcd7c80341 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 16 Nov 2023 14:24:18 +0000 Subject: [PATCH 149/164] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/annotators/core.py | 235 +++++++++++++++++---------------- 1 file changed, 118 insertions(+), 117 deletions(-) diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index cc8bfe4c..f1ec48ea 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -19,10 +19,10 @@ class BoundingBoxAnnotator(BaseAnnotator): """ def __init__( - self, - color: Union[Color, ColorPalette] = ColorPalette.default(), - thickness: int = 2, - color_lookup: ColorLookup = ColorLookup.CLASS, + self, + color: Union[Color, ColorPalette] = ColorPalette.default(), + thickness: int = 2, + color_lookup: ColorLookup = ColorLookup.CLASS, ): """ Args: @@ -37,10 +37,10 @@ class BoundingBoxAnnotator(BaseAnnotator): self.color_lookup: ColorLookup = color_lookup def annotate( - self, - scene: np.ndarray, - detections: Detections, - custom_color_lookup: Optional[np.ndarray] = None, + self, + scene: np.ndarray, + detections: Detections, + custom_color_lookup: Optional[np.ndarray] = None, ) -> np.ndarray: """ Annotates the given scene with bounding boxes based on the provided detections. @@ -101,10 +101,10 @@ class MaskAnnotator(BaseAnnotator): """ def __init__( - self, - color: Union[Color, ColorPalette] = ColorPalette.default(), - opacity: float = 0.5, - color_lookup: ColorLookup = ColorLookup.CLASS, + self, + color: Union[Color, ColorPalette] = ColorPalette.default(), + opacity: float = 0.5, + color_lookup: ColorLookup = ColorLookup.CLASS, ): """ Args: @@ -119,10 +119,10 @@ class MaskAnnotator(BaseAnnotator): self.color_lookup: ColorLookup = color_lookup def annotate( - self, - scene: np.ndarray, - detections: Detections, - custom_color_lookup: Optional[np.ndarray] = None, + self, + scene: np.ndarray, + detections: Detections, + custom_color_lookup: Optional[np.ndarray] = None, ) -> np.ndarray: """ Annotates the given scene with masks based on the provided detections. @@ -185,10 +185,10 @@ class PolygonAnnotator(BaseAnnotator): """ def __init__( - self, - color: Union[Color, ColorPalette] = ColorPalette.default(), - thickness: int = 2, - color_lookup: ColorLookup = ColorLookup.CLASS, + self, + color: Union[Color, ColorPalette] = ColorPalette.default(), + thickness: int = 2, + color_lookup: ColorLookup = ColorLookup.CLASS, ): """ Args: @@ -203,10 +203,10 @@ class PolygonAnnotator(BaseAnnotator): self.color_lookup: ColorLookup = color_lookup def annotate( - self, - scene: np.ndarray, - detections: Detections, - custom_color_lookup: Optional[np.ndarray] = None, + self, + scene: np.ndarray, + detections: Detections, + custom_color_lookup: Optional[np.ndarray] = None, ) -> np.ndarray: """ Annotates the given scene with polygons based on the provided detections. @@ -267,10 +267,10 @@ class BoxMaskAnnotator(BaseAnnotator): """ def __init__( - self, - color: Union[Color, ColorPalette] = ColorPalette.default(), - opacity: float = 0.5, - color_lookup: ColorLookup = ColorLookup.CLASS, + self, + color: Union[Color, ColorPalette] = ColorPalette.default(), + opacity: float = 0.5, + color_lookup: ColorLookup = ColorLookup.CLASS, ): """ Args: @@ -285,10 +285,10 @@ class BoxMaskAnnotator(BaseAnnotator): self.opacity = opacity def annotate( - self, - scene: np.ndarray, - detections: Detections, - custom_color_lookup: Optional[np.ndarray] = None, + self, + scene: np.ndarray, + detections: Detections, + custom_color_lookup: Optional[np.ndarray] = None, ) -> np.ndarray: """ Annotates the given scene with box masks based on the provided detections. @@ -353,11 +353,11 @@ class HaloAnnotator(BaseAnnotator): """ def __init__( - self, - color: Union[Color, ColorPalette] = ColorPalette.default(), - opacity: float = 0.8, - kernel_size: int = 40, - color_lookup: ColorLookup = ColorLookup.CLASS, + self, + color: Union[Color, ColorPalette] = ColorPalette.default(), + opacity: float = 0.8, + kernel_size: int = 40, + color_lookup: ColorLookup = ColorLookup.CLASS, ): """ Args: @@ -375,10 +375,10 @@ class HaloAnnotator(BaseAnnotator): self.kernel_size: int = kernel_size def annotate( - self, - scene: np.ndarray, - detections: Detections, - custom_color_lookup: Optional[np.ndarray] = None, + self, + scene: np.ndarray, + detections: Detections, + custom_color_lookup: Optional[np.ndarray] = None, ) -> np.ndarray: """ Annotates the given scene with halos based on the provided detections. @@ -445,12 +445,12 @@ class EllipseAnnotator(BaseAnnotator): """ def __init__( - self, - color: Union[Color, ColorPalette] = ColorPalette.default(), - thickness: int = 2, - start_angle: int = -45, - end_angle: int = 235, - color_lookup: ColorLookup = ColorLookup.CLASS, + self, + color: Union[Color, ColorPalette] = ColorPalette.default(), + thickness: int = 2, + start_angle: int = -45, + end_angle: int = 235, + color_lookup: ColorLookup = ColorLookup.CLASS, ): """ Args: @@ -469,10 +469,10 @@ class EllipseAnnotator(BaseAnnotator): self.color_lookup: ColorLookup = color_lookup def annotate( - self, - scene: np.ndarray, - detections: Detections, - custom_color_lookup: Optional[np.ndarray] = None, + self, + scene: np.ndarray, + detections: Detections, + custom_color_lookup: Optional[np.ndarray] = None, ) -> np.ndarray: """ Annotates the given scene with ellipses based on the provided detections. @@ -535,11 +535,11 @@ class BoxCornerAnnotator(BaseAnnotator): """ def __init__( - self, - color: Union[Color, ColorPalette] = ColorPalette.default(), - thickness: int = 4, - corner_length: int = 15, - color_lookup: ColorLookup = ColorLookup.CLASS, + self, + color: Union[Color, ColorPalette] = ColorPalette.default(), + thickness: int = 4, + corner_length: int = 15, + color_lookup: ColorLookup = ColorLookup.CLASS, ): """ Args: @@ -556,10 +556,10 @@ class BoxCornerAnnotator(BaseAnnotator): self.color_lookup: ColorLookup = color_lookup def annotate( - self, - scene: np.ndarray, - detections: Detections, - custom_color_lookup: Optional[np.ndarray] = None, + self, + scene: np.ndarray, + detections: Detections, + custom_color_lookup: Optional[np.ndarray] = None, ) -> np.ndarray: """ Annotates the given scene with box corners based on the provided detections. @@ -621,10 +621,10 @@ class CircleAnnotator(BaseAnnotator): """ def __init__( - self, - color: Union[Color, ColorPalette] = ColorPalette.default(), - thickness: int = 2, - color_lookup: ColorLookup = ColorLookup.CLASS, + self, + color: Union[Color, ColorPalette] = ColorPalette.default(), + thickness: int = 2, + color_lookup: ColorLookup = ColorLookup.CLASS, ): """ Args: @@ -640,10 +640,10 @@ class CircleAnnotator(BaseAnnotator): self.color_lookup: ColorLookup = color_lookup def annotate( - self, - scene: np.ndarray, - detections: Detections, - custom_color_lookup: Optional[np.ndarray] = None, + self, + scene: np.ndarray, + detections: Detections, + custom_color_lookup: Optional[np.ndarray] = None, ) -> np.ndarray: """ Annotates the given scene with circles based on the provided detections. @@ -705,11 +705,11 @@ class DotAnnotator(BaseAnnotator): """ def __init__( - self, - color: Union[Color, ColorPalette] = ColorPalette.default(), - radius: int = 4, - position: Position = Position.CENTER, - color_lookup: ColorLookup = ColorLookup.CLASS, + self, + color: Union[Color, ColorPalette] = ColorPalette.default(), + radius: int = 4, + position: Position = Position.CENTER, + color_lookup: ColorLookup = ColorLookup.CLASS, ): """ Args: @@ -726,10 +726,10 @@ class DotAnnotator(BaseAnnotator): self.color_lookup: ColorLookup = color_lookup def annotate( - self, - scene: np.ndarray, - detections: Detections, - custom_color_lookup: Optional[np.ndarray] = None, + self, + scene: np.ndarray, + detections: Detections, + custom_color_lookup: Optional[np.ndarray] = None, ) -> np.ndarray: """ Annotates the given scene with dots based on the provided detections. @@ -781,14 +781,14 @@ class LabelAnnotator: """ def __init__( - self, - color: Union[Color, ColorPalette] = ColorPalette.default(), - text_color: Color = Color.black(), - text_scale: float = 0.5, - text_thickness: int = 1, - text_padding: int = 10, - text_position: Position = Position.TOP_LEFT, - color_lookup: ColorLookup = ColorLookup.CLASS, + self, + color: Union[Color, ColorPalette] = ColorPalette.default(), + text_color: Color = Color.black(), + text_scale: float = 0.5, + text_thickness: int = 1, + text_padding: int = 10, + text_position: Position = Position.TOP_LEFT, + color_lookup: ColorLookup = ColorLookup.CLASS, ): """ Args: @@ -813,9 +813,9 @@ class LabelAnnotator: @staticmethod def resolve_text_background_xyxy( - center_coordinates: Tuple[int, int], - text_wh: Tuple[int, int], - position: Position, + center_coordinates: Tuple[int, int], + text_wh: Tuple[int, int], + position: Position, ) -> Tuple[int, int, int, int]: center_x, center_y = center_coordinates text_w, text_h = text_wh @@ -829,14 +829,14 @@ class LabelAnnotator: center_x - text_w // 2, center_y - text_h, center_x + text_w // 2, - center_y + center_y, ) elif position == Position.CENTER or position == Position.CENTER_OF_MASS: return ( center_x - text_w // 2, center_y - text_h // 2, center_x + text_w // 2, - center_y + text_h // 2 + center_y + text_h // 2, ) elif position == Position.BOTTOM_LEFT: return center_x, center_y, center_x + text_w, center_y + text_h @@ -847,15 +847,15 @@ class LabelAnnotator: center_x - text_w // 2, center_y, center_x + text_w // 2, - center_y + text_h + center_y + text_h, ) def annotate( - self, - scene: np.ndarray, - detections: Detections, - labels: List[str] = None, - custom_color_lookup: Optional[np.ndarray] = None, + self, + scene: np.ndarray, + detections: Detections, + labels: List[str] = None, + custom_color_lookup: Optional[np.ndarray] = None, ) -> np.ndarray: """ Annotates the given scene with labels based on the provided detections. @@ -889,7 +889,8 @@ class LabelAnnotator: """ font = cv2.FONT_HERSHEY_SIMPLEX anchors_coordinates = detections.get_anchors_coordinates( - anchor=self.text_anchor) + anchor=self.text_anchor + ) for center_coordinates, detection_idx in enumerate(anchors_coordinates): color = resolve_color( color=self.color, @@ -955,9 +956,9 @@ class BlurAnnotator(BaseAnnotator): self.kernel_size: int = kernel_size def annotate( - self, - scene: np.ndarray, - detections: Detections, + self, + scene: np.ndarray, + detections: Detections, ) -> np.ndarray: """ Annotates the given scene by blurring regions based on the provided detections. @@ -1011,12 +1012,12 @@ class TraceAnnotator: """ def __init__( - self, - color: Union[Color, ColorPalette] = ColorPalette.default(), - position: Position = Position.CENTER, - trace_length: int = 30, - thickness: int = 2, - color_lookup: ColorLookup = ColorLookup.CLASS, + self, + color: Union[Color, ColorPalette] = ColorPalette.default(), + position: Position = Position.CENTER, + trace_length: int = 30, + thickness: int = 2, + color_lookup: ColorLookup = ColorLookup.CLASS, ): """ Args: @@ -1037,10 +1038,10 @@ class TraceAnnotator: self.color_lookup: ColorLookup = color_lookup def annotate( - self, - scene: np.ndarray, - detections: Detections, - custom_color_lookup: Optional[np.ndarray] = None, + self, + scene: np.ndarray, + detections: Detections, + custom_color_lookup: Optional[np.ndarray] = None, ) -> np.ndarray: """ Draws trace paths on the frame based on the detection coordinates provided. @@ -1114,13 +1115,13 @@ class HeatMapAnnotator: """ def __init__( - self, - position: Position = Position.BOTTOM_CENTER, - opacity: float = 0.2, - radius: int = 40, - kernel_size: int = 25, - top_hue: int = 0, - low_hue: int = 125, + self, + position: Position = Position.BOTTOM_CENTER, + opacity: float = 0.2, + radius: int = 40, + kernel_size: int = 25, + top_hue: int = 0, + low_hue: int = 125, ): """ Args: From 6956dad17ddaee85a7a9a256540f1d6d3335d2be Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Thu, 16 Nov 2023 15:30:03 +0100 Subject: [PATCH 150/164] Swap enumeration arguments in loop --- supervision/annotators/core.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index cc8bfe4c..922f1079 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -890,7 +890,7 @@ class LabelAnnotator: font = cv2.FONT_HERSHEY_SIMPLEX anchors_coordinates = detections.get_anchors_coordinates( anchor=self.text_anchor) - for center_coordinates, detection_idx in enumerate(anchors_coordinates): + for detection_idx, center_coordinates in enumerate(anchors_coordinates): color = resolve_color( color=self.color, detections=detections, @@ -912,7 +912,6 @@ class LabelAnnotator: )[0] text_w_padded = text_w + 2 * self.text_padding text_h_padded = text_h + 2 * self.text_padding - text_background_xyxy = self.resolve_text_background_xyxy( center_coordinates=center_coordinates.totuple(), text_wh=(text_w_padded, text_h_padded), From 66448ea8621a22b543a7ad7e7d22d260c4e87a9f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 16 Nov 2023 14:33:57 +0000 Subject: [PATCH 151/164] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/annotators/core.py | 235 +++++++++++++++++---------------- 1 file changed, 118 insertions(+), 117 deletions(-) diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index 922f1079..9cf88226 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -19,10 +19,10 @@ class BoundingBoxAnnotator(BaseAnnotator): """ def __init__( - self, - color: Union[Color, ColorPalette] = ColorPalette.default(), - thickness: int = 2, - color_lookup: ColorLookup = ColorLookup.CLASS, + self, + color: Union[Color, ColorPalette] = ColorPalette.default(), + thickness: int = 2, + color_lookup: ColorLookup = ColorLookup.CLASS, ): """ Args: @@ -37,10 +37,10 @@ class BoundingBoxAnnotator(BaseAnnotator): self.color_lookup: ColorLookup = color_lookup def annotate( - self, - scene: np.ndarray, - detections: Detections, - custom_color_lookup: Optional[np.ndarray] = None, + self, + scene: np.ndarray, + detections: Detections, + custom_color_lookup: Optional[np.ndarray] = None, ) -> np.ndarray: """ Annotates the given scene with bounding boxes based on the provided detections. @@ -101,10 +101,10 @@ class MaskAnnotator(BaseAnnotator): """ def __init__( - self, - color: Union[Color, ColorPalette] = ColorPalette.default(), - opacity: float = 0.5, - color_lookup: ColorLookup = ColorLookup.CLASS, + self, + color: Union[Color, ColorPalette] = ColorPalette.default(), + opacity: float = 0.5, + color_lookup: ColorLookup = ColorLookup.CLASS, ): """ Args: @@ -119,10 +119,10 @@ class MaskAnnotator(BaseAnnotator): self.color_lookup: ColorLookup = color_lookup def annotate( - self, - scene: np.ndarray, - detections: Detections, - custom_color_lookup: Optional[np.ndarray] = None, + self, + scene: np.ndarray, + detections: Detections, + custom_color_lookup: Optional[np.ndarray] = None, ) -> np.ndarray: """ Annotates the given scene with masks based on the provided detections. @@ -185,10 +185,10 @@ class PolygonAnnotator(BaseAnnotator): """ def __init__( - self, - color: Union[Color, ColorPalette] = ColorPalette.default(), - thickness: int = 2, - color_lookup: ColorLookup = ColorLookup.CLASS, + self, + color: Union[Color, ColorPalette] = ColorPalette.default(), + thickness: int = 2, + color_lookup: ColorLookup = ColorLookup.CLASS, ): """ Args: @@ -203,10 +203,10 @@ class PolygonAnnotator(BaseAnnotator): self.color_lookup: ColorLookup = color_lookup def annotate( - self, - scene: np.ndarray, - detections: Detections, - custom_color_lookup: Optional[np.ndarray] = None, + self, + scene: np.ndarray, + detections: Detections, + custom_color_lookup: Optional[np.ndarray] = None, ) -> np.ndarray: """ Annotates the given scene with polygons based on the provided detections. @@ -267,10 +267,10 @@ class BoxMaskAnnotator(BaseAnnotator): """ def __init__( - self, - color: Union[Color, ColorPalette] = ColorPalette.default(), - opacity: float = 0.5, - color_lookup: ColorLookup = ColorLookup.CLASS, + self, + color: Union[Color, ColorPalette] = ColorPalette.default(), + opacity: float = 0.5, + color_lookup: ColorLookup = ColorLookup.CLASS, ): """ Args: @@ -285,10 +285,10 @@ class BoxMaskAnnotator(BaseAnnotator): self.opacity = opacity def annotate( - self, - scene: np.ndarray, - detections: Detections, - custom_color_lookup: Optional[np.ndarray] = None, + self, + scene: np.ndarray, + detections: Detections, + custom_color_lookup: Optional[np.ndarray] = None, ) -> np.ndarray: """ Annotates the given scene with box masks based on the provided detections. @@ -353,11 +353,11 @@ class HaloAnnotator(BaseAnnotator): """ def __init__( - self, - color: Union[Color, ColorPalette] = ColorPalette.default(), - opacity: float = 0.8, - kernel_size: int = 40, - color_lookup: ColorLookup = ColorLookup.CLASS, + self, + color: Union[Color, ColorPalette] = ColorPalette.default(), + opacity: float = 0.8, + kernel_size: int = 40, + color_lookup: ColorLookup = ColorLookup.CLASS, ): """ Args: @@ -375,10 +375,10 @@ class HaloAnnotator(BaseAnnotator): self.kernel_size: int = kernel_size def annotate( - self, - scene: np.ndarray, - detections: Detections, - custom_color_lookup: Optional[np.ndarray] = None, + self, + scene: np.ndarray, + detections: Detections, + custom_color_lookup: Optional[np.ndarray] = None, ) -> np.ndarray: """ Annotates the given scene with halos based on the provided detections. @@ -445,12 +445,12 @@ class EllipseAnnotator(BaseAnnotator): """ def __init__( - self, - color: Union[Color, ColorPalette] = ColorPalette.default(), - thickness: int = 2, - start_angle: int = -45, - end_angle: int = 235, - color_lookup: ColorLookup = ColorLookup.CLASS, + self, + color: Union[Color, ColorPalette] = ColorPalette.default(), + thickness: int = 2, + start_angle: int = -45, + end_angle: int = 235, + color_lookup: ColorLookup = ColorLookup.CLASS, ): """ Args: @@ -469,10 +469,10 @@ class EllipseAnnotator(BaseAnnotator): self.color_lookup: ColorLookup = color_lookup def annotate( - self, - scene: np.ndarray, - detections: Detections, - custom_color_lookup: Optional[np.ndarray] = None, + self, + scene: np.ndarray, + detections: Detections, + custom_color_lookup: Optional[np.ndarray] = None, ) -> np.ndarray: """ Annotates the given scene with ellipses based on the provided detections. @@ -535,11 +535,11 @@ class BoxCornerAnnotator(BaseAnnotator): """ def __init__( - self, - color: Union[Color, ColorPalette] = ColorPalette.default(), - thickness: int = 4, - corner_length: int = 15, - color_lookup: ColorLookup = ColorLookup.CLASS, + self, + color: Union[Color, ColorPalette] = ColorPalette.default(), + thickness: int = 4, + corner_length: int = 15, + color_lookup: ColorLookup = ColorLookup.CLASS, ): """ Args: @@ -556,10 +556,10 @@ class BoxCornerAnnotator(BaseAnnotator): self.color_lookup: ColorLookup = color_lookup def annotate( - self, - scene: np.ndarray, - detections: Detections, - custom_color_lookup: Optional[np.ndarray] = None, + self, + scene: np.ndarray, + detections: Detections, + custom_color_lookup: Optional[np.ndarray] = None, ) -> np.ndarray: """ Annotates the given scene with box corners based on the provided detections. @@ -621,10 +621,10 @@ class CircleAnnotator(BaseAnnotator): """ def __init__( - self, - color: Union[Color, ColorPalette] = ColorPalette.default(), - thickness: int = 2, - color_lookup: ColorLookup = ColorLookup.CLASS, + self, + color: Union[Color, ColorPalette] = ColorPalette.default(), + thickness: int = 2, + color_lookup: ColorLookup = ColorLookup.CLASS, ): """ Args: @@ -640,10 +640,10 @@ class CircleAnnotator(BaseAnnotator): self.color_lookup: ColorLookup = color_lookup def annotate( - self, - scene: np.ndarray, - detections: Detections, - custom_color_lookup: Optional[np.ndarray] = None, + self, + scene: np.ndarray, + detections: Detections, + custom_color_lookup: Optional[np.ndarray] = None, ) -> np.ndarray: """ Annotates the given scene with circles based on the provided detections. @@ -705,11 +705,11 @@ class DotAnnotator(BaseAnnotator): """ def __init__( - self, - color: Union[Color, ColorPalette] = ColorPalette.default(), - radius: int = 4, - position: Position = Position.CENTER, - color_lookup: ColorLookup = ColorLookup.CLASS, + self, + color: Union[Color, ColorPalette] = ColorPalette.default(), + radius: int = 4, + position: Position = Position.CENTER, + color_lookup: ColorLookup = ColorLookup.CLASS, ): """ Args: @@ -726,10 +726,10 @@ class DotAnnotator(BaseAnnotator): self.color_lookup: ColorLookup = color_lookup def annotate( - self, - scene: np.ndarray, - detections: Detections, - custom_color_lookup: Optional[np.ndarray] = None, + self, + scene: np.ndarray, + detections: Detections, + custom_color_lookup: Optional[np.ndarray] = None, ) -> np.ndarray: """ Annotates the given scene with dots based on the provided detections. @@ -781,14 +781,14 @@ class LabelAnnotator: """ def __init__( - self, - color: Union[Color, ColorPalette] = ColorPalette.default(), - text_color: Color = Color.black(), - text_scale: float = 0.5, - text_thickness: int = 1, - text_padding: int = 10, - text_position: Position = Position.TOP_LEFT, - color_lookup: ColorLookup = ColorLookup.CLASS, + self, + color: Union[Color, ColorPalette] = ColorPalette.default(), + text_color: Color = Color.black(), + text_scale: float = 0.5, + text_thickness: int = 1, + text_padding: int = 10, + text_position: Position = Position.TOP_LEFT, + color_lookup: ColorLookup = ColorLookup.CLASS, ): """ Args: @@ -813,9 +813,9 @@ class LabelAnnotator: @staticmethod def resolve_text_background_xyxy( - center_coordinates: Tuple[int, int], - text_wh: Tuple[int, int], - position: Position, + center_coordinates: Tuple[int, int], + text_wh: Tuple[int, int], + position: Position, ) -> Tuple[int, int, int, int]: center_x, center_y = center_coordinates text_w, text_h = text_wh @@ -829,14 +829,14 @@ class LabelAnnotator: center_x - text_w // 2, center_y - text_h, center_x + text_w // 2, - center_y + center_y, ) elif position == Position.CENTER or position == Position.CENTER_OF_MASS: return ( center_x - text_w // 2, center_y - text_h // 2, center_x + text_w // 2, - center_y + text_h // 2 + center_y + text_h // 2, ) elif position == Position.BOTTOM_LEFT: return center_x, center_y, center_x + text_w, center_y + text_h @@ -847,15 +847,15 @@ class LabelAnnotator: center_x - text_w // 2, center_y, center_x + text_w // 2, - center_y + text_h + center_y + text_h, ) def annotate( - self, - scene: np.ndarray, - detections: Detections, - labels: List[str] = None, - custom_color_lookup: Optional[np.ndarray] = None, + self, + scene: np.ndarray, + detections: Detections, + labels: List[str] = None, + custom_color_lookup: Optional[np.ndarray] = None, ) -> np.ndarray: """ Annotates the given scene with labels based on the provided detections. @@ -889,7 +889,8 @@ class LabelAnnotator: """ font = cv2.FONT_HERSHEY_SIMPLEX anchors_coordinates = detections.get_anchors_coordinates( - anchor=self.text_anchor) + anchor=self.text_anchor + ) for detection_idx, center_coordinates in enumerate(anchors_coordinates): color = resolve_color( color=self.color, @@ -954,9 +955,9 @@ class BlurAnnotator(BaseAnnotator): self.kernel_size: int = kernel_size def annotate( - self, - scene: np.ndarray, - detections: Detections, + self, + scene: np.ndarray, + detections: Detections, ) -> np.ndarray: """ Annotates the given scene by blurring regions based on the provided detections. @@ -1010,12 +1011,12 @@ class TraceAnnotator: """ def __init__( - self, - color: Union[Color, ColorPalette] = ColorPalette.default(), - position: Position = Position.CENTER, - trace_length: int = 30, - thickness: int = 2, - color_lookup: ColorLookup = ColorLookup.CLASS, + self, + color: Union[Color, ColorPalette] = ColorPalette.default(), + position: Position = Position.CENTER, + trace_length: int = 30, + thickness: int = 2, + color_lookup: ColorLookup = ColorLookup.CLASS, ): """ Args: @@ -1036,10 +1037,10 @@ class TraceAnnotator: self.color_lookup: ColorLookup = color_lookup def annotate( - self, - scene: np.ndarray, - detections: Detections, - custom_color_lookup: Optional[np.ndarray] = None, + self, + scene: np.ndarray, + detections: Detections, + custom_color_lookup: Optional[np.ndarray] = None, ) -> np.ndarray: """ Draws trace paths on the frame based on the detection coordinates provided. @@ -1113,13 +1114,13 @@ class HeatMapAnnotator: """ def __init__( - self, - position: Position = Position.BOTTOM_CENTER, - opacity: float = 0.2, - radius: int = 40, - kernel_size: int = 25, - top_hue: int = 0, - low_hue: int = 125, + self, + position: Position = Position.BOTTOM_CENTER, + opacity: float = 0.2, + radius: int = 40, + kernel_size: int = 25, + top_hue: int = 0, + low_hue: int = 125, ): """ Args: From 5e091396f26c6be60e75ab14cb001c48e9e338e8 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Thu, 16 Nov 2023 15:36:36 +0100 Subject: [PATCH 152/164] Refactor center_coordinates conversion to tuple --- supervision/annotators/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index 922f1079..50175a25 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -913,7 +913,7 @@ class LabelAnnotator: text_w_padded = text_w + 2 * self.text_padding text_h_padded = text_h + 2 * self.text_padding text_background_xyxy = self.resolve_text_background_xyxy( - center_coordinates=center_coordinates.totuple(), + center_coordinates=tuple(center_coordinates), text_wh=(text_w_padded, text_h_padded), position=self.text_anchor, ) From 0725d5a1a9060eb1fe1d55c862f737b59a68f228 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Thu, 16 Nov 2023 15:50:37 +0100 Subject: [PATCH 153/164] Cast get_anchors_coordinates return to integer. --- supervision/annotators/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index ce518797..82d299da 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -890,7 +890,7 @@ class LabelAnnotator: font = cv2.FONT_HERSHEY_SIMPLEX anchors_coordinates = detections.get_anchors_coordinates( anchor=self.text_anchor - ) + ).astype(int) for detection_idx, center_coordinates in enumerate(anchors_coordinates): color = resolve_color( color=self.color, From 6c756c411bd6ecb2def342cd1f068d16e44ac27e Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Thu, 16 Nov 2023 16:25:48 +0100 Subject: [PATCH 154/164] Add calculate_masks_centroids function import in __init__.py --- supervision/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/supervision/__init__.py b/supervision/__init__.py index 44f25f7f..93f4626f 100644 --- a/supervision/__init__.py +++ b/supervision/__init__.py @@ -35,6 +35,7 @@ from supervision.detection.tools.inference_slicer import InferenceSlicer from supervision.detection.tools.polygon_zone import PolygonZone, PolygonZoneAnnotator from supervision.detection.utils import ( box_iou_batch, + calculate_masks_centroids, filter_polygons_by_area, mask_to_polygons, mask_to_xyxy, From c2101db5d24731df48b16aefb5acfd3a4132c0bd Mon Sep 17 00:00:00 2001 From: xenteros Date: Thu, 16 Nov 2023 22:27:32 +0100 Subject: [PATCH 155/164] Optimize sv.MaskAnnotator by reducing number of calls to cv2.addWeighted * Combined all colored masks before applying them to the scene * Made sure that returned ndarray is np.uint8 for video writer simplicity --- supervision/annotators/core.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index 82d299da..2bdf25c2 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -156,6 +156,8 @@ class MaskAnnotator(BaseAnnotator): if detections.mask is None: return scene + colored_mask = np.array(scene, copy=True, dtype=np.uint8) + for detection_idx in np.flip(np.argsort(detections.area)): color = resolve_color( color=self.color, @@ -166,13 +168,12 @@ class MaskAnnotator(BaseAnnotator): else custom_color_lookup, ) mask = detections.mask[detection_idx] - colored_mask = np.zeros_like(scene, dtype=np.uint8) - colored_mask[:] = color.as_bgr() - scene[mask] = cv2.addWeighted( - colored_mask, self.opacity, scene, 1 - self.opacity, 0 - )[mask] + colored_mask[mask] = color.as_bgr() - return scene + scene = cv2.addWeighted( + colored_mask, self.opacity, scene, 1 - self.opacity, 0 + ) + return scene.astype(np.uint8) class PolygonAnnotator(BaseAnnotator): From 1267cf7fb07242f07ca9d183b975a43181ecc9ed Mon Sep 17 00:00:00 2001 From: xenteros Date: Thu, 16 Nov 2023 22:34:52 +0100 Subject: [PATCH 156/164] Reformatted Code with pre-commit --- supervision/annotators/core.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index 2bdf25c2..e5258c3e 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -170,9 +170,7 @@ class MaskAnnotator(BaseAnnotator): mask = detections.mask[detection_idx] colored_mask[mask] = color.as_bgr() - scene = cv2.addWeighted( - colored_mask, self.opacity, scene, 1 - self.opacity, 0 - ) + scene = cv2.addWeighted(colored_mask, self.opacity, scene, 1 - self.opacity, 0) return scene.astype(np.uint8) From 564f1b1026ea0ab6613a2e412740f1754ce3362a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Nov 2023 01:09:24 +0000 Subject: [PATCH 157/164] :arrow_up: Bump ruff from 0.1.5 to 0.1.6 Bumps [ruff](https://github.com/astral-sh/ruff) from 0.1.5 to 0.1.6. - [Release notes](https://github.com/astral-sh/ruff/releases) - [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md) - [Commits](https://github.com/astral-sh/ruff/compare/v0.1.5...v0.1.6) --- updated-dependencies: - dependency-name: ruff dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- poetry.lock | 38 +++++++++++++++++++------------------- pyproject.toml | 2 +- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/poetry.lock b/poetry.lock index 782bf22c..d0a873bd 100644 --- a/poetry.lock +++ b/poetry.lock @@ -3169,28 +3169,28 @@ files = [ [[package]] name = "ruff" -version = "0.1.5" +version = "0.1.6" description = "An extremely fast Python linter and code formatter, written in Rust." optional = false python-versions = ">=3.7" files = [ - {file = "ruff-0.1.5-py3-none-macosx_10_7_x86_64.whl", hash = "sha256:32d47fc69261c21a4c48916f16ca272bf2f273eb635d91c65d5cd548bf1f3d96"}, - {file = "ruff-0.1.5-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:171276c1df6c07fa0597fb946139ced1c2978f4f0b8254f201281729981f3c17"}, - {file = "ruff-0.1.5-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:17ef33cd0bb7316ca65649fc748acc1406dfa4da96a3d0cde6d52f2e866c7b39"}, - {file = "ruff-0.1.5-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:b2c205827b3f8c13b4a432e9585750b93fd907986fe1aec62b2a02cf4401eee6"}, - {file = "ruff-0.1.5-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:bb408e3a2ad8f6881d0f2e7ad70cddb3ed9f200eb3517a91a245bbe27101d379"}, - {file = "ruff-0.1.5-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:f20dc5e5905ddb407060ca27267c7174f532375c08076d1a953cf7bb016f5a24"}, - {file = "ruff-0.1.5-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:aafb9d2b671ed934998e881e2c0f5845a4295e84e719359c71c39a5363cccc91"}, - {file = "ruff-0.1.5-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a4894dddb476597a0ba4473d72a23151b8b3b0b5f958f2cf4d3f1c572cdb7af7"}, - {file = "ruff-0.1.5-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a00a7ec893f665ed60008c70fe9eeb58d210e6b4d83ec6654a9904871f982a2a"}, - {file = "ruff-0.1.5-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:a8c11206b47f283cbda399a654fd0178d7a389e631f19f51da15cbe631480c5b"}, - {file = "ruff-0.1.5-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:fa29e67b3284b9a79b1a85ee66e293a94ac6b7bb068b307a8a373c3d343aa8ec"}, - {file = "ruff-0.1.5-py3-none-musllinux_1_2_i686.whl", hash = "sha256:9b97fd6da44d6cceb188147b68db69a5741fbc736465b5cea3928fdac0bc1aeb"}, - {file = "ruff-0.1.5-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:721f4b9d3b4161df8dc9f09aa8562e39d14e55a4dbaa451a8e55bdc9590e20f4"}, - {file = "ruff-0.1.5-py3-none-win32.whl", hash = "sha256:f80c73bba6bc69e4fdc73b3991db0b546ce641bdcd5b07210b8ad6f64c79f1ab"}, - {file = "ruff-0.1.5-py3-none-win_amd64.whl", hash = "sha256:c21fe20ee7d76206d290a76271c1af7a5096bc4c73ab9383ed2ad35f852a0087"}, - {file = "ruff-0.1.5-py3-none-win_arm64.whl", hash = "sha256:82bfcb9927e88c1ed50f49ac6c9728dab3ea451212693fe40d08d314663e412f"}, - {file = "ruff-0.1.5.tar.gz", hash = "sha256:5cbec0ef2ae1748fb194f420fb03fb2c25c3258c86129af7172ff8f198f125ab"}, + {file = "ruff-0.1.6-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", hash = "sha256:88b8cdf6abf98130991cbc9f6438f35f6e8d41a02622cc5ee130a02a0ed28703"}, + {file = "ruff-0.1.6-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:5c549ed437680b6105a1299d2cd30e4964211606eeb48a0ff7a93ef70b902248"}, + {file = "ruff-0.1.6-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1cf5f701062e294f2167e66d11b092bba7af6a057668ed618a9253e1e90cfd76"}, + {file = "ruff-0.1.6-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:05991ee20d4ac4bb78385360c684e4b417edd971030ab12a4fbd075ff535050e"}, + {file = "ruff-0.1.6-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:87455a0c1f739b3c069e2f4c43b66479a54dea0276dd5d4d67b091265f6fd1dc"}, + {file = "ruff-0.1.6-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:683aa5bdda5a48cb8266fcde8eea2a6af4e5700a392c56ea5fb5f0d4bfdc0240"}, + {file = "ruff-0.1.6-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:137852105586dcbf80c1717facb6781555c4e99f520c9c827bd414fac67ddfb6"}, + {file = "ruff-0.1.6-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:bd98138a98d48a1c36c394fd6b84cd943ac92a08278aa8ac8c0fdefcf7138f35"}, + {file = "ruff-0.1.6-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3a0cd909d25f227ac5c36d4e7e681577275fb74ba3b11d288aff7ec47e3ae745"}, + {file = "ruff-0.1.6-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:e8fd1c62a47aa88a02707b5dd20c5ff20d035d634aa74826b42a1da77861b5ff"}, + {file = "ruff-0.1.6-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:fd89b45d374935829134a082617954120d7a1470a9f0ec0e7f3ead983edc48cc"}, + {file = "ruff-0.1.6-py3-none-musllinux_1_2_i686.whl", hash = "sha256:491262006e92f825b145cd1e52948073c56560243b55fb3b4ecb142f6f0e9543"}, + {file = "ruff-0.1.6-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:ea284789861b8b5ca9d5443591a92a397ac183d4351882ab52f6296b4fdd5462"}, + {file = "ruff-0.1.6-py3-none-win32.whl", hash = "sha256:1610e14750826dfc207ccbcdd7331b6bd285607d4181df9c1c6ae26646d6848a"}, + {file = "ruff-0.1.6-py3-none-win_amd64.whl", hash = "sha256:4558b3e178145491e9bc3b2ee3c4b42f19d19384eaa5c59d10acf6e8f8b57e33"}, + {file = "ruff-0.1.6-py3-none-win_arm64.whl", hash = "sha256:03910e81df0d8db0e30050725a5802441c2022ea3ae4fe0609b76081731accbc"}, + {file = "ruff-0.1.6.tar.gz", hash = "sha256:1b09f29b16c6ead5ea6b097ef2764b42372aebe363722f1605ecbcd2b9207184"}, ] [[package]] @@ -3668,4 +3668,4 @@ desktop = ["opencv-python"] [metadata] lock-version = "2.0" python-versions = ">=3.8,<3.12.0" -content-hash = "f2d0f1827c652b0ae160a093050bca163b13f2d166968893a0c5a02d27bfb856" +content-hash = "abbd8c3b0bbed2349aa2ba8f4a822ab44d1092ea8b60118dc83fe11737e4ca12" diff --git a/pyproject.toml b/pyproject.toml index 81a06177..97c30af1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -57,7 +57,7 @@ pytest = "^7.2.2" wheel = ">=0.40,<0.42" notebook = ">=6.5.3,<8.0.0" build = ">=0.10,<1.1" -ruff = ">=0.0.280,<0.1.6" +ruff = ">=0.0.280,<0.1.7" isort = "^5.12.0" black = "^23.7.0" mypy = "^1.4.1" From d20083de853ac2b3242534d881826dfedd67e9f3 Mon Sep 17 00:00:00 2001 From: karanjakhar Date: Mon, 20 Nov 2023 15:32:18 +0530 Subject: [PATCH 158/164] fixing typo TRACE -> TRACK --- supervision/annotators/core.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index e5258c3e..ff19b3fe 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -30,7 +30,7 @@ class BoundingBoxAnnotator(BaseAnnotator): annotating detections. thickness (int): Thickness of the bounding box lines. color_lookup (str): Strategy for mapping colors to annotations. - Options are `INDEX`, `CLASS`, `TRACE`. + Options are `INDEX`, `CLASS`, `TRACK`. """ self.color: Union[Color, ColorPalette] = color self.thickness: int = thickness @@ -112,7 +112,7 @@ class MaskAnnotator(BaseAnnotator): annotating detections. opacity (float): Opacity of the overlay mask. Must be between `0` and `1`. color_lookup (str): Strategy for mapping colors to annotations. - Options are `INDEX`, `CLASS`, `TRACE`. + Options are `INDEX`, `CLASS`, `TRACK`. """ self.color: Union[Color, ColorPalette] = color self.opacity = opacity @@ -195,7 +195,7 @@ class PolygonAnnotator(BaseAnnotator): annotating detections. thickness (int): Thickness of the polygon lines. color_lookup (str): Strategy for mapping colors to annotations. - Options are `INDEX`, `CLASS`, `TRACE`. + Options are `INDEX`, `CLASS`, `TRACK`. """ self.color: Union[Color, ColorPalette] = color self.thickness: int = thickness @@ -277,7 +277,7 @@ class BoxMaskAnnotator(BaseAnnotator): annotating detections. opacity (float): Opacity of the overlay mask. Must be between `0` and `1`. color_lookup (str): Strategy for mapping colors to annotations. - Options are `INDEX`, `CLASS`, `TRACE`. + Options are `INDEX`, `CLASS`, `TRACK`. """ self.color: Union[Color, ColorPalette] = color self.color_lookup: ColorLookup = color_lookup @@ -366,7 +366,7 @@ class HaloAnnotator(BaseAnnotator): kernel_size (int): The size of the average pooling kernel used for creating the halo. color_lookup (str): Strategy for mapping colors to annotations. - Options are `INDEX`, `CLASS`, `TRACE`. + Options are `INDEX`, `CLASS`, `TRACK`. """ self.color: Union[Color, ColorPalette] = color self.opacity = opacity @@ -459,7 +459,7 @@ class EllipseAnnotator(BaseAnnotator): start_angle (int): Starting angle of the ellipse. end_angle (int): Ending angle of the ellipse. color_lookup (str): Strategy for mapping colors to annotations. - Options are `INDEX`, `CLASS`, `TRACE`. + Options are `INDEX`, `CLASS`, `TRACK`. """ self.color: Union[Color, ColorPalette] = color self.thickness: int = thickness @@ -547,7 +547,7 @@ class BoxCornerAnnotator(BaseAnnotator): thickness (int): Thickness of the corner lines. corner_length (int): Length of each corner line. color_lookup (str): Strategy for mapping colors to annotations. - Options are `INDEX`, `CLASS`, `TRACE`. + Options are `INDEX`, `CLASS`, `TRACK`. """ self.color: Union[Color, ColorPalette] = color self.thickness: int = thickness @@ -631,7 +631,7 @@ class CircleAnnotator(BaseAnnotator): annotating detections. thickness (int): Thickness of the circle line. color_lookup (str): Strategy for mapping colors to annotations. - Options are `INDEX`, `CLASS`, `TRACE`. + Options are `INDEX`, `CLASS`, `TRACK`. """ self.color: Union[Color, ColorPalette] = color @@ -717,7 +717,7 @@ class DotAnnotator(BaseAnnotator): radius (int): Radius of the drawn dots. position (Position): The anchor position for placing the dot. color_lookup (ColorLookup): Strategy for mapping colors to annotations. - Options are `INDEX`, `CLASS`, `TRACE`. + Options are `INDEX`, `CLASS`, `TRACK`. """ self.color: Union[Color, ColorPalette] = color self.radius: int = radius @@ -800,7 +800,7 @@ class LabelAnnotator: text_position (Position): Position of the text relative to the detection. Possible values are defined in the `Position` enum. color_lookup (str): Strategy for mapping colors to annotations. - Options are `INDEX`, `CLASS`, `TRACE`. + Options are `INDEX`, `CLASS`, `TRACK`. """ self.color: Union[Color, ColorPalette] = color self.text_color: Color = text_color @@ -1027,7 +1027,7 @@ class TraceAnnotator: points. Defaults to `30`. thickness (int): The thickness of the trace lines. Defaults to `2`. color_lookup (str): Strategy for mapping colors to annotations. - Options are `INDEX`, `CLASS`, `TRACE`. + Options are `INDEX`, `CLASS`, `TRACK`. """ self.color: Union[Color, ColorPalette] = color self.position = position From 32077eb11d87ab67ec8abf62857b46a81e8c0746 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Mon, 20 Nov 2023 12:21:37 +0100 Subject: [PATCH 159/164] Bump version in pyproject.toml The version in the pyproject.toml file has been updated from 0.17.0rc2 to 0.17.0rc3. --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 81a06177..83a22afc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "supervision" -version = "0.17.0rc2" +version = "0.17.0rc3" description = "A set of easy-to-use utils that will come in handy in any Computer Vision project" authors = ["Piotr Skalski "] maintainers = ["Piotr Skalski "] From 7941527a75bb3607365d73677896a197160c7007 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 20 Nov 2023 17:36:14 +0000 Subject: [PATCH 160/164] =?UTF-8?q?chore(pre=5Fcommit):=20=E2=AC=86=20pre?= =?UTF-8?q?=5Fcommit=20autoupdate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.5 → v0.1.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.5...v0.1.6) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4e96f7ee..20bb1fb5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -71,7 +71,7 @@ repos: - id: black - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.5 + rev: v0.1.6 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] From e6f0ae8514c20b8f19e95281eb9dfb6c618e3c02 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Sun, 26 Nov 2023 11:25:59 +0100 Subject: [PATCH 161/164] Add 'as_hex' method and corresponding test to Color class. --- supervision/draw/color.py | 17 ++++++++++++++++- test/draw/test_color.py | 19 +++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/supervision/draw/color.py b/supervision/draw/color.py index 69bcc9c5..dd9a5e82 100644 --- a/supervision/draw/color.py +++ b/supervision/draw/color.py @@ -68,9 +68,24 @@ class Color: color_hex = color_hex.lstrip("#") if len(color_hex) == 3: color_hex = "".join(c * 2 for c in color_hex) - r, g, b = (int(color_hex[i : i + 2], 16) for i in range(0, 6, 2)) + r, g, b = (int(color_hex[i: i + 2], 16) for i in range(0, 6, 2)) return cls(r, g, b) + def as_hex(self) -> str: + """ + Converts the Color instance to a hex string. + + Returns: + str: The hexadecimal color string. + + Example: + ``` + >>> Color(r=255, g=0, b=255).as_hex() + '#ff00ff' + ``` + """ + return f"#{self.r:02x}{self.g:02x}{self.b:02x}" + def as_rgb(self) -> Tuple[int, int, int]: """ Returns the color as an RGB tuple. diff --git a/test/draw/test_color.py b/test/draw/test_color.py index 723f7043..732e841e 100644 --- a/test/draw/test_color.py +++ b/test/draw/test_color.py @@ -30,3 +30,22 @@ def test_color_from_hex( with exception: result = Color.from_hex(color_hex=color_hex) assert result == expected_result + + +@pytest.mark.parametrize( + "color, expected_result, exception", + [ + (Color.white(), "#ffffff", DoesNotRaise()), + (Color.black(), "#000000", DoesNotRaise()), + (Color.red(), "#ff0000", DoesNotRaise()), + (Color.green(), "#00ff00", DoesNotRaise()), + (Color.blue(), "#0000ff", DoesNotRaise()), + (Color(r=128, g=128, b=0), "#808000", DoesNotRaise()), + ] +) +def test_color_as_hex( + color: Color, expected_result: Optional[str], exception: Exception +) -> None: + with exception: + result = color.as_hex() + assert result == expected_result From 242ac5f7db9e924f47d7c8662f8dd18f60d8922f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 26 Nov 2023 10:27:43 +0000 Subject: [PATCH 162/164] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20aut?= =?UTF-8?q?o=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/draw/color.py | 2 +- test/draw/test_color.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/supervision/draw/color.py b/supervision/draw/color.py index dd9a5e82..9d1b4ad9 100644 --- a/supervision/draw/color.py +++ b/supervision/draw/color.py @@ -68,7 +68,7 @@ class Color: color_hex = color_hex.lstrip("#") if len(color_hex) == 3: color_hex = "".join(c * 2 for c in color_hex) - r, g, b = (int(color_hex[i: i + 2], 16) for i in range(0, 6, 2)) + r, g, b = (int(color_hex[i : i + 2], 16) for i in range(0, 6, 2)) return cls(r, g, b) def as_hex(self) -> str: diff --git a/test/draw/test_color.py b/test/draw/test_color.py index 732e841e..eb4c3657 100644 --- a/test/draw/test_color.py +++ b/test/draw/test_color.py @@ -41,7 +41,7 @@ def test_color_from_hex( (Color.green(), "#00ff00", DoesNotRaise()), (Color.blue(), "#0000ff", DoesNotRaise()), (Color(r=128, g=128, b=0), "#808000", DoesNotRaise()), - ] + ], ) def test_color_as_hex( color: Color, expected_result: Optional[str], exception: Exception From 5333eb2684a594747a2a82c0963f6a3fc20a9470 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Sun, 26 Nov 2023 11:33:56 +0100 Subject: [PATCH 163/164] Update project version in pyproject.toml The version of the project has been updated from "0.17.0rc3" to "0.17.0rc4". --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 09ec80c7..c15e65b8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "supervision" -version = "0.17.0rc3" +version = "0.17.0rc4" description = "A set of easy-to-use utils that will come in handy in any Computer Vision project" authors = ["Piotr Skalski "] maintainers = ["Piotr Skalski "] From 619ec018bc3729b2fe320d5568e9c692ec21b33f Mon Sep 17 00:00:00 2001 From: kim-jeonghyun Date: Sun, 26 Nov 2023 20:33:37 +0900 Subject: [PATCH 164/164] fix: :memo: typo in from_mmdetection docstring --- supervision/detection/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/supervision/detection/core.py b/supervision/detection/core.py index 4079f896..49a3f883 100644 --- a/supervision/detection/core.py +++ b/supervision/detection/core.py @@ -324,7 +324,7 @@ class Detections: >>> inferencer = DetInferencer(model_name, checkpoint, device) >>> mmdet_result = inferencer(SOURCE_IMAGE_PATH, out_dir='./output', - ... return_datasample=True)["predictions"][0] + ... return_datasamples=True)["predictions"][0] >>> detections = sv.Detections.from_mmdet(mmdet_result) ``` """