guides/parking-management/ #11093
Replies: 35 comments 66 replies
-
Hi , when i run the first script i get this error: File "C:\Users\explo\miniconda3\Lib\site-packages\ultralytics\solutions\parking_management.py", line 71, in upload_image How can i solve? |
Beta Was this translation helpful? Give feedback.
-
Hello, I use the iOS system, when using the following code to meet the data standards, the image can not be loaded, pngd,jpg,jpeg can not be loaded, help me to answer, thank you
|
Beta Was this translation helpful? Give feedback.
-
Can it support camera from the side or angle instead from top view? |
Beta Was this translation helpful? Give feedback.
-
Hi Paula,
Thanks for your reply, at this moment I'm using a licensed subscription
platform to detect the vehicle presence at the parking bays.
I'd expect YOLOv8 could offer an open source solution which could reduce
the license cost.
Please provide an Example Workflow using YOLOv8 based on the use of a solar
powered camera using ftp function to send parking bay images to a ftp
server.
Do reply to me soon, thank you.
Adi Y Rosl
…On Fri, Jun 7, 2024 at 9:13 PM Paula Derrenger ***@***.***> wrote:
Yes, Ultralytics YOLOv8 can support camera angles from the side or at an
angle, not just from a top view. The model's robust detection capabilities
allow it to effectively identify vehicles in various orientations and
angles, which can be particularly useful in dynamic parking environments.
Adjusting the detection thresholds and fine-tuning the model with
angle-specific training data can further enhance accuracy for side or
angled views. If you have any more questions or need further assistance,
feel free to ask! 🚗👍
—
Reply to this email directly, view it on GitHub
<#11093 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACNHTQXHTL6NTQV7HOZOAWLZGGWXFAVCNFSM6AAAAABHCDMGSGVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4TOMBSGIZTO>
.
You are receiving this because you commented.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
-
Hi,
I've deployed the Yolov8 to test it and I've got the error message when
verifying the installation as follows.
yolo task=detect mode=predict model=yolov8n.pt source='
https://ultralytics.com/images/zidane.jpg'
Traceback (most recent call last):
File "/yolov8env/bin/yolo", line 5, in <module>
from ultralytics.cfg import entrypoint
File "/yolov8env/lib/python3.12/site-packages/ultralytics/__init__.py",
line 10, in <module>
from ultralytics.data.explorer.explorer import Explorer
File
"/yolov8env/lib/python3.12/site-packages/ultralytics/data/__init__.py",
line 3, in <module>
from .base import BaseDataset
File "/yolov8env/lib/python3.12/site-packages/ultralytics/data/base.py",
line 12, in <module>
import cv2
File "/yolov8env/lib/python3.12/site-packages/cv2/__init__.py", line 181,
in <module>
bootstrap()
File "/yolov8env/lib/python3.12/site-packages/cv2/__init__.py", line 153,
in bootstrap
native_module = importlib.import_module("cv2")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/importlib/__init__.py", line 90, in
import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ImportError: libGL.so.1: cannot open shared object file: No such file or
directory
I did try to search and install libGL.so.1 but cannot find it,
Do reply to me soon, thanks.
…On Sat, Jun 8, 2024 at 4:26 AM Glenn Jocher ***@***.***> wrote:
Hi Adi,
Thank you for reaching out! It's great to hear that you're considering
YOLOv8 for your parking management needs. YOLOv8 can indeed provide a
cost-effective, open-source solution for vehicle detection in parking bays.
Below, I'll walk you through an example workflow to set up a parking
management system using a solar-powered camera that sends images to an FTP
server.
Example Workflow for Parking Management with YOLOv8 1. *Setting Up the
FTP Server*
Ensure your solar-powered camera is configured to send images to your FTP
server. You'll need the FTP server details (hostname, username, password,
and the directory where images are stored).
2. *Downloading Images from FTP Server*
Use Python's ftplib library to download images from the FTP server.
import ftplibimport os
ftp = ftplib.FTP('ftp.yourserver.com')ftp.login('username', 'password')ftp.cwd('/path/to/images')
filenames = ftp.nlst() # List of filenames in the directory
for filename in filenames:
local_filename = os.path.join('/local/path/to/save/images', filename)
with open(local_filename, 'wb') as file:
ftp.retrbinary('RETR ' + filename, file.write)
ftp.quit()
3. *Selecting Parking Points*
Use the ParkingPtsSelection tool to define parking areas.
from ultralytics import solutions
solutions.ParkingPtsSelection()
This will allow you to create polygons around parking spaces and save the
configuration as a JSON file.
4. *Parking Management Code*
Here's a complete example of how to set up the parking management system
using YOLOv8:
import cv2from ultralytics import solutions
# Path to the JSON file created with the point selection toolpolygon_json_path = "bounding_boxes.json"
# Initialize video capture from the local directory where images are savedcap = cv2.VideoCapture("/local/path/to/save/images/video.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 to save the outputvideo_writer = cv2.VideoWriter("parking_management.avi", cv2.VideoWriter_fourcc(*"mp4v"), fps, (w, h))
# Initialize parking management objectmanagement = solutions.ParkingManagement(model_path="yolov8n.pt")
while cap.isOpened():
ret, im0 = cap.read()
if not ret:
break
json_data = management.parking_regions_extraction(polygon_json_path)
results = management.model.track(im0, persist=True, show=False)
if results[0].boxes.id is not None:
boxes = results[0].boxes.xyxy.cpu().tolist()
clss = results[0].boxes.cls.cpu().tolist()
management.process_data(json_data, im0, boxes, clss)
management.display_frames(im0)
video_writer.write(im0)
cap.release()video_writer.release()cv2.destroyAllWindows()
Optional Arguments for Customization
You can customize the appearance and behavior of the parking management
system using optional arguments:
management = solutions.ParkingManagement(
model_path="yolov8n.pt",
txt_color=(0, 0, 0),
bg_color=(255, 255, 255),
occupied_region_color=(0, 255, 0),
available_region_color=(0, 0, 255),
margin=10
)
This setup should help you get started with a cost-effective and efficient
parking management system using YOLOv8. If you have any further questions
or need additional assistance, feel free to ask! 🚗👍
—
Reply to this email directly, view it on GitHub
<#11093 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACNHTQWTFLZQL5J2E6MIANDZGIJQXAVCNFSM6AAAAABHCDMGSGVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4TOMBXGE2DO>
.
You are receiving this because you commented.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
-
I got this message.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package libgl1-mesa-glx is not available, but is referred to by another
package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'libgl1-mesa-glx' has no installation candidate
I'm using Ubuntu 24.04 LTS
…On Sat, Jun 8, 2024 at 7:43 PM Glenn Jocher ***@***.***> wrote:
Hi there,
Thank you for reaching out! It looks like you're encountering an issue
with the libGL.so.1 library, which is a common dependency for OpenCV.
This error typically occurs when the required OpenGL libraries are not
installed on your system.
To resolve this issue, you can install the missing library using the
following command, depending on your operating system:
For Ubuntu/Debian:
sudo apt-get update
sudo apt-get install -y libgl1-mesa-glx
For CentOS/RHEL:
sudo yum install -y mesa-libGL
For macOS, you can use Homebrew:
brew install libgl
After installing the necessary library, try running your YOLOv8 command
again:
yolo task=detect mode=predict model=yolov8n.pt source='https://ultralytics.com/images/zidane.jpg'
This should resolve the libGL.so.1 error and allow you to proceed with
your YOLOv8 deployment. If you encounter any further issues or have
additional questions, feel free to ask! 😊
—
Reply to this email directly, view it on GitHub
<#11093 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACNHTQRJAVVLN6DWS47LWW3ZGLU7NAVCNFSM6AAAAABHCDMGSGVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4TOMJSHE2TS>
.
You are receiving this because you commented.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
-
Hi,
I've resolved the issue and tested the command.
Please provide a detailed guide on how to use the ParkingPtsSelection tool
to define parking areas.
This will allow me to create polygons around parking spaces and save the
configuration as a JSON file.
Thanks.
…On Sun, Jun 9, 2024 at 3:18 AM Paula Derrenger ***@***.***> wrote:
Hi there,
Thank you for your detailed report! It seems like you're encountering an
issue with the libgl1-mesa-glx package on Ubuntu 24.04 LTS. This package
is essential for OpenCV to function correctly, and its absence can cause
the errors you're seeing.
To resolve this, you can try installing the libgl1 package, which should
provide the necessary OpenGL libraries. Please run the following commands
in your terminal:
sudo apt-get update
sudo apt-get install -y libgl1
If the issue persists, it might be due to changes or updates in the
package repositories for Ubuntu 24.04 LTS. In such cases, you can also try
installing the libgl1-mesa-glx package from an older Ubuntu release or
using a different package source.
Additionally, please ensure that you are using the latest versions of
torch and ultralytics. You can update them using:
pip install --upgrade torch ultralytics
Once you've installed the necessary libraries and updated your packages,
try running your YOLOv8 command again:
yolo task=detect mode=predict model=yolov8n.pt source='https://ultralytics.com/images/zidane.jpg'
If you continue to experience issues, please provide a minimum
reproducible code example so we can investigate further. You can find more
information on creating a reproducible example here: Minimum Reproducible
Example <https://docs.ultralytics.com/help/minimum_reproducible_example>.
Feel free to reach out if you have any more questions or need further
assistance! 😊
—
Reply to this email directly, view it on GitHub
<#11093 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACNHTQVJMDCAHS5HMBTC5ELZGNKJBAVCNFSM6AAAAABHCDMGSGVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4TOMJVHEYTI>
.
You are receiving this because you commented.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
-
1. I cannot launch the graphical interface using script -> python
select_park.py
The file contain the following code.
from ultralytics import solutionssolutions.ParkingPtsSelection()
2. The error message as follows.
requirements: Ultralytics requirement ['tkinter'] not found,
attempting AutoUpdate...
ERROR: Could not find a version that satisfies the requirement tkinter
(from versions: none)
ERROR: No matching distribution found for tkinter
Retry 1/2 failed: Command 'pip install --no-cache-dir "tkinter" '
returned non-zero exit status 1.
ERROR: Could not find a version that satisfies the requirement tkinter
(from versions: none)
ERROR: No matching distribution found for tkinter
Retry 2/2 failed: Command 'pip install --no-cache-dir "tkinter" '
returned non-zero exit status 1.
requirements: ❌ Command 'pip install --no-cache-dir "tkinter" '
returned non-zero exit status 1.
Traceback (most recent call last):
File "/home/kpark/select_park.py", line 3, in <module>
solutions.ParkingPtsSelection()
File "/yolov8env/lib/python3.12/site-packages/ultralytics/solutions/parking_management.py",
line 22, in __init__
self.master = tk.Tk()
^^^^^^^
File "/usr/lib/python3.12/tkinter/__init__.py", line 2345, in __init__
self.tk = _tkinter.create(screenName, baseName, className,
interactive, wantobjects, useTk, sync, use)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_tkinter.TclError: no display name and no $DISPLAY environment variable
Please assist on this, thanks.
…On Sun, Jun 9, 2024 at 8:15 PM Paula Derrenger ***@***.***> wrote:
@adiyazid <https://github.com/adiyazid> hi there,
Thank you for reaching out and for resolving the initial issue! I'm glad
to hear that you're ready to dive into using the ParkingPtsSelection tool.
Let's walk through the process of defining parking areas and saving the
configuration as a JSON file.
Step-by-Step Guide to Using ParkingPtsSelection
1.
*Capture a Frame:*
- First, capture a frame from the video or camera stream where you
want to manage the parking lot. This frame will serve as the basis for
defining parking regions.
2.
*Launch the ParkingPtsSelection Tool:*
- Use the following code snippet to launch the graphical interface for
selecting parking points:
from ultralytics import solutions
solutions.ParkingPtsSelection()
- This will open a window where you can select an image and start
outlining parking regions by clicking to create polygons.
3.
*Define Parking Areas:*
- Click around the parking spaces to create polygons that define each
parking area. You can adjust the points as needed to accurately outline the
spaces.
4.
*Save the Configuration:*
- Once you have defined all the parking areas, click the save button.
This will store the configuration as a JSON file in your working directory.
Example Code for Parking Management
Here’s a complete example of how to use the saved JSON file for parking
management with YOLOv8:
import cv2from ultralytics import solutions
# Path to the JSON file created with the ParkingPtsSelection toolpolygon_json_path = "bounding_boxes.json"
# Video capturecap = 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 writervideo_writer = cv2.VideoWriter("parking_management.avi", cv2.VideoWriter_fourcc(*"mp4v"), fps, (w, h))
# Initialize parking management objectmanagement = solutions.ParkingManagement(model_path="yolov8n.pt")
while cap.isOpened():
ret, im0 = cap.read()
if not ret:
break
json_data = management.parking_regions_extraction(polygon_json_path)
results = management.model.track(im0, persist=True, show=False)
if results[0].boxes.id is not None:
boxes = results[0].boxes.xyxy.cpu().tolist()
clss = results[0].boxes.cls.cpu().tolist()
management.process_data(json_data, im0, boxes, clss)
management.display_frames(im0)
video_writer.write(im0)
cap.release()video_writer.release()cv2.destroyAllWindows()
Optional Arguments for ParkingManagement
You can customize the appearance and behavior of the parking management
system using the following optional arguments:
Name Type Default Description
model_path str None Path to the YOLOv8 model.
txt_color tuple (0, 0, 0) RGB color tuple for text.
bg_color tuple (255, 255, 255) RGB color tuple for background.
occupied_region_color tuple (0, 255, 0) RGB color tuple for occupied
regions.
available_region_color tuple (0, 0, 255) RGB color tuple for available
regions.
margin int 10 Margin for text display.
For more detailed information, you can refer to the Parking Management
Guide <https://docs.ultralytics.com/guides/parking-management/>.
Feel free to reach out if you have any more questions or need further
assistance! 😊
—
Reply to this email directly, view it on GitHub
<#11093 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACNHTQW5CJFRX7PVO2NZCN3ZGRBOTAVCNFSM6AAAAABHCDMGSGVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4TOMJYHA3DQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
-
Hi,
1. I’m still having problem to launch it.
Can I open it locally using Macbook Air M3?
2. My datasets are static parking bay images captured from camera via ftp
every 1 minute stored in ftp server. Can I still use the same code for
parking management?
…On Mon, 10 Jun 2024 at 3:31 AM, Paula Derrenger ***@***.***> wrote:
Hi @adiyazid <https://github.com/adiyazid>,
Thank you for reaching out and providing the detailed error message. It
looks like you're encountering issues with launching the graphical
interface due to missing tkinter and display environment variables.
Steps to Resolve the Issue:
1.
*Install tkinter:*
tkinter is a standard GUI library for Python, but it might not be
installed by default in some environments. You can install it using the
following command:
sudo apt-get install python3-tk
If you're using a different operating system, please refer to the
appropriate package manager for installation.
2.
*Set Display Environment Variable:*
The error no display name and no $DISPLAY environment variable
indicates that the script is trying to open a GUI window but can't find a
display. This is common in headless environments like remote servers. If
you're running this on a local machine with a GUI, ensure that your display
environment variable is set correctly:
export DISPLAY=:0
If you're on a remote server, you might need to use X11 forwarding or
a virtual display like Xvfb.
3.
*Verify Package Versions:*
Ensure that you're using the latest versions of torch and ultralytics.
You can update them using:
pip install --upgrade torch ultralytics
Example Code for Parking Management:
Here's a complete example of how to use the saved JSON file for parking
management with YOLOv8:
import cv2from ultralytics import solutions
# Path to json file, that created with above point selection apppolygon_json_path = "bounding_boxes.json"
# Video capturecap = 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 writervideo_writer = cv2.VideoWriter("parking_management.avi", cv2.VideoWriter_fourcc(*"mp4v"), fps, (w, h))
# Initialize parking management objectmanagement = solutions.ParkingManagement(model_path="yolov8n.pt")
while cap.isOpened():
ret, im0 = cap.read()
if not ret:
break
json_data = management.parking_regions_extraction(polygon_json_path)
results = management.model.track(im0, persist=True, show=False)
if results[0].boxes.id is not None:
boxes = results[0].boxes.xyxy.cpu().tolist()
clss = results[0].boxes.cls.cpu().tolist()
management.process_data(json_data, im0, boxes, clss)
management.display_frames(im0)
video_writer.write(im0)
cap.release()video_writer.release()cv2.destroyAllWindows()
For more detailed information, you can refer to the Parking Management
Guide <https://docs.ultralytics.com/guides/parking-management/>.
If you continue to experience issues, please provide a minimum
reproducible example of your code and ensure you are using the latest
versions of the required packages. This will help us investigate and
resolve the issue more effectively.
Feel free to reach out if you have any more questions or need further
assistance! 😊
—
Reply to this email directly, view it on GitHub
<#11093 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACNHTQT3WQSK3BW4T2FU4STZGSUQRAVCNFSM6AAAAABHCDMGSGVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4TOMRQG43DI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
-
1. I've managed to launch it with Windows10 and create the JSON file.
2. I notice that there is a code expecting a video stream -> cap = cv2.
VideoCapture("Path/to/video/file.mp4").
I don't have any video stream, I have datasets of static images from ftp
server capturing images every 1 minute from the camera.
How do I handle this?
…On Mon, Jun 10, 2024 at 8:51 PM Muhammad Rizwan Munawar < ***@***.***> wrote:
@adiyazid <https://github.com/adiyazid> Thanks for your inquiry! While I
can't confirm if the GUI will function on a MacBook, I can assure you it
works on both Linux and Windows environments. You can use this code for
parking management, provided that your camera is stationary.
Thanks,
The Ultralytics Team
—
Reply to this email directly, view it on GitHub
<#11093 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACNHTQWR7LIAFRQDCZUG4PDZGWOOHAVCNFSM6AAAAABHCDMGSGVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4TOMRXGA3TC>
.
You are receiving this because you were mentioned.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
-
Hi,
How about fisheye camera? Will there be any issue to train the dataset?
…On Tue, 11 Jun 2024 at 4:22 AM, Paula Derrenger ***@***.***> wrote:
Hi @adiyazid <https://github.com/adiyazid>,
Thank you for your detailed question! It's great to hear that you've
successfully created the JSON file on Windows 10. Let's address your
concern about handling static images instead of a video stream.
You can modify the provided code to work with a dataset of static images
by iterating through your image files instead of reading frames from a
video stream. Here's an example of how you can adapt the code to process
images from a directory:
import cv2import osfrom ultralytics import solutions
# Path to the JSON file created with the point selection apppolygon_json_path = "bounding_boxes.json"
# Directory containing your static imagesimage_dir = "path/to/your/image/directory"
# Initialize the parking management objectmanagement = solutions.ParkingManagement(model_path="yolov8n.pt")
# Get a list of all image files in the directoryimage_files = [os.path.join(image_dir, f) for f in os.listdir(image_dir) if f.endswith(('.png', '.jpg', '.jpeg'))]
# Loop through each image filefor image_file in image_files:
# Read the image
im0 = cv2.imread(image_file)
if im0 is None:
print(f"Error reading image {image_file}")
continue
# Extract parking regions from the JSON data
json_data = management.parking_regions_extraction(polygon_json_path)
# Perform tracking on the image
results = management.model.track(im0, persist=True, show=False)
if results[0].boxes.id is not None:
boxes = results[0].boxes.xyxy.cpu().tolist()
clss = results[0].boxes.cls.cpu().tolist()
management.process_data(json_data, im0, boxes, clss)
# Display the processed image
management.display_frames(im0)
cv2.imshow("Parking Management", im0)
cv2.waitKey(1) # Display each image for 1 ms
cv2.destroyAllWindows()
In this code:
1. We read images from a specified directory.
2. For each image, we perform the same processing as we would for a
video frame.
3. The results are displayed using OpenCV's imshow.
This approach should allow you to handle static images captured at regular
intervals. If you have any further questions or run into issues, feel free
to ask!
—
Reply to this email directly, view it on GitHub
<#11093 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACNHTQXFT7CST22E4TQSNIDZGYDHPAVCNFSM6AAAAABHCDMGSGVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4TOMZRGQ2DK>
.
You are receiving this because you were mentioned.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
-
When tried to execute {from ultralytics import solutions [ Please can you help anything needed to install tkinter? Thanks for your attention! |
Beta Was this translation helpful? Give feedback.
-
Hi,
I've decided to use Windows to run ParkingPtsSelection and it works fine.
Do you provide development service if I need to? What's your rate?
Do let me know, thanks.
…On Fri, Jun 14, 2024 at 6:16 AM Glenn Jocher ***@***.***> wrote:
@prasadjaywant <https://github.com/prasadjaywant> hello!
Thank you for reaching out and providing detailed information about your
setup and the issue you're encountering. It appears that the tkinter
library is not being recognized by your Python environment, which is
necessary for the ParkingPtsSelection tool to function.
Steps to Resolve the Issue:
1.
*Verify tkinter Installation:*
Since tkinter is included with standard Python installations, it
should be available. However, it might not be installed by default in some
environments. You can try installing it manually:
sudo apt-get install python3-tk
For Windows, tkinter should be included with the Python installer.
Ensure that your Python installation is complete and includes all optional
components.
2.
*Check Python Path:*
Ensure that your Python environment is correctly set up and that the
tkinter library is in the correct path. You can verify this by running:
import tkinterprint(tkinter.__file__)
This should print the path to the tkinter module. If it doesn't, there
might be an issue with your Python installation.
3.
*Alternative Annotation Tools:*
If you continue to face issues with tkinter, you can use external
tools like Roboflow to create polygonal annotations. Once you have created
the annotations, save them as bounding_boxes.json and proceed with the
parking management workflow.
Example Workflow Without ParkingPtsSelection:
1.
*Create Annotations Externally:*
Use an external tool to create polygonal annotations and save them as
bounding_boxes.json.
2.
*Run Parking Management:*
Use the following code to execute the parking management system:
import cv2from ultralytics import solutions
# Path to json file created with an external toolpolygon_json_path = "bounding_boxes.json"
# Video capturecap = 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 writervideo_writer = cv2.VideoWriter("parking_management.avi", cv2.VideoWriter_fourcc(*"mp4v"), fps, (w, h))
# Initialize parking management objectmanagement = solutions.ParkingManagement(model_path="yolov8n.pt")
while cap.isOpened():
ret, im0 = cap.read()
if not ret:
break
json_data = management.parking_regions_extraction(polygon_json_path)
results = management.model.track(im0, persist=True, show=False)
if results[0].boxes.id is not None:
boxes = results[0].boxes.xyxy.cpu().tolist()
clss = results[0].boxes.cls.cpu().tolist()
management.process_data(json_data, im0, boxes, clss)
management.display_frames(im0)
video_writer.write(im0)
cap.release()video_writer.release()cv2.destroyAllWindows()
For more detailed guidance, please refer to our Parking Management Guide
<https://docs.ultralytics.com/guides/parking-management/>.
If you continue to experience issues, please ensure you are using the
latest versions of torch and ultralytics. You can update them using:
pip install --upgrade torch ultralytics
Feel free to reach out if you have any further questions or need
additional assistance. We're here to help! 😊
—
Reply to this email directly, view it on GitHub
<#11093 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACNHTQTDFFBMSE6KJ3VQ4C3ZHIK23AVCNFSM6AAAAABHCDMGSGVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4TONRYGE4DM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
-
Thank you Glenn for your prompt revert. Will work out the given steps and
come back soon.....
…On Wed, 19 Jun 2024, 5:35 am Glenn Jocher, ***@***.***> wrote:
Hello @prasadjaywant <https://github.com/prasadjaywant>,
Thank you for reaching out and providing detailed information about your
use case and the issues you're encountering. Let's address your concerns
step-by-step.
1. Expected Results for Vehicle and Person Detection
To ensure that vehicles and people are correctly identified, please verify
that you are using the latest versions of torch and ultralytics. You can
update them using:
pip install --upgrade torch ultralytics
2. Incorrect Class Labels
To filter out irrelevant classes and focus on specific ones like 'Car',
'Van', 'Truck', 'Person', etc., you can use the classes parameter in the
track method. Here’s an example:
results = management.model.track(im0, persist=True, show=False, classes=[0, 1, 2, 3, 15, 16, 17])
Replace the class indices with the ones relevant to your use case.
3. Customizing the Model for Specific Classes
If you want to train the model to recognize only specific classes, you can
fine-tune the model on a custom dataset that includes only those classes.
This will help in reducing the number of epochs and improving efficiency.
You can create a custom dataset and train the model as follows:
from ultralytics import YOLO
# Load a modelmodel = YOLO('yolov8n-seg.pt') # Load a pretrained model
# Train the model on your custom datasetmodel.train(data='path/to/custom_dataset.yaml', epochs=50, imgsz=640)
Ensure your custom dataset YAML file is properly configured with the
relevant classes.
4. Handling Incorrect Identifications
To handle incorrect identifications, you can adjust the confidence
threshold and IoU threshold parameters. Increasing the confidence threshold
can help reduce false positives:
results = management.model.track(im0, persist=True, show=False, conf=0.5, iou=0.6)
Example Code
Here’s a revised version of your code snippet incorporating the above
suggestions:
import cv2from ultralytics import solutions
# Path to json file created with an external toolpolygon_json_path = "bounding_boxes.json"
# Video capturecap = 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 writervideo_writer = cv2.VideoWriter("parking_management.avi", cv2.VideoWriter_fourcc(*"mp4v"), fps, (w, h))
# Initialize parking management objectmanagement = solutions.ParkingManagement(model_path="yolov8n-seg.pt")
while cap.isOpened():
ret, im0 = cap.read()
if not ret:
break
json_data = management.parking_regions_extraction(polygon_json_path)
results = management.model.track(im0, persist=True, show=False, classes=[0, 1, 2, 3, 15, 16, 17], conf=0.5, iou=0.6)
if results[0].boxes.id is not None:
boxes = results[0].boxes.xyxy.cpu().tolist()
clss = results[0].boxes.cls.cpu().tolist()
management.process_data(json_data, im0, boxes, clss)
management.display_frames(im0)
video_writer.write(im0)
cap.release()video_writer.release()cv2.destroyAllWindows()
For more detailed guidance, please refer to our Parking Management Guide
<https://docs.ultralytics.com/guides/parking-management/>.
Feel free to reach out if you have any further questions or need
additional assistance. We're here to help! 😊
—
Reply to this email directly, view it on GitHub
<#11093 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQL2CZCHSTGNNGIEHQJE7SLZIDDLTAVCNFSM6AAAAABHCDMGSGVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4TQMJRGU2DA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
-
I'm Using Python IDLE, The Python Program is working but The recognition is not idle and the values of occupancy and available is not changing accordingly. And the the cars are recognized as cell phones. |
Beta Was this translation helpful? Give feedback.
-
Here's the links to the files.
https://drive.google.com/file/d/12iwJxsyk6npqHeZjl4K4qGqBrq32KQrU/view?usp=sharing
,
https://drive.google.com/file/d/1S2W0g7JuH-yks9QX0RFXft8_iPs60FgD/view?usp=sharing
,
https://drive.google.com/file/d/1ZuLKX1ZvMNTkNAFSOWo3asPoLa23f6TM/view?usp=sharing
…On Fri, Jul 19, 2024 at 10:38 AM Adi Rosli ***@***.***> wrote:
Here's the availability images.
On Fri, Jul 19, 2024 at 10:33 AM Adi Rosli ***@***.***> wrote:
> Hi Paula,
>
> I've managed to use the platform for detection parking, at this moment I
> need to improve the accuracy
>
> Yolov8 does detect the vehicle but the results for parking availability
> is only based on cars, please find attached image.
>
> How do I change the code so that it improves the detection and detects an
> occupied bay regardless of vehicle.
>
> Please reply to me, soon, thank you.
>
> On Tue, Jun 11, 2024 at 4:22 AM Paula Derrenger ***@***.***>
> wrote:
>
>> Hi @adiyazid <https://github.com/adiyazid>,
>>
>> Thank you for your detailed question! It's great to hear that you've
>> successfully created the JSON file on Windows 10. Let's address your
>> concern about handling static images instead of a video stream.
>>
>> You can modify the provided code to work with a dataset of static images
>> by iterating through your image files instead of reading frames from a
>> video stream. Here's an example of how you can adapt the code to process
>> images from a directory:
>>
>> import cv2import osfrom ultralytics import solutions
>> # Path to the JSON file created with the point selection apppolygon_json_path = "bounding_boxes.json"
>> # Directory containing your static imagesimage_dir = "path/to/your/image/directory"
>> # Initialize the parking management objectmanagement = solutions.ParkingManagement(model_path="yolov8n.pt")
>> # Get a list of all image files in the directoryimage_files = [os.path.join(image_dir, f) for f in os.listdir(image_dir) if f.endswith(('.png', '.jpg', '.jpeg'))]
>> # Loop through each image filefor image_file in image_files:
>> # Read the image
>> im0 = cv2.imread(image_file)
>> if im0 is None:
>> print(f"Error reading image {image_file}")
>> continue
>>
>> # Extract parking regions from the JSON data
>> json_data = management.parking_regions_extraction(polygon_json_path)
>>
>> # Perform tracking on the image
>> results = management.model.track(im0, persist=True, show=False)
>>
>> if results[0].boxes.id is not None:
>> boxes = results[0].boxes.xyxy.cpu().tolist()
>> clss = results[0].boxes.cls.cpu().tolist()
>> management.process_data(json_data, im0, boxes, clss)
>>
>> # Display the processed image
>> management.display_frames(im0)
>> cv2.imshow("Parking Management", im0)
>> cv2.waitKey(1) # Display each image for 1 ms
>> cv2.destroyAllWindows()
>>
>> In this code:
>>
>> 1. We read images from a specified directory.
>> 2. For each image, we perform the same processing as we would for a
>> video frame.
>> 3. The results are displayed using OpenCV's imshow.
>>
>> This approach should allow you to handle static images captured at
>> regular intervals. If you have any further questions or run into issues,
>> feel free to ask!
>>
>> —
>> Reply to this email directly, view it on GitHub
>> <#11093 (reply in thread)>,
>> or unsubscribe
>> <https://github.com/notifications/unsubscribe-auth/ACNHTQXFT7CST22E4TQSNIDZGYDHPAVCNFSM6AAAAABHCDMGSGVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4TOMZRGQ2DK>
>> .
>> You are receiving this because you were mentioned.Message ID:
>> ***@***.***
>> com>
>>
>
|
Beta Was this translation helpful? Give feedback.
-
hello team im facing this issue: PS C:\Users\AJERE\Desktop\packing_management> & C:/Users/AJERE/AppData/Local/Programs/Python/Python310/python.exe c:/Users/AJERE/Desktop/packing_management/parking.py [notice] A new release of pip is available: 24.0 -> 24.2 requirements: AutoUpdate success ✅ 44.3s, installed 1 package: ['shapely>=2.0.0'] Traceback (most recent call last): [notice] A new release of pip is available: 24.0 -> 24.2 Traceback (most recent call last): |
Beta Was this translation helpful? Give feedback.
-
from yesterday I received this type of yolo model results befor when I working on any yolo model the result was good but now I received this type how I resolve this there is any issue in envoirment or any library installation |
Beta Was this translation helpful? Give feedback.
-
Using the ParkingPtsSelection method, and trying to click the Upload image button, this exception is traced and the executable crash. The platform is macOS. The problem seems to be involved with some Apple library.
|
Beta Was this translation helpful? Give feedback.
-
Hello, i found it very helpful in order to to understand a lot of things about yolov8 and Ultralytics. I want to use it in my dissertation , as a part of a small parking system project. How can i return the results in my command line? Is there any other way apart from changing the code and specifically the function process_data in class ParkingManagement in order to return both filled_slots, empty_slots. Thanks in advanced. |
Beta Was this translation helpful? Give feedback.
-
Hi, when i run from ultralytics import solutions
solutions.ParkingPtsSelection() get the error but interface running i'm sure that my environment have tkinter. So I disable check_requirements on line no 16 of anaconda3/envs/ultralytics-env/lib/python3.8/site-packages/ultralytics/solutions/parking_management.py Next issue, when try to upload image file, the file on disk not listed on open dialog. I change line no 62 of anaconda3/envs/ultralytics-env/lib/python3.8/site-packages/ultralytics/solutions/parking_management.py from this self.image_path = filedialog.askopenfilename(filetypes=[("Image Files","*.jpeg";"*.jpg";"*.bmp")]) to this self.image_path = filedialog.askopenfilename(filetypes=[('Image Files',('*.jpeg','*.jpg','*.bmp'))]) and result is OK, file list showing on openfile dialog an I can start to draw the the boundingbox. maybe any wrong in my environment? here is result of my yolo check! Ultralytics 8.3.3 🚀 Python-3.8.19 torch-2.4.1 CUDA:0 (Quadro P2000, 5043MiB) OS Linux-6.8.0-45-generic-x86_64-with-glibc2.17 numpy ✅ 1.24.3<2.0.0,>=1.23.0 |
Beta Was this translation helpful? Give feedback.
-
I wanna ask if can i use segmentation instead of detection in implementing parking management solution? The thesis we are proposing is detection of motorcycle improper parking in parking areas. basically, improper parking gets detected when the motorcycle overlaps with the bounding box of the parking slot. |
Beta Was this translation helpful? Give feedback.
-
You want to use for motorcycle parking ?
…On Tue, Oct 29, 2024, 19:03 expen6ve ***@***.***> wrote:
I wanna ask if can i use segmentation instead of detection in implementing
parking management solution? The thesis we are proposing is detection of
motorcycle improper parking in parking areas. basically, improper parking
gets detected when the motorcycle overlaps with the bounding box of the
parking slot.
—
Reply to this email directly, view it on GitHub
<#11093 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A6MTUN3RYRQNMKV2QCULBATZ56IURAVCNFSM6AAAAABHCDMGSGVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTCMBYG43TSNY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
-
Yes sure I will share with you tomorrow
…On Wed, Oct 30, 2024, 17:03 expen6ve ***@***.***> wrote:
Do you have any tips on how do i approach on that solution?
—
Reply to this email directly, view it on GitHub
<#11093 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A6MTUN4GHN53ABLLYFF3NULZ6DDH7AVCNFSM6AAAAABHCDMGSGVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTCMBZHE2TCNI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
-
+923125094307
Text me on what's app or on LinkedIn where you want
…On Wed, Oct 30, 2024, 21:17 expen6ve ***@***.***> wrote:
Where can i possibly contact you in private?
—
Reply to this email directly, view it on GitHub
<#11093 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A6MTUN2KXHOCXO6RKPQTHG3Z6EBCXAVCNFSM6AAAAABHCDMGSGVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTCMJQGI2DIMA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
-
Okay brother I got it I will participate here
…On Thu, Oct 31, 2024, 02:49 Glenn Jocher ***@***.***> wrote:
@SHAHFAISAL80 <https://github.com/SHAHFAISAL80> for any inquiries or
support, please continue the discussion here on GitHub. We do not provide
private support via WhatsApp or LinkedIn. Thank you for understanding.
—
Reply to this email directly, view it on GitHub
<#11093 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A6MTUNYK7UIQIP3NOUNBZVDZ6FH45AVCNFSM6AAAAABHCDMGSGVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTCMJQGU2DAMI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
-
yeah don't worry i also believe everybody participate here inside of
personally
…On Wed, Oct 30, 2024 at 9:48 PM Glenn Jocher ***@***.***> wrote:
Thank you for your interest in participating here. For any further
inquiries or support, please continue the discussion on GitHub. We do not
provide private support.
—
Reply to this email directly, view it on GitHub
<#11093 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A6MTUN4DBZSNVXCBFT4LAWLZ6GZBRAVCNFSM6AAAAABHCDMGSGVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTCMJQG4ZTQNY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
-
Thank you for your response.
…On Thu, Oct 31, 2024 at 4:59 PM Glenn Jocher ***@***.***> wrote:
@SHAHFAISAL80 <https://github.com/SHAHFAISAL80> thank you for your
engagement. For any further questions or discussions, please continue here
on GitHub. We do not offer private support.
—
Reply to this email directly, view it on GitHub
<#11093 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A6MTUNY5OHY3OFFOQHJMDHTZ6ILS3AVCNFSM6AAAAABHCDMGSGVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTCMJRGA3TENQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
-
Hi! what would be needed for a live feed of the parking management system? I have a thesis and this would be perfect but Im having trouble implementing my live webcam feed for a demo parking environment, any help would be great. Thanks! |
Beta Was this translation helpful? Give feedback.
-
would a hikvision 4mp poe bullet type camera suffice to run this on a 3500x cpu, 1660gpu and 16gb ram? |
Beta Was this translation helpful? Give feedback.
-
guides/parking-management/
Parking Management System Using Ultralytics YOLO11, Ultralytics YOLOv8, YOLOv9, YOLOv10
https://docs.ultralytics.com/guides/parking-management/
Beta Was this translation helpful? Give feedback.
All reactions