Are you sure you want to delete this access key?
comments | description | keywords |
---|---|---|
true | Learn how to use Ultralytics YOLOv8 for precise object counting in specified regions, enhancing efficiency across various applications. | object counting, regions, YOLOv8, computer vision, Ultralytics, efficiency, accuracy, automation, real-time, applications, surveillance, monitoring |
Object counting in regions with Ultralytics YOLOv8 involves precisely determining the number of objects within specified areas using advanced computer vision. This approach is valuable for optimizing processes, enhancing security, and improving efficiency in various applications.
Watch: Ultralytics YOLOv8 Object Counting in Multiple & Movable Regions
Retail | Market Streets |
---|---|
![]() |
![]() |
People Counting in Different Region using Ultralytics YOLOv8 | Crowd Counting in Different Region using Ultralytics YOLOv8 |
Begin by cloning the Ultralytics repository, installing dependencies, and navigating to the local directory using the provided commands in Step 2.
# Clone Ultralytics repo
git clone https://github.com/ultralytics/ultralytics
# Navigate to the local directory
cd ultralytics/examples/YOLOv8-Region-Counter
Execute the following basic commands for inference.
???+ tip "Region is Movable"
During video playback, you can interactively move the region within the video by clicking and dragging using the left mouse button.
# Save results
python yolov8_region_counter.py --source "path/to/video.mp4" --save-img
# Run model on CPU
python yolov8_region_counter.py --source "path/to/video.mp4" --device cpu
# Change model file
python yolov8_region_counter.py --source "path/to/video.mp4" --weights "path/to/model.pt"
# Detect specific classes (e.g., first and third classes)
python yolov8_region_counter.py --source "path/to/video.mp4" --classes 0 2
# View results without saving
python yolov8_region_counter.py --source "path/to/video.mp4" --view-img
Name | Type | Default | Description |
---|---|---|---|
--source |
str |
None |
Path to video file, for webcam 0 |
--line_thickness |
int |
2 |
Bounding Box thickness |
--save-img |
bool |
False |
Save the predicted video/image |
--weights |
str |
yolov8n.pt |
Weights file path |
--classes |
list |
None |
Detect specific classes i.e. --classes 0 2 |
--region-thickness |
int |
2 |
Region Box thickness |
--track-thickness |
int |
2 |
Tracking line thickness |
Object counting in specified regions with Ultralytics YOLOv8 involves detecting and tallying the number of objects within defined areas using advanced computer vision. This precise method enhances efficiency and accuracy across various applications like manufacturing, surveillance, and traffic monitoring.
Follow these steps to run object counting in Ultralytics YOLOv8:
Clone the Ultralytics repository and navigate to the directory:
git clone https://github.com/ultralytics/ultralytics
cd ultralytics/examples/YOLOv8-Region-Counter
Execute the region counting script:
python yolov8_region_counter.py --source "path/to/video.mp4" --save-img
For more options, visit the Run Region Counting section.
Using Ultralytics YOLOv8 for object counting in regions offers several advantages:
Explore deeper benefits in the Advantages section.
Yes, with Ultralytics YOLOv8, regions can be interactively moved during video playback. Simply click and drag with the left mouse button to reposition the region. This feature enhances flexibility for dynamic environments. Learn more in the tip section for movable regions.
Object counting with Ultralytics YOLOv8 can be applied to numerous real-world scenarios:
Explore more examples in the Real World Applications section.
Press p or to see the previous file or, n or to see the next file
Browsing data directories saved to S3 is possible with DAGsHub. Let's configure your repository to easily display your data in the context of any commit!
ultralytics is now integrated with AWS S3!
Are you sure you want to delete this access key?
Browsing data directories saved to Google Cloud Storage is possible with DAGsHub. Let's configure your repository to easily display your data in the context of any commit!
ultralytics is now integrated with Google Cloud Storage!
Are you sure you want to delete this access key?
Browsing data directories saved to Azure Cloud Storage is possible with DAGsHub. Let's configure your repository to easily display your data in the context of any commit!
ultralytics is now integrated with Azure Cloud Storage!
Are you sure you want to delete this access key?
Browsing data directories saved to S3 compatible storage is possible with DAGsHub. Let's configure your repository to easily display your data in the context of any commit!
ultralytics is now integrated with your S3 compatible storage!
Are you sure you want to delete this access key?