Merge pull request #321 from pycom/pb-ml-integration

Pybytes Machine Learning integration doc
This commit is contained in:
bogdan-XT
2020-09-07 22:59:28 +03:00
committed by GitHub
19 changed files with 162 additions and 6 deletions

View File

@@ -1447,12 +1447,19 @@ theme = "doc-theme"
parent = "pybytes"
weight = 80
[[menu.main]]
name = "Pymesh Integration"
url = "/pybytes/pymeshintegration/"
identifier = "pybytes@pymeshintegration"
parent = "pybytes"
weight = 90
[[menu.main]]
name = "Pymesh Integration"
url = "/pybytes/pymeshintegration/"
identifier = "pybytes@pymeshintegration"
parent = "pybytes"
weight = 90
[[menu.main]]
name = "Machine Learning"
url = "/pybytes/mlintegration/"
identifier = "pybytes@mlintegration"
parent = "pybytes"
weight = 100
[[menu.main]]
name = "Amazon IoT"

View File

@@ -0,0 +1,16 @@
---
title: "Machine Learning Integration"
aliases:
---
## What does Machine Learning integration offer you?
This documentation is a quick introduction to the new Machine Learning integration features on Pybytes.
The Machine Learning integration is here to help you to create smart machine learning models using Pycom devices.
## Let's get started!
* [Machine Learning Model Creation](/pybytes/mlintegration/modelcreation)
* [Machine Learning Features](/pybytes/mlintegration/features)

View File

@@ -0,0 +1,91 @@
## Model Features
### Data Acquisition
#### Create Sample
In the data acquisition module the samples for training can be collected.
After setting all sample parameters in the form click on **Create Sample** to start.
The sampling occurs when the device led is amber, when the light turns purple, the device is processing and saving the samples.
If the device gets stuck showing the purple light, maybe the sampling should be done again.
#### Data Collection
The data collection shows the collected samples. Click on the sample to see the graph.
![Data Acquisition](/gitbook/assets/pybytes/ml/data_acquisition_graph.png)
### Signal Processing
Signal processing is used to extract features for the Neural Network module.
There are many ways to extract features. The simplest way is using convolutional layers, but doing this there is no control of what features will be used and also the convolutional layers make the neural network bigger, so more data is needed for training.
Signal processing provides an easy and intuitively way to extract features and also the features can be analyzed using different methods.
The input data consists from accelerations values on three axes (X, Y, Z). To analyze the data, a window of a certain size is moved over the data using a moving step. The Window Size and Window Step are model specific and they are defined in the Model Configuration tab. This window is received by the signal processing block as input.
##### Standardization
First, the window data can be standardized by subtracting the average and dividing it by its standard deviation, thus obtaining a window with zero mean and a variance equal to one.
##### Filter
After the window is standardized, a filter can be applied to the data. The type of the filter (none, low-pass, high-pass), the cutoff frequency and the filter order can be selected by the user.
##### Features
Using Fourier analysis (FFT transform), features are extracted from the data. Time localization is lost if the Fourier transform is applied to the entire window data. To keep some information about time localization, the user can split the window data in smaller intervals and analyze each interval separately (this is the short-time Fourier transform).
Features are calculated for every axis (X, Y, Z), independently of other axes. The next features are available to be selected/used by the user:
- The root mean square. It is the square root of the arithmetic mean of the squares of the values.
- FFT peaks. First peaks from FFT values, to be used as features.
- Spectral Power on intervals. Mean of the squares of the FFT values, on specified frequencies intervals.
##### Select Features
To select the desired features and also to see the filtered data and calculated FFTs, select the data window to be analyzed, fill in the form and click the **Process Signal** button.
![Processing](/gitbook/assets/pybytes/ml/processing.png)
#### Training
The neural network receives its input from the Signal Processing block.
The number of layers and the number of neurons in this layer can be selected by the user. For the moment there are supported only dense layers as hidden layers. Other parameters that can be selected are: the number of training epochs, the learning rate and the confidence threshold.
To train the model, fill the Neural Network Settings form and click on **START TRAINING** button.
The results can be checked on the Training Performance section.
![Training](/gitbook/assets/pybytes/ml/training.png)
#### Testing
In the module, the samples for testing can be collected.
After setting all sample parameters in the form click on **Create Sample** to start.
#### Data Collection
The data collection shows the testing collected samples. Click on the **Test xxx Samples** to test the module.
![Testing](/gitbook/assets/pybytes/ml/testing.png)
After the testing is performed, the results can be checked below the Data collection form.
![Testing Results](/gitbook/assets/pybytes/ml/testing_results.png)
#### Model Deployment
After all training and testing, the model can be deployed into the devices.
Select the devices and click on the **DEPLOY MODEL** button.
![Model Deployment](/gitbook/assets/pybytes/ml/deploy.png)
[**Machine Learning Integration**](/pybytes/mlintegration)

View File

@@ -0,0 +1,42 @@
## Model Creation
The first step to use the machine learning feature on Pybytes is the model creation.
The Machine Learning app can be accessed in the main sidebar.
![Machine Learning App](/gitbook/assets/pybytes/ml/pybytes_front_page.png)
To create a new model, click on **ADD MODEL** button and follow the wizard.
The existing models are listed below.
![Create Model](/gitbook/assets/pybytes/ml/ml_page.png)
### Model Wizard
#### The first step is the model definition.
In the model definition the fields **Name**, **Description**, and **Sample frequency** should be fulfilled.
![Model Definition](/gitbook/assets/pybytes/ml/model_definition.png)
#### The second step is the model configuration.
In the model configuration, the processing block type and learning block technique should be selected.
In the beta version, only the Spectral Analysis (processing block type) and Neural Network (learning block technique) are available.
![Model Configuration](/gitbook/assets/pybytes/ml/model_config.png)
#### The third step is the Device Selection.
In the third step the devices that will be used to train and test the model should be selected.
![Device Selection](/gitbook/assets/pybytes/ml/select_device.png)
And now the model is ready to be used!
![Device Selection](/gitbook/assets/pybytes/ml/model_created.png)
Check this link to learn how to train and test the model [**Model features**](/pybytes/mlintegration/features)

Binary file not shown.

After

Width:  |  Height:  |  Size: 511 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 291 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 202 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 371 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 286 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 323 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 649 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 KiB