Domain Name For Sale

Unlock the Potential of Your Premium Domain for Python in Deep Learning and Machine Learning!

Are you passionate about Python and its incredible applications in the world of deep learning and machine learning? Do you own a domain that...

Wednesday, June 14, 2023

YOLOv8 Object detection of any Custom Datasets Step-by-Step Guide with YOLO CLI

In this tutorial, we will be exploring custom object detection using YOLOv8. This tutorial focuses on a two-class object 

detection scenario. Let's dive into the steps we'll be following:

Downloading Images

We will start by downloading images of our interest from Google using a small script.


Next, we will annotate the downloaded images in YOLO format. This step involves labeling the objects of interest in the images and assigning appropriate labels.

Setting up YOLO V8

We'll set up YOLO V8 on our local machine. This includes creating a virtual environment, installing necessary libraries, and configuring the environment for training and inference.

Training YOLO V8

Now, we will train the YOLO V8 object detection model using the annotated images. This step involves specifying the training parameters, such as the dataset directories, number of classes, and model configuration.

Object Detection

Finally, we will run custom object detection on images, videos, and webcams using the trained YOLO V8 model. This step allows us to detect objects in various scenarios and visualize the results.That's it! The timestamps for each step can be found in the video description. Let's get started by opening the Anaconda prompt or terminal, creating a virtual environment, and proceeding with the rest of the steps outlined above.

Here are the commands used for YOLOv8 in the tutorial:

Creating a Virtual Environment:

conda create -n YOLOV8_custom python=3.9

conda activate YOLOV8_custom

Installing Libraries:

pip install simple_image_download==0.4

pip install labelImg

pip install ultralytics

Downloading Images:




Yolov8 Dataset Annotation
Yolov8 Dataset Annotation 

Setting up YOLO V8:

Installing PyTorch (CPU version):

pip install torch==1.13.1

Installing PyTorch (GPU version):

pip install torch==1.13.1+cu110 -f

Installing PyTorch for YOLOv8
Installing PyTorch for YOLOv8

Training YOLO V8:

python --data data_custom.yaml --cfg yolov8-custom.cfg --weights --batch-size 8 --epochs 100

Object Detection - Image:

python --source image.jpg --weights --conf 0.5

Object Detection - Video:

python --source video.mp4 --weights --conf 0.5

Object Detection - Webcam:

python --source 0 --weights --conf 0.5

Exporting the Model:

python --weights --img-size 640 --batch 1

End Note

Please note that these commands assume that you are running them from the appropriate directories and have the necessary files (weights, configurations, etc.) available as mentioned in the tutorial.

No comments:

Post a Comment