docs/en/guides/queue-management.md
<a href="https://colab.research.google.com/github/ultralytics/notebooks/blob/main/notebooks/how-to-monitor-objects-in-queue-using-queue-management-solution.ipynb"></a>
Queue management using Ultralytics YOLO26 involves organizing and controlling lines of people or vehicles to reduce wait times and enhance efficiency. It's about optimizing queues to improve customer satisfaction and system performance in various settings like retail, banks, airports, and healthcare facilities.
<p align="center"> <iframe loading="lazy" width="720" height="405" src="https://www.youtube.com/embed/Gxr9SpYPLh0" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen> </iframe><strong>Watch:</strong> How to Build a Queue Management System with Ultralytics YOLO | Retail, Bank & Crowd Use Cases 🚀
</p>| Logistics | Retail |
|---|---|
| Queue management at airport ticket counter Using Ultralytics YOLO26 | Queue monitoring in crowd Ultralytics YOLO26 |
!!! example "Queue Management using Ultralytics YOLO"
=== "CLI"
```bash
# Run a queue example
yolo solutions queue show=True
# Pass a source video
yolo solutions queue source="path/to/video.mp4"
# Pass queue coordinates
yolo solutions queue region="[(20, 400), (1080, 400), (1080, 360), (20, 360)]"
```
=== "Python"
```python
import cv2
from ultralytics import solutions
cap = cv2.VideoCapture("path/to/video.mp4")
assert cap.isOpened(), "Error reading video file"
# Video writer
w, h, fps = (int(cap.get(x)) for x in (cv2.CAP_PROP_FRAME_WIDTH, cv2.CAP_PROP_FRAME_HEIGHT, cv2.CAP_PROP_FPS))
video_writer = cv2.VideoWriter("queue_management.avi", cv2.VideoWriter_fourcc(*"mp4v"), fps, (w, h))
# Define queue points
queue_region = [(20, 400), (1080, 400), (1080, 360), (20, 360)] # region points
# queue_region = [(20, 400), (1080, 400), (1080, 360), (20, 360), (20, 400)] # polygon points
# Initialize queue manager object
queuemanager = solutions.QueueManager(
show=True, # display the output
model="yolo26n.pt", # path to the YOLO26 model file
region=queue_region, # pass queue region points
)
# Process video
while cap.isOpened():
success, im0 = cap.read()
if not success:
print("Video frame is empty or processing is complete.")
break
results = queuemanager(im0)
# print(results) # access the output
video_writer.write(results.plot_im) # write the processed frame.
cap.release()
video_writer.release()
cv2.destroyAllWindows() # destroy all opened windows
```
QueueManager ArgumentsHere's a table with the QueueManager arguments:
{% from "macros/solutions-args.md" import param_table %} {{ param_table(["model", "region"]) }}
The QueueManagement solution also support some track arguments:
{% from "macros/track-args.md" import param_table %} {{ param_table(["tracker", "conf", "iou", "classes", "verbose", "device"]) }}
Additionally, the following visualization parameters are available:
{% from "macros/visualization-args.md" import param_table %} {{ param_table(["show", "line_width", "show_conf", "show_labels"]) }}
When implementing queue management with YOLO26, consider these best practices:
To use Ultralytics YOLO26 for real-time queue management, you can follow these steps:
YOLO("yolo26n.pt").cv2.VideoCapture.Here's a minimal example:
import cv2
from ultralytics import solutions
cap = cv2.VideoCapture("path/to/video.mp4")
queue_region = [(20, 400), (1080, 400), (1080, 360), (20, 360)]
queuemanager = solutions.QueueManager(
model="yolo26n.pt",
region=queue_region,
line_width=3,
show=True,
)
while cap.isOpened():
success, im0 = cap.read()
if success:
results = queuemanager(im0)
cap.release()
cv2.destroyAllWindows()
Leveraging Ultralytics Platform can streamline this process by providing a user-friendly platform for deploying and managing your queue management solution.
Using Ultralytics YOLO26 for queue management offers several benefits:
For more details, explore our Queue Management solutions.
Ultralytics YOLO26 has several advantages over TensorFlow and Detectron2 for queue management:
Learn how to get started with Ultralytics YOLO.
Yes, Ultralytics YOLO26 can manage various types of queues, including those in airports and retail environments. By configuring the QueueManager with specific regions and settings, YOLO26 can adapt to different queue layouts and densities.
Example for airports:
queue_region_airport = [(50, 600), (1200, 600), (1200, 550), (50, 550)]
queue_airport = solutions.QueueManager(
model="yolo26n.pt",
region=queue_region_airport,
line_width=3,
)
For more information on diverse applications, check out our Real World Applications section.
Ultralytics YOLO26 is used in various real-world applications for queue management:
Check our blog on real-world queue management to learn more about how computer vision is transforming queue monitoring across industries.