Code Monkey home page Code Monkey logo

yolo_drone_detection's Introduction

Task-1 --> Drone Object Detection


  • Let's understand how we collected the dataset and trained the CNN->(Convulation Neural Network) model on that dataset and predict the drones or small drones present in the images and videos.
  • We can also use the saved model after the training to predict the drones in any any type of input either live video streams from cameras, or recorded videos.

Step 1: Data Collection and Preprocessing


  • Collect a dataset containing images or video frames with small drones as the target objects. Annotating these datasets with bounding boxes indicating the location of drones. Then preprocessing the dataset by resizing images to a fixed size, normalizing pixel values, and augmenting data to increase dataset diversity (e.g., rotation, flipping, scaling).

  • So the dataset that I collected was from the Roboflow open source dataset uploaded by some user which contains around 13800 images of Training and 3000 images Validation with the information of there respective boundary boxes.

  • I also collected a separate test data which contains around 163 images to see the performance of the fine tuned model.


Step 2: Network Architecture

  • Now Design a CNN architecture suitable for small object detection and tracking. We can base our design on popular architectures like YOLO (You Only Look Once), SSD (Single Shot MultiBox Detector), or Faster R-CNN (Region-based Convolutional Neural Networks).

  • After that we have to ensure that the architecture is lightweight and optimized for real-time performance on devices like drones. This may involve reducing the number of layers, using smaller filter sizes, or employing depthwise separable convolutions.

  • I used YOLO model which is based on CNN and the version that I used is v8.0.196.

  • This is the YOLOV8 architecture, you can see that this is an Anchor free moedel which means it directly predicts the centre of the image instead of the offsets called anchor box.

image


And the model that I was traing consist of 295 layers and around 25856899 parameters , and working at 79.1 GFLOPS.


image

  • I trained the model for 10 epochs(you can train for more number of epochs like 50 or 100 with a larger Batch size, I used a image batch of 512 images, we can also use 800 or more if you have the larger and powerful GPUs.
  • Optimization is Adamw optimizer and learning rate = 0.002.
  • After the fine tuning of the model the model is saved(best.pt) and we can use that to predict on images and video streams.

Step 3: Evaluation

  • Evaluate the trained model on a separate test set to assess its performance in terms of detection accuracy, tracking stability, and real-time inference speed.
  • Then I computed metrics like precision, recall, F1-score, and Confusion matric to see the how the model predicted on the validation and test images.
  • Then I analyze the results and iteratively refine the model architecture and training process based on the observed performance.
  • access the loss function in the working/runs/detect/train/result.png --> see it is for 10 epochs only and the we can increase the epochs to reduce the errors.
  • access the confusion matrix in working/runs/detect/train/confusion_matrix.png

Step 4: Prediction on Video data

  • After that I uploaded 2 video from the youtube to see how the model performs.
  • You can access the output from the model it is save in the dir working/runs/detect/predict4/ and working/runs/detect/predict2/

How it is predicting in the videos basically it is converting the videos into frames and for each frame it is finding Drones in them Based on the Model training it performs really well.

Thank you for this learning opportunity !!

yolo_drone_detection's People

Contributors

someet-git avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.