Skip to content

PIR-IDS/wallet-model

Repository files navigation

PIR – ML Model Training


Logo

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
  1. About The Project
  2. Getting Started
  3. Usage
  4. Tree Structure
  5. Credits
  6. Contact

About The Project

This code will be used in order to train the wallet model for our IDS.

Built With

Getting Started

Prerequisites

Installation

  1. Clone the project
    git clone https://github.com/PIR-IDS/wallet-model.git
  2. 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 version pyenv 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

  1. The project is now ready to run.

Usage

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)

Execution

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

Tree Structure

TODO

Credits

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

Contact

Project Link : https://github.com/PIR-IDS/wallet-model

Organization Link : https://github.com/PIR-IDS