Skip to content

Conversation

@capjamesg
Copy link
Contributor

Description

This PR adds a guide on how to count objects in a zone using the PolygonZone function in supervision.

Type of change

  • New documentation

How has this change been tested, please provide a testcase or example of how you tested the change?

This change was tested by opening the new docs page to make sure all content rendered properly.

Any specific deployment considerations

N/A

Docs

See above.

@capjamesg capjamesg requested a review from SkalskiP October 27, 2023 13:46
@capjamesg capjamesg self-assigned this Oct 27, 2023
@capjamesg capjamesg added the documentation Improvements or additions to documentation label Oct 27, 2023
@SkalskiP
Copy link
Collaborator

Hi @capjamesg 👋🏻

Could you make the changes listed below?

  • Use video that can be downloaded using supervision[assets]. You can find an example of docs already doing this here. Let's enable people to go through exactly the same example as we did.
  • If you mention a Supervision API element like sv.process_video or sv.PolygonZone in the text, link them. Let's make it as easy as possible for people to find documentation of the blocks they need.
  • Show complete code. I don't think we should expect people to be able to put the demo code together themselves, even if we give them all the necessary blocks of code. Our users often ask very basic questions. Once again, Track Objects could be an example.
  • Show results. If your code draws a zona in the picture, show what the drawn zona looks like. If you show code that processes the entire video, show the resulting video. Once again, Track Objects could be an example.

@capjamesg
Copy link
Contributor Author

capjamesg commented Nov 14, 2023

I have responded to your feedback.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new documentation guide that demonstrates how to count objects within defined zones using supervision's PolygonZone functionality. The guide walks through counting cars in a traffic video using YOLOv8 and supervision's zone detection features.

  • Adds a new "Count in Zone" entry to the documentation navigation
  • Creates a comprehensive tutorial with code examples for zone-based object counting
  • Includes practical examples using video processing and the PolygonZone web utility

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
mkdocs.yml Adds "Count in Zone" guide to the navigation menu under the how-to section
docs/how_to/count_in_zone.md New tutorial guide demonstrating zone-based object counting with code examples and video demonstrations

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

color=colors.by_idx(index),
thickness=4,
text_thickness=4,
text_scale=2
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing comma after text_scale parameter. This will cause a syntax error.

Copilot uses AI. Check for mistakes.

[View the notebook that accompanies this tutorial](https://github.com/roboflow/notebooks/blob/main/notebooks/how-to-use-polygonzone-annotate-and-supervision.ipynb).

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] extension.
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The text refers to "supervision[assets] extension" but this appears to be a package extra/dependency specification that should be formatted differently. Consider revising to clarify that users need to install supervision with the assets extra, or if it's included by default, simply remove the bracketed notation and refer to it as "supervision's asset downloading functionality" or similar.

Suggested change
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] extension.
To make it easier for you to follow our tutorial download the video we will use as an example. You can do this using the `supervision.assets` module:

Copilot uses AI. Check for mistakes.

model = YOLO('yolov8s.pt')

VIDEO = "video.mp4"
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable VIDEO is set to "video.mp4" but earlier in the guide (line 10) the downloaded asset is VideoAssets.VEHICLES_2. There's a disconnect between the downloaded asset and the VIDEO variable assignment. Either update the VIDEO variable to use the actual path of the downloaded asset, or provide guidance on how users should reference the downloaded video file.

Suggested change
VIDEO = "video.mp4"
VIDEO = str(VideoAssets.VEHICLES_2)

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants