Are you sure you want to delete this access key?
comments | description | keywords |
---|---|---|
true | Learn how to manage and optimize queues using Ultralytics YOLOv8 to reduce wait times and increase efficiency in various real-world applications. | queue management, YOLOv8, Ultralytics, reduce wait times, efficiency, customer satisfaction, retail, airports, healthcare, banks |
Queue management using Ultralytics YOLOv8 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.
Watch: How to Implement Queue Management with Ultralytics YOLOv8 | Airport and Metro Station
Logistics | Retail |
---|---|
![]() |
![]() |
Queue management at airport ticket counter Using Ultralytics YOLOv8 | Queue monitoring in crowd Ultralytics YOLOv8 |
!!! example "Queue Management using YOLOv8 Example"
=== "Queue Manager"
```python
import cv2
from ultralytics import YOLO, solutions
model = YOLO("yolov8n.pt")
cap = cv2.VideoCapture("path/to/video/file.mp4")
assert cap.isOpened(), "Error reading video file"
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))
queue_region = [(20, 400), (1080, 404), (1080, 360), (20, 360)]
queue = solutions.QueueManager(
names=model.names,
reg_pts=queue_region,
line_thickness=3,
)
while cap.isOpened():
success, im0 = cap.read()
if success:
tracks = model.track(im0, persist=True)
out = queue.process_queue(im0, tracks)
video_writer.write(im0)
if cv2.waitKey(1) & 0xFF == ord("q"):
break
continue
print("Video frame is empty or video processing has been successfully completed.")
break
cap.release()
cv2.destroyAllWindows()
```
=== "Queue Manager Specific Classes"
```python
import cv2
from ultralytics import YOLO, solutions
model = YOLO("yolov8n.pt")
cap = cv2.VideoCapture("path/to/video/file.mp4")
assert cap.isOpened(), "Error reading video file"
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))
queue_region = [(20, 400), (1080, 404), (1080, 360), (20, 360)]
queue = solutions.QueueManager(
names=model.names,
reg_pts=queue_region,
line_thickness=3,
)
while cap.isOpened():
success, im0 = cap.read()
if success:
tracks = model.track(im0, persist=True, classes=0) # Only person class
out = queue.process_queue(im0, tracks)
video_writer.write(im0)
if cv2.waitKey(1) & 0xFF == ord("q"):
break
continue
print("Video frame is empty or video processing has been successfully completed.")
break
cap.release()
cv2.destroyAllWindows()
```
QueueManager
Name | Type | Default | Description |
---|---|---|---|
names |
dict |
model.names |
A dictionary mapping class IDs to class names. |
reg_pts |
list of tuples |
[(20, 400), (1260, 400)] |
Points defining the counting region polygon. Defaults to a predefined rectangle. |
line_thickness |
int |
2 |
Thickness of the annotation lines. |
view_img |
bool |
False |
Whether to display the image frames. |
draw_tracks |
bool |
False |
Whether to draw tracks of the objects. |
model.track
{% include "macros/track-args.md" %}
To use Ultralytics YOLOv8 for real-time queue management, you can follow these steps:
YOLO("yolov8n.pt")
.cv2.VideoCapture
.Here's a minimal example:
import cv2
from ultralytics import YOLO, solutions
model = YOLO("yolov8n.pt")
cap = cv2.VideoCapture("path/to/video.mp4")
queue_region = [(20, 400), (1080, 404), (1080, 360), (20, 360)]
queue = solutions.QueueManager(
names=model.names,
reg_pts=queue_region,
line_thickness=3,
)
while cap.isOpened():
success, im0 = cap.read()
if success:
tracks = model.track(im0, show=False, persist=True, verbose=False)
out = queue.process_queue(im0, tracks)
cv2.imshow("Queue Management", im0)
if cv2.waitKey(1) & 0xFF == ord("q"):
break
cap.release()
cv2.destroyAllWindows()
Leveraging Ultralytics HUB can streamline this process by providing a user-friendly platform for deploying and managing your queue management solution.
Using Ultralytics YOLOv8 for queue management offers several benefits:
For more details, explore our Queue Management solutions.
Ultralytics YOLOv8 has several advantages over TensorFlow and Detectron2 for queue management:
Learn how to get started with Ultralytics YOLO.
Yes, Ultralytics YOLOv8 can manage various types of queues, including those in airports and retail environments. By configuring the QueueManager with specific regions and settings, YOLOv8 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(
names=model.names,
reg_pts=queue_region_airport,
line_thickness=3,
)
For more information on diverse applications, check out our Real World Applications section.
Ultralytics YOLOv8 is used in various real-world applications for queue management:
Check our blog on real-world queue management to learn more.
Press p or to see the previous file or, n or to see the next file
Are you sure you want to delete this access key?
Are you sure you want to delete this access key?
Are you sure you want to delete this access key?
Are you sure you want to delete this access key?