Reference for ultralytics/solutions/parking_management.py
Note
This file is available at https://github.com/ultralytics/ultralytics/blob/main/ultralytics/solutions/parking_management.py. If you spot a problem please help fix it by contributing a Pull Request 🛠️. Thank you 🙏!
ultralytics.solutions.parking_management.ParkingPtsSelection
Class for selecting and managing parking zone points on images using a Tkinter-based UI.
Source code in ultralytics/solutions/parking_management.py
draw_bounding_box
Draw bounding box on canvas.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
box |
list
|
Bounding box data |
required |
Source code in ultralytics/solutions/parking_management.py
on_canvas_click
Handle mouse clicks on canvas to create points for bounding boxes.
Source code in ultralytics/solutions/parking_management.py
remove_last_bounding_box
Remove the last drawn bounding box from canvas.
Source code in ultralytics/solutions/parking_management.py
save_to_json
Saves rescaled bounding boxes to 'bounding_boxes.json' based on image-to-canvas size ratio.
Source code in ultralytics/solutions/parking_management.py
upload_image
Upload an image and resize it to fit canvas.
Source code in ultralytics/solutions/parking_management.py
ultralytics.solutions.parking_management.ParkingManagement
ParkingManagement(
model_path,
txt_color=(0, 0, 0),
bg_color=(255, 255, 255),
occupied_region_color=(0, 255, 0),
available_region_color=(0, 0, 255),
margin=10,
)
Manages parking occupancy and availability using YOLOv8 for real-time monitoring and visualization.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_path |
str
|
Path to the YOLOv8 model. |
required |
txt_color |
tuple
|
RGB color tuple for text. |
(0, 0, 0)
|
bg_color |
tuple
|
RGB color tuple for background. |
(255, 255, 255)
|
occupied_region_color |
tuple
|
RGB color tuple for occupied regions. |
(0, 255, 0)
|
available_region_color |
tuple
|
RGB color tuple for available regions. |
(0, 0, 255)
|
margin |
int
|
Margin for text display. |
10
|
Source code in ultralytics/solutions/parking_management.py
display_frames
Display frame.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
im0 |
ndarray
|
inference image |
required |
Source code in ultralytics/solutions/parking_management.py
load_model
parking_regions_extraction
staticmethod
Extract parking regions from json file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
json_file |
str
|
file that have all parking slot points |
required |
Source code in ultralytics/solutions/parking_management.py
process_data
Process the model data for parking lot management.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
json_data |
str
|
json data for parking lot management |
required |
im0 |
ndarray
|
inference image |
required |
boxes |
list
|
bounding boxes data |
required |
clss |
list
|
bounding boxes classes list |
required |
Returns:
Name | Type | Description |
---|---|---|
filled_slots |
int
|
total slots that are filled in parking lot |
empty_slots |
int
|
total slots that are available in parking lot |