Unmanned Aerial Vehicle Detection Using Computer Vision

by Bushra Ghazal
0 comment


With the innovation in technology, security is becoming the biggest issue to handle. The exponentially increasing accessibility of drones has been posing a great threat to general security. The use of UAVs is increased in the last few years. Keeping in mind the security issues here a solution is suggested. First, detect UAVs and then track their path.

For object detection, Computer Vision deep learning algorithms are very effective. The input is processed by YOLO which is a neural network used for real-time object detection and tracking.

2.1 Understanding the Concept of UAV

As per the title “UAV detection and tracking using computer vision”, UAV (unmanned aerial vehicle) is an aircraft without a pilot, that can be controlled remotely or onboard computers. 

UAVs can be used for beneficial purposes like agriculture, scientific research, weather forecasting, shipping and delivery, rescue operations, and health care. It can be used for disaster purposes like attacking, missile attacks, target killing, etc.

2.2 What is a Computer Vision?

Computer vision is the field of science that makes computers see, identify and process images in the way human eye vision does and to provide proper output. Computer vision is used in almost every field i.e:

  • Object, face detection
  • Robotic surgery and medical diagnosis
  • Image processing
  • Agriculture
  • Space technology (NASAs Mars Rover includes capabilities to model the terrain of the planet, detect obstacles in its path, and stitch together panoramic images) Applications of computer vision are shown in figure 1.4

    Figure 1.4: Applications of Computer Vision

    Figure 1.4: Applications of Computer Vision

2.3 What is the Image Processing Technique?

The Image Processing technique is used by Computer vision to perform different tasks. The operation performed and methods applied to improve the quality of an image or to get a specific result after being obtained as an image stack is termed as image processing. 

Image processing is considered to be one of the most rapidly evolving areas of information technology today, with growing applications in all areas of business. Applications of image processing are:

Use-cases of Image Processing

Image processing can be used in these fields:

  • Robotics
  • Medical
  • Pattern recognition
  • Video processing
  • Face detection 

    2.4 Software Requirements

  • Anaconda
  • Spyder
  • Python
  • Open-CV library

3. Algorithms for Object Detection

A lot of algorithms are present for object detection. A few of them are as follows:

  • Convolutional Neural Networks (CNN)
  • You Only Look Once (YOLO)
  • Single Shot Detector (SSD)
  • Region Convolutional Neural Networks (R-CNN)

Table 3.1: Algorithms for detection

Algorithm Description Strength Weakness
VOILA    AND JONES  (The Viola-Jones

Algorithm was designed by Paul Viola and Michael Jones in 2001)

The main purpose was face and object detection. It can detect objects in real time.

When we give image algorithms looks at smaller subregions and tries to find objects by looking at special features in each subregion.

Viola and Jones algorithm uses Haar-like features to detect objects

  1. Robust
  2. Very high detection rate.
  3. Use different classifiers each looking at a different portion of the image
  4. Fast
  5. Good in detecting edges and lines
  1. Cannot detect tilted or turned faces.
  2. It is sensitive to lighting conditions
  3. Cannot detect moving objects
CNN (Convo- lutional  Neural Networks) Introduced by Kunihiko     Fukushima in 1980 The biologically inspired hierarchical model that can be trained to perform verity of detection, recognition and segmentation.

It is basically a deep learning algorithm, it take images as an input, it assigns learnable weights and biases to object present in the image and differentiate between one and the other

  1. Determine  features by training (so has higher degree of freedom).
  2. Use single classification which look at full image.
  3. Applies matrix operation.
  4. Accurate.
  1. Large dataset is required
  2. Expensive.
YOLO    (You Only Look Once) It is a real time detection algorithm. It applies neural network algorithm to the image, and it divides the image to S x S grid and make boundary around images and predict possibilities for each of the boundary It uses regression.
  1. Can detect multiple objects in same image.
  2. Real time execution
  3. Super fast
  4. High performance
  5. No background errors
1.   Detects one objects per grid Cell.

2.   Favor high performance over accuracy.

