From c78354203d7bc5c211d3de30e72c0a1293a156e2 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Tue, 16 Jan 2024 17:51:56 +0100 Subject: [PATCH 01/10] ready for review --- examples/speed_estimation/requirements.txt | 8 ++++---- examples/speed_estimation/ultralytics_example.py | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/examples/speed_estimation/requirements.txt b/examples/speed_estimation/requirements.txt index 63f20432..59ca45cb 100644 --- a/examples/speed_estimation/requirements.txt +++ b/examples/speed_estimation/requirements.txt @@ -1,6 +1,6 @@ supervision==0.18.0rc1 -tqdm +tqdm==4.66.1 requests -ultralytics -super-gradients -inference +ultralytics==8.0.237 +super-gradients==3.5.0 +inference==0.9.8 diff --git a/examples/speed_estimation/ultralytics_example.py b/examples/speed_estimation/ultralytics_example.py index 6bb2b2f6..eb2c87df 100644 --- a/examples/speed_estimation/ultralytics_example.py +++ b/examples/speed_estimation/ultralytics_example.py @@ -23,12 +23,16 @@ TARGET = np.array( class ViewTransformer: + def __init__(self, source: np.ndarray, target: np.ndarray) -> None: source = source.astype(np.float32) target = target.astype(np.float32) self.m = cv2.getPerspectiveTransform(source, target) def transform_points(self, points: np.ndarray) -> np.ndarray: + if points.size == 0: + return points + reshaped_points = points.reshape(-1, 1, 2).astype(np.float32) transformed_points = cv2.perspectiveTransform(reshaped_points, self.m) return transformed_points.reshape(-1, 2) From 4d8f15f29518b7c779b07b6b2a24556756640dcb Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 16 Jan 2024 16:55:57 +0000 Subject: [PATCH 02/10] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20auto?= =?UTF-8?q?=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/speed_estimation/ultralytics_example.py | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/speed_estimation/ultralytics_example.py b/examples/speed_estimation/ultralytics_example.py index eb2c87df..4b0436a0 100644 --- a/examples/speed_estimation/ultralytics_example.py +++ b/examples/speed_estimation/ultralytics_example.py @@ -23,7 +23,6 @@ TARGET = np.array( class ViewTransformer: - def __init__(self, source: np.ndarray, target: np.ndarray) -> None: source = source.astype(np.float32) target = target.astype(np.float32) From b12d73a883b8d43559e0fa66d0d02a86546f9dff Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Wed, 17 Jan 2024 09:01:17 +0100 Subject: [PATCH 03/10] ready for review --- 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 851d1d4a..a7e99cbc 100644 --- a/supervision/detection/line_counter.py +++ b/supervision/detection/line_counter.py @@ -54,7 +54,7 @@ class LineZone: 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): + for i, (xyxy, tracker_id) in enumerate(zip(detections.xyxy, detections.tracker_id)): if tracker_id is None: continue From f7145aa6aa02f04efabe48666897196c729d93d8 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 17 Jan 2024 08:06:36 +0000 Subject: [PATCH 04/10] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20auto?= =?UTF-8?q?=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/detection/line_counter.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/supervision/detection/line_counter.py b/supervision/detection/line_counter.py index a7e99cbc..960122e1 100644 --- a/supervision/detection/line_counter.py +++ b/supervision/detection/line_counter.py @@ -54,7 +54,9 @@ class LineZone: crossed_in = np.full(len(detections), False) crossed_out = np.full(len(detections), False) - for i, (xyxy, tracker_id) in enumerate(zip(detections.xyxy, detections.tracker_id)): + for i, (xyxy, tracker_id) in enumerate( + zip(detections.xyxy, detections.tracker_id) + ): if tracker_id is None: continue From 2ba6a22d690e5d2a4196f117accaea6e4d59cf77 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Wed, 17 Jan 2024 09:12:53 +0100 Subject: [PATCH 05/10] bump version from 0.18.0rc1 to 0.18.0rc2 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index ee765557..c8bffe01 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "supervision" -version = "0.18.0rc1" +version = "0.18.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 99d1b6d130fcbadeafdcb5a40f145ae48585db95 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Wed, 17 Jan 2024 12:11:31 +0100 Subject: [PATCH 06/10] ready for review --- docs/annotators.md | 4 ++ docs/assets.md | 4 ++ docs/classification/core.md | 4 ++ docs/datasets.md | 4 ++ docs/detection/core.md | 4 ++ docs/detection/tools/inference_slicer.md | 4 ++ docs/detection/tools/line_zone.md | 4 ++ docs/detection/tools/polygon_zone.md | 4 ++ docs/detection/utils.md | 4 ++ docs/draw/color.md | 4 ++ docs/draw/utils.md | 4 ++ docs/geometry/core.md | 4 ++ docs/how_to/detect_and_annotate.md | 4 ++ docs/how_to/evaluate_model.md | 4 ++ docs/how_to/filter_detections.md | 4 ++ docs/how_to/process_video.md | 4 ++ docs/how_to/track_objects.md | 4 ++ docs/index.md | 4 ++ docs/metrics/detection.md | 4 ++ docs/theme/partials/comments.html | 51 ++++++++++++++++++++++++ docs/trackers.md | 4 ++ docs/utils/file.md | 4 ++ docs/utils/image.md | 4 ++ docs/utils/notebook.md | 4 ++ docs/utils/video.md | 4 ++ examples/count_people_in_zone/.gitignore | 8 ++++ examples/speed_estimation/.gitignore | 7 ++++ examples/traffic_analysis/.gitignore | 7 ++++ 28 files changed, 169 insertions(+) create mode 100644 docs/theme/partials/comments.html diff --git a/docs/annotators.md b/docs/annotators.md index 3dc0dc14..316f37e0 100644 --- a/docs/annotators.md +++ b/docs/annotators.md @@ -1,3 +1,7 @@ +--- +comments: true +--- + === "BoundingBox" ```python diff --git a/docs/assets.md b/docs/assets.md index 13e3cbfb..311815b4 100644 --- a/docs/assets.md +++ b/docs/assets.md @@ -1,3 +1,7 @@ +--- +comments: true +--- + Supervision offers an assets download utility that allows you to download video files that you can use in your demos. diff --git a/docs/classification/core.md b/docs/classification/core.md index 55ae57ea..7307ae04 100644 --- a/docs/classification/core.md +++ b/docs/classification/core.md @@ -1,3 +1,7 @@ +--- +comments: true +--- + ## Classifications :::supervision.classification.core.Classifications diff --git a/docs/datasets.md b/docs/datasets.md index 9efc9e56..ae9c8ed7 100644 --- a/docs/datasets.md +++ b/docs/datasets.md @@ -1,3 +1,7 @@ +--- +comments: true +--- + !!! warning Dataset API is still fluid and may change. If you use Dataset API in your project until further notice, freeze the diff --git a/docs/detection/core.md b/docs/detection/core.md index fc3814fa..e966d60b 100644 --- a/docs/detection/core.md +++ b/docs/detection/core.md @@ -1,3 +1,7 @@ +--- +comments: true +--- + ## Detections :::supervision.detection.core.Detections diff --git a/docs/detection/tools/inference_slicer.md b/docs/detection/tools/inference_slicer.md index 003ed83b..ad93801f 100644 --- a/docs/detection/tools/inference_slicer.md +++ b/docs/detection/tools/inference_slicer.md @@ -1,3 +1,7 @@ +--- +comments: true +--- + ## InferenceSlicer :::supervision.detection.tools.inference_slicer.InferenceSlicer diff --git a/docs/detection/tools/line_zone.md b/docs/detection/tools/line_zone.md index cbecdaa9..0c310267 100644 --- a/docs/detection/tools/line_zone.md +++ b/docs/detection/tools/line_zone.md @@ -1,3 +1,7 @@ +--- +comments: true +--- + ## LineZone :::supervision.detection.line_counter.LineZone diff --git a/docs/detection/tools/polygon_zone.md b/docs/detection/tools/polygon_zone.md index 6679299e..f674707c 100644 --- a/docs/detection/tools/polygon_zone.md +++ b/docs/detection/tools/polygon_zone.md @@ -1,3 +1,7 @@ +--- +comments: true +--- + ## PolygonZone :::supervision.detection.tools.polygon_zone.PolygonZone diff --git a/docs/detection/utils.md b/docs/detection/utils.md index 32d48c70..965f2055 100644 --- a/docs/detection/utils.md +++ b/docs/detection/utils.md @@ -1,3 +1,7 @@ +--- +comments: true +--- + ## box_iou_batch :::supervision.detection.utils.box_iou_batch diff --git a/docs/draw/color.md b/docs/draw/color.md index 5114f4ba..1e4e2a10 100644 --- a/docs/draw/color.md +++ b/docs/draw/color.md @@ -1,3 +1,7 @@ +--- +comments: true +--- + ## Color :::supervision.draw.color.Color diff --git a/docs/draw/utils.md b/docs/draw/utils.md index ee415b81..86ee0a89 100644 --- a/docs/draw/utils.md +++ b/docs/draw/utils.md @@ -1,3 +1,7 @@ +--- +comments: true +--- + ## draw_line :::supervision.draw.utils.draw_line diff --git a/docs/geometry/core.md b/docs/geometry/core.md index 978ad2cf..6a740706 100644 --- a/docs/geometry/core.md +++ b/docs/geometry/core.md @@ -1,3 +1,7 @@ +--- +comments: true +--- + ## Position :::supervision.geometry.core.Position diff --git a/docs/how_to/detect_and_annotate.md b/docs/how_to/detect_and_annotate.md index 087c93bf..2537f47c 100644 --- a/docs/how_to/detect_and_annotate.md +++ b/docs/how_to/detect_and_annotate.md @@ -1,3 +1,7 @@ +--- +comments: true +--- + Supervision offers a streamlined solution to effortlessly annotate predictions from a range of object detection and segmentation models. This guide demonstrates how to execute inference using the YOLOv8 model with either the diff --git a/docs/how_to/evaluate_model.md b/docs/how_to/evaluate_model.md index c9497945..7adab821 100644 --- a/docs/how_to/evaluate_model.md +++ b/docs/how_to/evaluate_model.md @@ -1 +1,5 @@ +--- +comments: true +--- + 🚧 Page under construction. diff --git a/docs/how_to/filter_detections.md b/docs/how_to/filter_detections.md index 1b829d81..63be7d10 100644 --- a/docs/how_to/filter_detections.md +++ b/docs/how_to/filter_detections.md @@ -1,3 +1,7 @@ +--- +comments: true +--- + The advanced filtering capabilities of the `Detections` class offer users a versatile and efficient way to narrow down and refine object detections. This section outlines various filtering methods, including filtering by specific class or a set of classes, confidence, object area, bounding box area, relative area, box dimensions, and designated zones. diff --git a/docs/how_to/process_video.md b/docs/how_to/process_video.md index c9497945..7adab821 100644 --- a/docs/how_to/process_video.md +++ b/docs/how_to/process_video.md @@ -1 +1,5 @@ +--- +comments: true +--- + 🚧 Page under construction. diff --git a/docs/how_to/track_objects.md b/docs/how_to/track_objects.md index 85492db9..80d14e37 100644 --- a/docs/how_to/track_objects.md +++ b/docs/how_to/track_objects.md @@ -1,3 +1,7 @@ +--- +comments: true +--- + Leverage Supervision's advanced capabilities for enhancing your video analysis by seamlessly [tracking](https://supervision.roboflow.com/trackers/) objects recognized by a multitude of object detection and segmentation models. This comprehensive guide will diff --git a/docs/index.md b/docs/index.md index 1d3b4a98..d3c48e20 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,3 +1,7 @@ +--- +comments: true +--- +

diff --git a/docs/metrics/detection.md b/docs/metrics/detection.md index 0c083460..b98498fa 100644 --- a/docs/metrics/detection.md +++ b/docs/metrics/detection.md @@ -1,3 +1,7 @@ +--- +comments: true +--- + !!! warning Evaluation API is still fluid and may change. If you use Evaluation API in your project until further notice, freeze the diff --git a/docs/theme/partials/comments.html b/docs/theme/partials/comments.html new file mode 100644 index 00000000..cd9d5dde --- /dev/null +++ b/docs/theme/partials/comments.html @@ -0,0 +1,51 @@ +{% if page.meta.comments %} +

{{ lang.t("meta.comments") }}

+ + + + + + +{% endif %} \ No newline at end of file diff --git a/docs/trackers.md b/docs/trackers.md index 10c3a01c..6f3c8918 100644 --- a/docs/trackers.md +++ b/docs/trackers.md @@ -1,3 +1,7 @@ +--- +comments: true +--- + ## ByteTrack :::supervision.tracker.byte_tracker.core.ByteTrack diff --git a/docs/utils/file.md b/docs/utils/file.md index f7c785a0..c3fcd6b2 100644 --- a/docs/utils/file.md +++ b/docs/utils/file.md @@ -1,3 +1,7 @@ +--- +comments: true +--- + ## list_files_with_extensions :::supervision.utils.file.list_files_with_extensions diff --git a/docs/utils/image.md b/docs/utils/image.md index 36a833da..cbe36f08 100644 --- a/docs/utils/image.md +++ b/docs/utils/image.md @@ -1,3 +1,7 @@ +--- +comments: true +--- + ## ImageSink :::supervision.utils.image.ImageSink diff --git a/docs/utils/notebook.md b/docs/utils/notebook.md index 76bddc87..98b64801 100644 --- a/docs/utils/notebook.md +++ b/docs/utils/notebook.md @@ -1,3 +1,7 @@ +--- +comments: true +--- + ## plot_image :::supervision.utils.notebook.plot_image diff --git a/docs/utils/video.md b/docs/utils/video.md index a059c87c..e81c9121 100644 --- a/docs/utils/video.md +++ b/docs/utils/video.md @@ -1,3 +1,7 @@ +--- +comments: true +--- + ## VideoInfo :::supervision.utils.video.VideoInfo diff --git a/examples/count_people_in_zone/.gitignore b/examples/count_people_in_zone/.gitignore index f9e2cd53..1104aa29 100644 --- a/examples/count_people_in_zone/.gitignore +++ b/examples/count_people_in_zone/.gitignore @@ -3,3 +3,11 @@ data/* # But re-include all .json files !data/*.json + +*.pt +*.pth +*.mp4 +*.mov +*.png +*.jpg +*.jpeg diff --git a/examples/speed_estimation/.gitignore b/examples/speed_estimation/.gitignore index 5b855697..34efd9e0 100644 --- a/examples/speed_estimation/.gitignore +++ b/examples/speed_estimation/.gitignore @@ -1,2 +1,9 @@ data/ venv*/ +*.pt +*.pth +*.mp4 +*.mov +*.png +*.jpg +*.jpeg diff --git a/examples/traffic_analysis/.gitignore b/examples/traffic_analysis/.gitignore index cea2fc37..bbb746fe 100644 --- a/examples/traffic_analysis/.gitignore +++ b/examples/traffic_analysis/.gitignore @@ -1,2 +1,9 @@ data/ venv/ +*.pt +*.pth +*.mp4 +*.mov +*.png +*.jpg +*.jpeg \ No newline at end of file From e3529436e17df3faa7e90926a9deb532a107a74e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 17 Jan 2024 11:14:03 +0000 Subject: [PATCH 07/10] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20auto?= =?UTF-8?q?=20format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/theme/partials/comments.html | 2 +- examples/traffic_analysis/.gitignore | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/theme/partials/comments.html b/docs/theme/partials/comments.html index cd9d5dde..d95dd6b7 100644 --- a/docs/theme/partials/comments.html +++ b/docs/theme/partials/comments.html @@ -48,4 +48,4 @@ }) }) -{% endif %} \ No newline at end of file +{% endif %} diff --git a/examples/traffic_analysis/.gitignore b/examples/traffic_analysis/.gitignore index bbb746fe..a0aa5253 100644 --- a/examples/traffic_analysis/.gitignore +++ b/examples/traffic_analysis/.gitignore @@ -6,4 +6,4 @@ venv/ *.mov *.png *.jpg -*.jpeg \ No newline at end of file +*.jpeg From e32b05a636dab2ea1f39299e529c4b22b8baa8da Mon Sep 17 00:00:00 2001 From: Piotr Skalski Date: Wed, 17 Jan 2024 15:38:19 +0100 Subject: [PATCH 08/10] Update speed estimation example tutorial README.md --- examples/speed_estimation/README.md | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/examples/speed_estimation/README.md b/examples/speed_estimation/README.md index 35685938..c8a1381e 100644 --- a/examples/speed_estimation/README.md +++ b/examples/speed_estimation/README.md @@ -1,18 +1,18 @@ # speed estimation +[![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/roboflow-ai/notebooks/blob/main/notebooks/how-to-estimate-vehicle-speed-with-computer-vision.ipynb) +[![YouTube](https://badges.aleen42.com/src/youtube.svg)](https://youtu.be/uWP6UjDeZvY) + ## 👋 hello This example performs speed estimation analysis using various object-detection models and ByteTrack - a simple yet effective online multi-object tracking method. It uses the supervision package for multiple tasks such as tracking, annotations, etc. -https://github.com/roboflow/supervision/assets/26109316/0542fd3c-bb5f-475e-b96c-793560abeb18 +https://github.com/roboflow/supervision/assets/26109316/d50118c1-2ae4-458d-915a-5d860fd36f71 ## 💻 install -> [!NOTE] -> YOLO-NAS is compatible with Python versions up to and including Python 3.10. - - clone repository and navigate to example directory ```bash @@ -63,7 +63,15 @@ https://github.com/roboflow/supervision/assets/26109316/0542fd3c-bb5f-475e-b96c- for the model. Default is 0.7. This value is used to manage object detection accuracy, particularly in distinguishing between different objects. -## ⚙️ run +## ⚙️ configure + +Adjust the' SOURCE' and' TARGET' values if you plan to run a speed estimation script +on your video file. Those must be adjusted separately for each camera view. Learn more +from our YouTube [tutorial](https://youtu.be/uWP6UjDeZvY). + +![speed-estimation-perspective-updated-1](https://github.com/roboflow/supervision/assets/26109316/837c5ee5-db99-4e3f-84bd-d27a5f0d761c) + +## 🚀 run - yolo-nas From 1c414bd70f3058dd9c4f33e2b53eacc3f21dd5b9 Mon Sep 17 00:00:00 2001 From: Piotr Skalski Date: Wed, 17 Jan 2024 15:52:41 +0100 Subject: [PATCH 09/10] Update speed estimation example tutorial README.md --- examples/speed_estimation/README.md | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/examples/speed_estimation/README.md b/examples/speed_estimation/README.md index c8a1381e..956020e4 100644 --- a/examples/speed_estimation/README.md +++ b/examples/speed_estimation/README.md @@ -11,6 +11,12 @@ supervision package for multiple tasks such as tracking, annotations, etc. https://github.com/roboflow/supervision/assets/26109316/d50118c1-2ae4-458d-915a-5d860fd36f71 +> [!IMPORTANT] +> Adjust the [`SOURCE`](https://github.com/roboflow/supervision/blob/e32b05a636dab2ea1f39299e529c4b22b8baa8da/examples/speed_estimation/ultralytics_example.py#L10) +> and [`TARGET`](https://github.com/roboflow/supervision/blob/e32b05a636dab2ea1f39299e529c4b22b8baa8da/examples/speed_estimation/ultralytics_example.py#L15) +> configuration if you plan to run a speed estimation script on your video file. Those must be adjusted separately for each camera view. You can learn more +> from our YouTube [tutorial](https://youtu.be/uWP6UjDeZvY). + ## 💻 install - clone repository and navigate to example directory @@ -63,15 +69,7 @@ https://github.com/roboflow/supervision/assets/26109316/d50118c1-2ae4-458d-915a- for the model. Default is 0.7. This value is used to manage object detection accuracy, particularly in distinguishing between different objects. -## ⚙️ configure - -Adjust the' SOURCE' and' TARGET' values if you plan to run a speed estimation script -on your video file. Those must be adjusted separately for each camera view. Learn more -from our YouTube [tutorial](https://youtu.be/uWP6UjDeZvY). - -![speed-estimation-perspective-updated-1](https://github.com/roboflow/supervision/assets/26109316/837c5ee5-db99-4e3f-84bd-d27a5f0d761c) - -## 🚀 run +## ⚙️ run - yolo-nas From 64661a3e4aae2830a37cc277ec2d73c9dee0ee1c Mon Sep 17 00:00:00 2001 From: Piotr Skalski Date: Wed, 17 Jan 2024 15:54:12 +0100 Subject: [PATCH 10/10] Update `built with supervision` section in README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f6832b3d..1fd46c2c 100644 --- a/README.md +++ b/README.md @@ -237,7 +237,7 @@ https://user-images.githubusercontent.com/26109316/207858600-ee862b22-0353-440b- https://github.com/roboflow/supervision/assets/26109316/c9436828-9fbf-4c25-ae8c-60e9c81b3900 -https://github.com/roboflow/supervision/assets/26109316/f84db7b5-79e2-4142-a1da-64daa43ce667 +https://github.com/roboflow/supervision/assets/26109316/3ac6982f-4943-4108-9b7f-51787ef1a69f ## 📚 documentation