From a02bff04b7a4b6b81f5ebdd3ab22d7850cdaa1fd Mon Sep 17 00:00:00 2001 From: PatelPrem21 Date: Sat, 2 May 2026 14:37:49 +0530 Subject: [PATCH 1/3] docs: add sample image download and sv.plot_image() to detect_and_annotate tutorial --- docs/how_to/detect_and_annotate.md | 38 ++++++++++++++++++------------ 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/docs/how_to/detect_and_annotate.md b/docs/how_to/detect_and_annotate.md index a9bf701ac9..983cfb5b02 100644 --- a/docs/how_to/detect_and_annotate.md +++ b/docs/how_to/detect_and_annotate.md @@ -13,6 +13,13 @@ date_modified: 2026-04-22 # Detect and Annotate +!!! tip "Sample Image" + Don't have an image? Download the one used in this tutorial: +```bash + wget https://media.roboflow.com/notebooks/examples/dog.jpeg +``` + Then replace `` with `"dog.jpeg"`. + Supervision provides a seamless process for annotating predictions generated by various object detection and segmentation models. This guide shows how to perform inference with the [Inference](https://github.com/roboflow/inference), @@ -37,7 +44,7 @@ To run inference, initialize your chosen model and pass the source image to its from inference import get_model model = get_model(model_id="yolov8n-640") - image = cv2.imread("") + image = cv2.imread("dog.jpeg") results = model.infer(image)[0] ``` @@ -48,7 +55,7 @@ To run inference, initialize your chosen model and pass the source image to its from ultralytics import YOLO model = YOLO("yolov8n.pt") - image = cv2.imread("") + image = cv2.imread("dog.jpeg") results = model(image)[0] ``` @@ -62,7 +69,7 @@ To run inference, initialize your chosen model and pass the source image to its processor = DetrImageProcessor.from_pretrained("facebook/detr-resnet-50") model = DetrForObjectDetection.from_pretrained("facebook/detr-resnet-50") - image = Image.open("") + image = Image.open("dog.jpeg") inputs = processor(images=image, return_tensors="pt") with torch.no_grad(): @@ -91,7 +98,7 @@ Each supported framework has a dedicated class method on `sv.Detections` that co from inference import get_model model = get_model(model_id="yolov8n-640") - image = cv2.imread("") + image = cv2.imread("dog.jpeg") results = model.infer(image)[0] detections = sv.Detections.from_inference(results) ``` @@ -106,7 +113,7 @@ Each supported framework has a dedicated class method on `sv.Detections` that co from ultralytics import YOLO model = YOLO("yolov8n.pt") - image = cv2.imread("") + image = cv2.imread("dog.jpeg") results = model(image)[0] detections = sv.Detections.from_ultralytics(results) ``` @@ -124,7 +131,7 @@ Each supported framework has a dedicated class method on `sv.Detections` that co processor = DetrImageProcessor.from_pretrained("facebook/detr-resnet-50") model = DetrForObjectDetection.from_pretrained("facebook/detr-resnet-50") - image = Image.open("") + image = Image.open("dog.jpeg") inputs = processor(images=image, return_tensors="pt") with torch.no_grad(): @@ -161,7 +168,7 @@ To draw bounding boxes and class labels on your image, create a `BoxAnnotator` a from inference import get_model model = get_model(model_id="yolov8n-640") - image = cv2.imread("") + image = cv2.imread("dog.jpeg") results = model.infer(image)[0] detections = sv.Detections.from_inference(results) @@ -182,7 +189,7 @@ To draw bounding boxes and class labels on your image, create a `BoxAnnotator` a from ultralytics import YOLO model = YOLO("yolov8n.pt") - image = cv2.imread("") + image = cv2.imread("dog.jpeg") results = model(image)[0] detections = sv.Detections.from_ultralytics(results) @@ -206,7 +213,7 @@ To draw bounding boxes and class labels on your image, create a `BoxAnnotator` a processor = DetrImageProcessor.from_pretrained("facebook/detr-resnet-50") model = DetrForObjectDetection.from_pretrained("facebook/detr-resnet-50") - image = Image.open("") + image = Image.open("dog.jpeg") inputs = processor(images=image, return_tensors="pt") with torch.no_grad(): @@ -245,7 +252,7 @@ override this behavior by passing a list of custom `labels` to the `annotate` me from inference import get_model model = get_model(model_id="yolov8n-640") - image = cv2.imread("") + image = cv2.imread("dog.jpeg") results = model.infer(image)[0] detections = sv.Detections.from_inference(results) @@ -272,7 +279,7 @@ override this behavior by passing a list of custom `labels` to the `annotate` me from ultralytics import YOLO model = YOLO("yolov8n.pt") - image = cv2.imread("") + image = cv2.imread("dog.jpeg") results = model(image)[0] detections = sv.Detections.from_ultralytics(results) @@ -302,7 +309,7 @@ override this behavior by passing a list of custom `labels` to the `annotate` me processor = DetrImageProcessor.from_pretrained("facebook/detr-resnet-50") model = DetrForObjectDetection.from_pretrained("facebook/detr-resnet-50") - image = Image.open("") + image = Image.open("dog.jpeg") inputs = processor(images=image, return_tensors="pt") with torch.no_grad(): @@ -349,7 +356,7 @@ that will allow you to draw masks instead of boxes. from inference import get_model model = get_model(model_id="yolov8n-seg-640") - image = cv2.imread("") + image = cv2.imread("dog.jpeg") results = model.infer(image)[0] detections = sv.Detections.from_inference(results) @@ -364,6 +371,7 @@ that will allow you to draw masks instead of boxes. scene=annotated_image, detections=detections, ) + sv.plot_image(annotated_image) ``` === "Ultralytics" @@ -374,7 +382,7 @@ that will allow you to draw masks instead of boxes. from ultralytics import YOLO model = YOLO("yolov8n-seg.pt") - image = cv2.imread("") + image = cv2.imread("dog.jpeg") results = model(image)[0] detections = sv.Detections.from_ultralytics(results) @@ -402,7 +410,7 @@ that will allow you to draw masks instead of boxes. processor = DetrImageProcessor.from_pretrained("facebook/detr-resnet-50-panoptic") model = DetrForSegmentation.from_pretrained("facebook/detr-resnet-50-panoptic") - image = Image.open("") + image = Image.open("dog.jpeg") inputs = processor(images=image, return_tensors="pt") with torch.no_grad(): From 34c5636b20fd6d36ac4a9bbcc685fcdcf95ea17c Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 2 May 2026 09:15:46 +0000 Subject: [PATCH 2/3] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20auto=20?= =?UTF-8?q?format=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 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/how_to/detect_and_annotate.md b/docs/how_to/detect_and_annotate.md index 983cfb5b02..e919fd8669 100644 --- a/docs/how_to/detect_and_annotate.md +++ b/docs/how_to/detect_and_annotate.md @@ -14,11 +14,16 @@ date_modified: 2026-04-22 # Detect and Annotate !!! tip "Sample Image" + Don't have an image? Download the one used in this tutorial: + ```bash - wget https://media.roboflow.com/notebooks/examples/dog.jpeg +wget https://media.roboflow.com/notebooks/examples/dog.jpeg +``` + +``` +Then replace `` with `"dog.jpeg"`. ``` - Then replace `` with `"dog.jpeg"`. Supervision provides a seamless process for annotating predictions generated by various object detection and segmentation models. This guide shows how to perform inference From 41c58695f72db07dc02186fcff8dd09e60f75ee4 Mon Sep 17 00:00:00 2001 From: Jirka Borovec <6035284+Borda@users.noreply.github.com> Date: Tue, 19 May 2026 14:17:41 +0200 Subject: [PATCH 3/3] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- docs/how_to/detect_and_annotate.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/how_to/detect_and_annotate.md b/docs/how_to/detect_and_annotate.md index e919fd8669..3c0163e1ad 100644 --- a/docs/how_to/detect_and_annotate.md +++ b/docs/how_to/detect_and_annotate.md @@ -17,13 +17,13 @@ date_modified: 2026-04-22 Don't have an image? Download the one used in this tutorial: -```bash -wget https://media.roboflow.com/notebooks/examples/dog.jpeg -``` + ```bash + wget https://media.roboflow.com/notebooks/examples/dog.jpeg + ``` -``` -Then replace `` with `"dog.jpeg"`. -``` + ``` + Then replace `` with `"dog.jpeg"`. + ``` Supervision provides a seamless process for annotating predictions generated by various object detection and segmentation models. This guide shows how to perform inference