IDS: Code for the Machine Learning Model Training for the Wallet use case
See Releases »
Research Paper
·
Test Results
·
See Global Usage
Table of Contents
This code will be used in order to train the wallet model for our IDS.
- Install the latest version of pyenv (https://github.com/pyenv/pyenv-installer [ UNIX ], https://pyenv-win.github.io/pyenv-win/ [ WINDOWS ]) or update it with the following command:
pyenv update
- Install the latest version of pipenv (https://pipenv.pypa.io/) or update it with the following command:
pip install pipenv --upgrade
- Clone the project
git clone https://github.com/PIR-IDS/wallet-model.git
- Install the dependencies by typing the following command while being in the project root:
pipenv install --dev
⚠️ If you are using pyenv-win (WINDOWS) : If you do not have the version of Python used in the project, it is possible that pipenv does not detect pyenv, preventing you from using it directly. To solve this problem, first install the desired versionpyenv install 3.8.10
and then instead of the above command use this one:pipenv --python %USERPROFILE%\.pyenv\pyenv-win\versions\3.8.10\python.exe install --dev
- The project is now ready to run.
To train the wallet model, it takes as an input the raw accelerometer data classified in two categories: "wallet" and "negative". The current input (inside the "train" folder) is the one used to generate the model of the Wallet Card repository. This raw data also contains the gyroscope data, but it is ignored by the code. You can generate such raw inputs by running the Wallet Data Collector and BLE Reader repositories.
The train model is a CNN based only on the accelerometer data, we tried to add the gyroscope data but the benefits weren't significant. Also, we tried several sampling rates and input length and it turns out that the most efficient parameters were 96 samples at a rate of 25Hz (~4 seconds of recording).
This code is able to provide a model with an accuracy of 95% with a relatively small training set (less than 20 minutes of recording)
Run the following instructions to launch the training and convert the model in a C compatible format:
pipenv run prepare && pipenv run split && pipenv run train && pipenv run generate
The final model file will be located in: output/model.cc
There is also another way to create the model by using norms. This approach is not working well, so it's only a PoC implementation to show that it is not an acceptable solution. If you still want to use it, you can do the following:
pipenv run prepare_norm && pipenv run split && pipenv run train_norm && pipenv run generate
TODO
Romain Monier [ GitHub ] – Co-developer
Morgan Pelloux [ GitHub ] – Co-developer
David Violes [ GitHub ] – Co-developer
Malik Sedira [ GitHub ] – Co-developer
Quentin Douarre [ GitHub ] – Co-developer
Noé Chauveau [ GitHub ] – Co-developer
Pierre Favary [ GitHub ] – Co-developer
Project Link : https://github.com/PIR-IDS/wallet-model
Organization Link : https://github.com/PIR-IDS