Reference for ultralytics/solutions/queue_management.py
Note
This file is available at https://github.com/ultralytics/ultralytics/blob/main/ultralytics/solutions/queue_management.py. If you spot a problem please help fix it by contributing a Pull Request 🛠️. Thank you 🙏!
ultralytics.solutions.queue_management.QueueManager
QueueManager(
names,
reg_pts=None,
line_thickness=2,
track_thickness=2,
view_img=False,
region_color=(255, 0, 255),
view_queue_counts=True,
draw_tracks=False,
count_txt_color=(255, 255, 255),
track_color=None,
region_thickness=5,
fontsize=0.7,
)
A class to manage the queue in a real-time video stream based on object tracks.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
names |
dict
|
A dictionary mapping class IDs to class names. |
required |
reg_pts |
list of tuples
|
Points defining the counting region polygon. Defaults to a predefined rectangle. |
None
|
line_thickness |
int
|
Thickness of the annotation lines. Defaults to 2. |
2
|
track_thickness |
int
|
Thickness of the track lines. Defaults to 2. |
2
|
view_img |
bool
|
Whether to display the image frames. Defaults to False. |
False
|
region_color |
tuple
|
Color of the counting region lines (BGR). Defaults to (255, 0, 255). |
(255, 0, 255)
|
view_queue_counts |
bool
|
Whether to display the queue counts. Defaults to True. |
True
|
draw_tracks |
bool
|
Whether to draw tracks of the objects. Defaults to False. |
False
|
count_txt_color |
tuple
|
Color of the count text (BGR). Defaults to (255, 255, 255). |
(255, 255, 255)
|
track_color |
tuple
|
Color of the tracks. If None, different colors will be used for different tracks. Defaults to None. |
None
|
region_thickness |
int
|
Thickness of the counting region lines. Defaults to 5. |
5
|
fontsize |
float
|
Font size for the text annotations. Defaults to 0.7. |
0.7
|
Source code in ultralytics/solutions/queue_management.py
display_frames
Displays the current frame with annotations.
Source code in ultralytics/solutions/queue_management.py
extract_and_process_tracks
Extracts and processes tracks for queue management in a video stream.
Source code in ultralytics/solutions/queue_management.py
process_queue
Main function to start the queue management process.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
im0 |
ndarray
|
Current frame from the video stream. |
required |
tracks |
list
|
List of tracks obtained from the object tracking process. |
required |