This project demonstrates real-time drone detection using YOLOv5 and OpenCV. It detects drones in real-time and displays a warning when a drone is detected inside or near a defined rectangle.
- Real-time drone detection using YOLOv5
- Interactive rectangle creation and adjustment
- Warning message displayed when a drone is detected inside or near the rectangle
-
Enhanced Security Real-time detection of drones for improved security in airports, public events, and restricted areas.
-
Automated Monitoring Reduce manual surveillance by automating the drone detection process using computer vision and machine learning.
-
Customizable and Interactive Define and adjust the detection area using an interactive rectangle for accurate and adaptable detection.
-
Real-time Feedback Instant detection and warning messages provide immediate responses to potential drone threats.
-
Open-source and Extendable You can access the open-source codebase for customization and integration into existing security systems.
-
Scalable and Cost-effective Efficient utilization of resources with a balance of accuracy and performance, resulting in cost savings.
The Drone Detection model was trained on a diverse dataset consisting of 1400 images of different types of drones. The dataset was carefully curated and labeled to ensure accurate annotations. It covers a wide range of drone variations, sizes, orientations, and backgrounds.
The dataset was prepared using the Roboflow platform and exported through its API. This streamlined the dataset preparation process and ensured high-quality data inputs for training the model.
The availability of this diverse and well-annotated dataset enables the Drone Detection model to learn from a wide range of drone images, resulting in improved accuracy and reliability in real-world detection scenarios.
The dataset used in this project can be downloaded from here.
- Python 3.x
- OpenCV
- PyTorch
- YOLOv5
- Numpy
- PIL
-
Clone the repository:
-
Install the required Python libraries:
- pip install opencv-python torch numpy pillow
-
Download the YOLOv5 model:
- Visit the official YOLOv5 repository: https://github.com/ultralytics/yolov5
- Download the desired pre-trained model weights (e.g.,
best.pt
) and place them in the project directory.
-
Run the
Advanced_Drone_Detection.py
script:- python Advanced_Drone_Detection.py
-
The script will open a live video feed from the default camera.
- To create a rectangle, click and drag the mouse on the video feed to define the four corners of the rectangle.
- The rectangle can be adjusted by dragging the corners.
- A warning message will be displayed whenever a drone is detected inside or near the rectangle.
-
Press 'q' to quit the program.
- You can modify the
classes
list in the code to include or exclude specific classes of objects for detection. - Adjust the confidence threshold (
conf
) to control the sensitivity of detection. - Experiment with different YOLOv5 model sizes for performance and accuracy trade-offs.