SSD (Single Shot Detector) This  method only takes single shot to detect multiple objects this method is very fast. It is designed for real time implementation. It contains two components backbone and SSD head.
  1. Higher computational time
  2. High accuracy
  3. Exactness trade off is moderate
  1. Perform well for large size objects but dips a bit for small sized objects
  2. End-to-end detection, is too slow.
  3. Computationally expensive.

Here Yolo neural network algorithm will be used. This algorithm is very fast for real-time implementation. It uses a neural network algorithm and divides image into S x S grid and make a boundary around the image to predict possibilities for each boundary. Algorithms for detection are shown in Table 4.4.

3.1 Algorithm for Tracking

After detecting an object, the next focus is on track. If the detected object is a kite or bird there is no need for tracking but if the detected object is a drone then the target is tracked.

A lot of algorithms are used for object tracking. But again YOLO is used for tracking because this algorithm is fast and accurate and it can detect and track until the target moves out of range of the camera.

4. Implementation of Proposed Design

Here is the implementation of the proposed design. In which all the steps required to run the project on software are performed.

4.1 Initial Stage

  1. Image processing needs a good CPU/GPU, choose CPU. Install the anaconda from the website Installation of the Anaconda is shown in figure 4.1
  2. After the installation of Anaconda Navigator, create an environment with the help of the environment dialog box and select the python version.

    Creation of environment



  3. After successfully creating an environment, the next step is to install Spyder as it is easy to use. Then install open CV through the command pip install cv2. 

4.2 Preparing Data Set

  1. Collect many images of different air objects like drones, birds, airplanes, helicopters, kites, and balloons.


Note: Making a data set is more than just collecting images. Giving the names of the images and also telling the position of these specific objects in each image. For that, a software called Labellmg can is used, which converts images into text files. As shown in figure 4.6

  1. Once Txt files of all the objects are made. Put all images and text files into a zip file. Also, name file for the included classes. 

4.3 YOLO Configuration

For configuration, follow these steps: 

  1. Install darknet with YOLO v3. 
  2. To configure the YOLO create a folder in darknet/data including all the images and .txt files of the dataset that is previously made. 
  3. To make a custom config file, make the required modifications in YOLO v3 of cfg, adjusting batch, subdivisions, and max batches with respect to classes and steps. 
  4. When entering the number of classes, change the convolutional layer above YOLO. Also set random to 1. cfg parameters are shown in Table 4.1

Table 4.1: CFG Parameters

Name Description
Batch How many images and labels are used in the forward pass to compute a gradient and update the weights via the backpropagation method.
Subdivisions The batch is subdivided in many ”blocks”. The images of a block are run in parallel.
Steps 500,1000: Adjust the learning rate after 500 and 1000 batches.
Layers (Filters) How many convolutional kernels are there in a layer.
Layers (Random) Put in the YOLO layers. If set to 1, do data augmentation by re-sizing the images to different sizes every few batches, used to generalize over object sizes.
  1. Make a Custom object folder through data/obj.names in which all the names which we want to detect like drones, UAVs, birds, kites, etc are written. 
  2. In obj.data number of classes, train.txt, valid, names, and weights folder are included and saved.
  3. In train.txt all data and names of the images are saved.

4.4 Training YOLO On your Data Set

Training of YOLO for a customized data set is also done through the darknet. Clone and enable darknet as well as enable open CV. By taking the ZIP folder, .cfg file, .names file, obj.data file, and train.txt file created above, then configure the darknet network for the training of YOLO v3, counting the executions.

After Thousands of iterations which may take about 2 hours based on our CPU power a trained data set will be ready to use and integrate with our system, with telling the average loss.

4.5 Testing code on Image and Video Input

After training the YOLO for the customized dataset start testing the code on your trained data set which is called YOLO weights. It has 4 classes in this case.

Try YOLO detection on different. Large weights are good in terms of accuracy but processing is a bit slow because of low frames per second. Make video of UAV, birds and gave this data as input to the code. All the objects will be successfully detected and tracked with the labels given fps and threshold.

Now the code can be tested for real-time scenarios through the real-time input of webcam changing the range of our camera flew our UAV with recording the result you will see the output as required ”Detection And Tracking Of UAV”.

Related Articles

Leave a Comment

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

Privacy & Cookies Policy