diff --git a/config.toml b/config.toml index e452df8..ed0308d 100644 --- a/config.toml +++ b/config.toml @@ -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" diff --git a/content/pybytes/mlintegration/_index.md b/content/pybytes/mlintegration/_index.md new file mode 100644 index 0000000..81c6183 --- /dev/null +++ b/content/pybytes/mlintegration/_index.md @@ -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) diff --git a/content/pybytes/mlintegration/features.md b/content/pybytes/mlintegration/features.md new file mode 100644 index 0000000..858a220 --- /dev/null +++ b/content/pybytes/mlintegration/features.md @@ -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) diff --git a/content/pybytes/mlintegration/modelcreation.md b/content/pybytes/mlintegration/modelcreation.md new file mode 100644 index 0000000..060849b --- /dev/null +++ b/content/pybytes/mlintegration/modelcreation.md @@ -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) diff --git a/static/gitbook/assets/pybytes/ml/data_acquisition.png b/static/gitbook/assets/pybytes/ml/data_acquisition.png new file mode 100644 index 0000000..0227326 Binary files /dev/null and b/static/gitbook/assets/pybytes/ml/data_acquisition.png differ diff --git a/static/gitbook/assets/pybytes/ml/data_acquisition_graph.png b/static/gitbook/assets/pybytes/ml/data_acquisition_graph.png new file mode 100644 index 0000000..67a8c3f Binary files /dev/null and b/static/gitbook/assets/pybytes/ml/data_acquisition_graph.png differ diff --git a/static/gitbook/assets/pybytes/ml/deploy.png b/static/gitbook/assets/pybytes/ml/deploy.png new file mode 100644 index 0000000..cd6d264 Binary files /dev/null and b/static/gitbook/assets/pybytes/ml/deploy.png differ diff --git a/static/gitbook/assets/pybytes/ml/ml_page.png b/static/gitbook/assets/pybytes/ml/ml_page.png new file mode 100644 index 0000000..fc24240 Binary files /dev/null and b/static/gitbook/assets/pybytes/ml/ml_page.png differ diff --git a/static/gitbook/assets/pybytes/ml/model_config.png b/static/gitbook/assets/pybytes/ml/model_config.png new file mode 100644 index 0000000..9fc27c1 Binary files /dev/null and b/static/gitbook/assets/pybytes/ml/model_config.png differ diff --git a/static/gitbook/assets/pybytes/ml/model_created.png b/static/gitbook/assets/pybytes/ml/model_created.png new file mode 100644 index 0000000..7cf7afd Binary files /dev/null and b/static/gitbook/assets/pybytes/ml/model_created.png differ diff --git a/static/gitbook/assets/pybytes/ml/model_definition.png b/static/gitbook/assets/pybytes/ml/model_definition.png new file mode 100644 index 0000000..8758393 Binary files /dev/null and b/static/gitbook/assets/pybytes/ml/model_definition.png differ diff --git a/static/gitbook/assets/pybytes/ml/model_main_page.png b/static/gitbook/assets/pybytes/ml/model_main_page.png new file mode 100644 index 0000000..d331418 Binary files /dev/null and b/static/gitbook/assets/pybytes/ml/model_main_page.png differ diff --git a/static/gitbook/assets/pybytes/ml/processing.png b/static/gitbook/assets/pybytes/ml/processing.png new file mode 100644 index 0000000..2962598 Binary files /dev/null and b/static/gitbook/assets/pybytes/ml/processing.png differ diff --git a/static/gitbook/assets/pybytes/ml/processing_output.png b/static/gitbook/assets/pybytes/ml/processing_output.png new file mode 100644 index 0000000..525d596 Binary files /dev/null and b/static/gitbook/assets/pybytes/ml/processing_output.png differ diff --git a/static/gitbook/assets/pybytes/ml/pybytes_front_page.png b/static/gitbook/assets/pybytes/ml/pybytes_front_page.png new file mode 100644 index 0000000..c5dd32c Binary files /dev/null and b/static/gitbook/assets/pybytes/ml/pybytes_front_page.png differ diff --git a/static/gitbook/assets/pybytes/ml/select_device.png b/static/gitbook/assets/pybytes/ml/select_device.png new file mode 100644 index 0000000..1a0ff2b Binary files /dev/null and b/static/gitbook/assets/pybytes/ml/select_device.png differ diff --git a/static/gitbook/assets/pybytes/ml/testing.png b/static/gitbook/assets/pybytes/ml/testing.png new file mode 100644 index 0000000..8d34946 Binary files /dev/null and b/static/gitbook/assets/pybytes/ml/testing.png differ diff --git a/static/gitbook/assets/pybytes/ml/testing_results.png b/static/gitbook/assets/pybytes/ml/testing_results.png new file mode 100644 index 0000000..b0d0415 Binary files /dev/null and b/static/gitbook/assets/pybytes/ml/testing_results.png differ diff --git a/static/gitbook/assets/pybytes/ml/training.png b/static/gitbook/assets/pybytes/ml/training.png new file mode 100644 index 0000000..6251800 Binary files /dev/null and b/static/gitbook/assets/pybytes/ml/training.png differ