UAV Detection on BrainyPi Using Tensorflow

by supreets2002 in Circuits > Raspberry Pi

212 Views, 3 Favorites, 0 Comments

UAV Detection on BrainyPi Using Tensorflow

01.jpg



TensorFlow is a Python-friendly open source library for numerical computation that makes machine learning and developing neural networks faster and easier.

TensorFlow, which competes with frameworks such as PyTorch and Apache MXNet, can train and run deep neural networks for handwritten digit classification, image recognition, word embeddings, recurrent neural networks, sequence-to-sequence models for machine translation, natural language processing, and PDE (partial differential equation)-based simulations. Best of all, TensorFlow supports production prediction at scale, with the same models used for training.

TensorFlow also has a broad library of pre-trained models that can be used in your own projects. You can also use code from the TensorFlow Model Garden as examples of best practices for training your own models.

TensorFlow allows developers to create dataflow graphs—structures that describe how data moves through a graph, or a series of processing nodes. Each node in the graph represents a mathematical operation, and each connection or edge between nodes is a multidimensional data array, or tensor.

Also reference documentation which i used is here

Supplies

ras.jpg
ras1.jpg
  • Brainy Pi
  • UNIX OS Terminal
  • Reference documentation is here

Remote Connection to Brainy Pi

11.png

Secure a remote connection to the brainy pi using the command,

	ssh -X pi@auth.iotiot.in -p 65530

After entering the password, a remote connection is established on the terminal.


Cloning the Git Repository

  • first we have clone our model using the command -
git clone https://github.com/supreets2002/UAV_Detection.git
  • Then we have to install Tensorflow using command -
pip3 install tensorflow
  • and then we have make some changes in inference file i.e. changing some file path in inference file according to our machine and they are -
  1. line 11 - TEST_DIR = '/home/pi/UAV_Detection/test/'
  2. line 14 - PATH_TO_SAVED_MODEL="/home/pi/UAV_Detection/my_model/saved_model"
  3. line 24 - category_index=label_map_util.create_category_index_from_labelmap("/home/pi/UAV_Detection/label_map.pbtxt",use_display_name=True)
  4. line 74 - nimg.save('/home/pi/UAV_Detection/output/'+'image_'+count+'.jpg')
  • In this above all lines we have to replace "/home/pi" by the path where we will clone the UAV_Detection folder.
  • change file directory to UAV_Detection folder.
cd UAV_Detection

Running the Inference File

WhatsApp Image 2023-03-25 at 6.08.17 PM.jpeg
  • run the inference file using the command - 
  python3 inference.py
  • once executed inference file we will get the expected results (i.e. we will get the images with UAV being detected and surrounded by box.

Results

yoto06497.png
yoto06497.png
  • Here is the result, on left side we have image before running our model on it and on right side we have image after running our model on it.