CycleSense model that is utilized in the SimRa Project for automatic detection of (near-miss) incident.
This repository includes the preprocessing pipeline, the CycleSense model, as well as the other models that were used for evaluation. All of these models can be found in the classifier folder. The modified heuristic and a reimplementation of the FCN proposed by Sánchez is also available there.
This model is an adaptation of the DeepSense model introduced by Yao et al. (2017). It was officially introduced in the paper "Detecing (Near-miss) Incidents in Bicycle Traffic from Mobile Motion Sensors" in the Journal of Pervasive and Mobile Computing.
If you want to make use of the CycleSense model you need to install the dependencies first. You can do that using Anaconda or Pip with one of the following commands:
conda env create -f conda-cpu.yml
pip install -r requirements.txt
If you want to retrain the model, you need to reformat the ride files obtained from the SimRa dataset first.
python export.py <source_dir> <target_dir>
Thereby, the target_region
parameter is optional and per default set to Berlin, as this is the region containing the most rides.
If more than one region should be formatted, this command can be executed multiple times.
The lin_acc_flag
is False as a default, as including the linear accelerometer data did not lead to any improvements but required more memory consumption and training time in our experiments.
In a next step, the data need to be preprocessed. The defined preprocessing pipeline can be executed via the following command:
python preprocess.py <dir>
There are many configuration options available that can be found using the help functions
python preprocess.py -h
.
It is noteworthy, that the utilization of the Generative Adversarial Network for data augmentation can be deactivated, as well as the fourier transform.
Finally, the model can be retrained with the command:
python cyclesense.py <dir>
The CycleSense model does clearly outperform all the other models we have encountered for evaluation on the more recent Android rides of the SimRa dataset, as illustrated in the figure below.