Poly-Shield-Detector is an image processing tool that combines YOLOv8 and Pyside6. Detect objects in images, define polygons, and filter objects inside polygons. Perfect for interactive annotation and object recognition tasks. Efficient and user-friendly.
- Object detection using YOLOv8 model
- Polygon definition for filtering objects inside polygons
- Interactive annotation for precise object identification
- User-friendly graphical user interface (GUI) using Pyside6
- Efficient and accurate object recognition
Before using Poly-Shield-Detector, make sure you have the following:
- Python 3.7 or higher
- Pyside6
- torch
- ultralytics
- shapely
Before running Poly-Shield-Detector, make sure to perform the following preparation steps:
- Place the YOLOv8 model file in the
models
folder. - Create the
records
folder to store the detected objects and polygon information. - Create the
output
folder to store the processed images.
- Clone the repository:
git clone https://github.com/yihong1120/Poly-Shield-Detector.git
- Navigate to the project directory:
cd Poly-Shield-Detector
- Install the required dependencies:
pip install -r requirements.txt
- Download the pre-trained YOLOv8 model:
mkdir models
cd models
wget https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8x.pt
cd ..
- Run the
app.py
file:
python app.py
The application window will appear, providing the following options:
-
Upload Image: Click this button to select an image for object detection.
-
Predict: Click this button to perform object detection on the selected image.
-
Clear Lists: Click this button to clear the polygons and reset the scene.
-
Polygon Opacity Slider: Adjust this slider to change the opacity of the polygons.
-
Points and Lines Opacity Radio Button: Use these buttons to control the opacity of the points and lines.
-
Right-Click to Delete Polygon: Right-click on a polygon to delete it.
-
Click the Upload Image button.
-
Select an image file (PNG, JPG, or BMP) from the file dialog and click Open.
-
After selecting an image, you can draw polygons on the image by clicking the desired points on the image.
-
To create a closed polygon, click on the starting point again or click on the Close Polygon button that appears.
-
To draw multiple polygons, repeat the process.
-
After drawing polygons or if no polygons are drawn, click the Predict button.
-
The application will perform object detection on the selected image and display the detected objects in the list on the right.
To clear the drawn polygons and reset the scene, click the Clear Lists button.
-
To adjust the opacity of the polygons, use the Polygon Opacity Slider.
-
Slide to the left to make the polygon more transparent, or to the right to make it more opaque.
-
To adjust the opacity of points and lines, use the Points and Lines Opacity Radio Button.
-
Select the desired opacity level by clicking on one of the buttons.
-
To delete a polygon, right-click on the polygon you wish to remove.
-
The polygon will be immediately removed from the image.
The detected objects and their frequencies will be displayed in the list on the right side of the application window. The list will show the class names of the objects and the number of times each class appears in the detection results.
Additionally, the application will save the detection results as a JSON file in the 'records' folder. The JSON file will include the filename, predictions, and the base64 encoded original image.
- The
records
folder stores the detected objects and polygon information. - The
output
folder stores the processed images.
This project is licensed under the AGPL-3.0.