๐ Welcome to the Object Detection using YOLOv3 tutorial! In this guide, we'll walk you through the process of setting up and using YOLOv3 to detect objects in images and perform real-time object detection in videos.
Make sure you have the following dependencies installed:
- OpenCV
- NumPy
- Matplotlib
- Jupyter Lab
You can install them using the following command:
pip install opencv-python numpy matplotlib jupyterlab
You Only Look Once (YOLO) is a state-of-the-art, real-time object detection algorithm. YOLOv3, the latest version, will be applied to detect objects in images. A set of pre-trained weights, based on the Common Objects in Context (COCO) database, is utilized for this tutorial.
We encourage you to test the YOLO algorithm on your images. The provided images are:
- cat.jpg
- city_scene.jpg
- dog.jpg
- dog2.jpg
- eagle.jpg
- food.jpg
- giraffe.jpg
- horses.jpg
- motorbike.jpg
- person.jpg
- surf.jpg
- wine.jpg
These images are located in the ./images/
folder.
Follow these steps to set up the YOLOv3 environment:
-
Clone the repository:
git clone https://github.com/Harish-Srinivas-07/object-detection.git
-
Navigate to the project directory:
cd yolov3-object-detection
-
Download the YOLOv3 weights, configuration, and COCO object classes file:
-
Run the YOLOv3 object detection:
jupyter lab detection.ipynb
-
Important: Download "yolov3.weights" here and place it inside the
weights
folder.
The neural network used by YOLOv3 consists mainly of convolutional layers, with shortcut connections and upsample layers.
YOLO uses Non-Maximal Suppression (NMS) to keep the best bounding box. Set the NMS threshold to 0.6 to remove predicted boxes with low probability.
IOU is used to select the best bounding boxes. Set the IOU threshold to 0.4 to eliminate overlapping boxes.
To perform object detection in videos:
- Load the pre-trained model and classes.
- Initialize video capture (from camera or file).
- Apply YOLOv3 to each frame, filter detections, and apply NMS.
- Display results in the 'Tracking' window.
- Press 'q' to exit the program.
Adjust parameters such as weight_file
, cfg_file
, namesfile
, iou_thresh
, and nms_thresh
as needed.
jupyter lab detection.ipynb -> final phase
To use YOLOv3 in Jupyter Lab:
-
Launch Jupyter Lab:
jupyter lab
-
Open the provided
detection.ipynb
notebook. -
Run the cells in the notebook to perform object detection interactively.
Please download "yolov3.weights" file and place inside weights folder to make program run
Have fun exploring the world of YOLOv3 object detection! ๐ต๏ธโโ๏ธ