presence detection using deep learning

if you are interested in deep learning. this part is for you.

build a neural network script on your sense2GoL board.

1. how does deep learning work?

a deep learning model is designed to continually analyze data with a logic structure similar to how a human would draw conclusions. To achieve this, deep learning applications use a layered structure of algorithms called an artificial neural network. the design of an artificial neural network is inspired by the biological neural network of the human brain, leading to a process of learning that’s far more capable than that of standard machine learning models.

2. how neural network looks like?

The neurons are grouped into three different types of layers:

  1. Input Layer receives input data. 
  2. Hidden Layer(s) perform mathematical computations on our inputs. One of the challenges in creating neural networks is deciding the number of hidden layers, as well as the number of neurons for each layer.
  3. Output Layer returns the output data.

after

you can develop your own solution flowing the next steps and see how the experience looks like.

3. Building your Model

     1. environment

  • the first thing to do is setting your environment, you need to install Anaconda (python 3.7).
  • go to Anaconda prompt to install the libraries :

         libreries

  • run spyder to start programming 

     2. The dataset

we used the FFT spectrum as the input for our model and which is composed of two classes: 

         - we assign to the A presence is detected.

         - we assign to the No presence is detected.

you can download the dataset using the following link: Download now!

     3. Start programming

the first thing to do in every deep learning is importing the libraries: 

     4. develop your model

the first thing you need to do is preparing your data.  data_preparation  split our dataset into a training dataset, a testing dataset, and a validation dataset. we used validation dataset to see the accuracy of our model while being trained.  

we used   CNN_1D  architecture to build our model. it is composed of 5 hidden layers. add and remove some hidden layers and test how that affect your model.   

 save_model   creates two files "DL_Model.h5" and " DL_Model.json" with the training data. you can use them now file in your scripts.

 lastly, let's use our developed functions and test our model.

4. test your model

our model is based on the FFT spectrum. for that, we need to go from the time domain (IQ data) to the frequency domain and see the results. open a new project and test your model

     done.

and that’s it! connect your Sense2GoL board and run the code. watch your algorithm displays someone's presence. have fun playing!

troubleshooting

your board should be flashed with the IQ data.

  •  SerialException: could not open port 'COM*'

you need to disconnect the USB and reconnect it every time you want to run your test script.

  • SerialTimeoutException

if there is an error in your script, this error will appear.

  • NameError :name '.....' is not defined

this error means either you didn't import your library or need to install it. 

to install it, you just have to write this command on anaconda prompt  "pip install <the name of the package>"

to import a library use the command in your script  "import  <the name of the package>"