Fire Detection on BrainyPi Using Tensorflow
by Niketan Swami in Circuits > Raspberry Pi
253 Views, 0 Favorites, 0 Comments
Fire Detection on BrainyPi Using Tensorflow
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
- Brainy Pi
- UNIX OS Terminal
- Reference documentation is here
Remote Connection to Brainy Pi
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/Niketan1604/Fire-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 -
- line 11 - TEST_DIR = '/home/pi/Fire-Detection/test/'
- line 14 - PATH_TO_SAVED_MODEL="/home/pi/Fire-Detection/my_model/saved_model"
- line 24 - category_index=label_map_util.create_category_index_from_labelmap("/home/pi/Fire-Detection/label_map.pbtxt",use_display_name=True)
- line 74 - nimg.save('/home/pi/Fire-Detection/output/'+'image_'+count+'.jpg')
- In this above all lines we have to replace "/home/pi" by the path where we will clone the Fire-Detection folder.
- change file directory to Fire-Detection folder.
cd Fire-Detection
Running the Inference File
- 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 fire being detected and surrounded by box.
Results
- 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.