Skip to content

MaramWael02/Shape-Detection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shape-Detection

Introduction

This report provides an overview and analysis of a Python script that utilizes the Ultralytics library to work with a YOLOv8 object detection model. The script performs two primary tasks: training the YOLOv8 model on a custom dataset and conducting inference on a sample image. The script's functionality, including model loading, training, and inference, is examined in detail.

Script Overview

The Python script leverages the Ultralytics library to work with a YOLOv8 model. YOLO (You Only Look Once) is a popular object detection algorithm known for its speed and accuracy.

Dataset classes

names: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'circle', 'cross', 'g', 'hexagon', 'pentagon', 'plus', 'rectangle', 'star', 'trapezium', 'triangle'] labels_correlogram labels

Model Loading

The script starts by loading a pre-trained YOLOv8 model using the following code:

Screenshot 2023-09-20 201925

The 'yolov8n.pt' file contains pre-trained weights for the YOLOv8 model. This pre-trained model serves as the starting point for further training or inference.

Model Training

The next part of the script is dedicated to training the YOLOv8 model on a custom dataset. The training process is initiated with the following code:

Here is a link to the dataset used in this code : https://universe.roboflow.com/vidhi6khosla-gmail-com/suas-final

Screenshot 2023-09-20 202218

Testing Results

val_batch2_pred val_batch2_labels val_batch1_pred val_batch1_labels val_batch0_pred val_batch0_labels

Model Evaluation

results R_curve PR_curve P_curve F1_curve confusion_matrix_normalized confusion_matrix

Inference Code

Following model training, the script proceeds to perform inference on a sample image using the trained YOLOv8 model. The inference code is as follows:

Screenshot 2023-09-20 202335

The inference code performs the following actions:

  • image_path = 'shape.jpg': Specifies the path to the input image ('shape.jpg') on which object detection will be performed.
  • model.predict(...): Initiates the inference process, where the model processes the input image and detects objects. The detected objects are annotated with bounding boxes, and the annotated image can be saved and displayed.
  • The resulting image after feeding the input image 'shape.jpg' into the model

shape

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages