GithubHelp home page GithubHelp logo

sbettid / gpsclean Goto Github PK

View Code? Open in Web Editor NEW
18.0 4.0 0.0 9.36 MB

An application to correct a GPS trace using machine learning techniques. To preview it, a small web interface, named GPSClean Web, is available

Home Page: https://gpscleanweb.onrender.com/

License: MIT License

Python 100.00%
machine-learning python gps-data cleaning-data cleaning-data-in-python

gpsclean's Introduction

GPSClean

What is GPSClean?

The goal

GPSClean is an Open Source application developed with the goal of automatically detect and correct errors in GPS traces, exported in the widely adopted GPX format, using machine learning techniques and without prior geographical knowledge. It is the result of the research undertaken for my thesis project during the Master in Computational Data Science (University of Bolzano).

Would you like to know more about the underlying research? Well, then just read the associated paper!

Feel free to try the application and report any feedback on the project's Github page.

How does it work?

The activity undertaken by GPSClean can be divided in three main steps:

  • Data Preprocessing
  • Error detection
  • Error correction

The following sections briefly explain the three activities, for further details I invite you to consult the jupyter notebooks available at the Transform and Model repository.

Data preprocessing

The first operations performed by GPSClean are related to data pre-processing. In particular, the machine learning model adopted by the application considers the differences (deltas) between the registered points, since it does not use any geographical knowledge abou the region in which the trace was registered.

For this reason, the latitude, longitude and altitude original coordinates are converted to ECEF (Earth Centered Earth Fixed) coordinates, enabling so a simpler calculation of the deltas given their cartesian nature.

The second pre-processing step is the calculation of the deltas between two consecutive points, with the result being the input that will be provided to the machine learning model.

Error detection

The error detection step is based on a previously trained machine learning model. The model, based on a neural network composed by Bidirectional LSTM (Long-Short Term Memory) cells, was trained on a set of annotated GPS traces, namely traces on which the errors were explicitly marked using an ad-hoc developed web-based tool.

The considered errors are the following:

  • Pauses: when the selected movements were a pause and are the result of GPS reception errors.
  • Outliers: when the point, due to a reception error, is in an incorrect position.
  • Indoor: a point collected while being indoor in a building.

The result of the application of the model is an annotated trace, used then in the following step.

Error correction

A special type of error: pauses

Firstly, it should be noted how one of the considered error categories, namely pauses, differs fromthe others, when it comes to correction. In fact, points representing pauses should appear, in the ideal case, stacked one upon the other, given that the position of the receiver did not change in the considered time frame. However, often pauses are represented, in the GPS trace, by a cloud of points resulting from a measurement error bythe GPS sensor. For the aforementioned reasons, points identified by the model as belonging to a pause can bedirectly removed, resulting so in a more smoothed trace with no unnecessary points

Correcting misplaced points

Pauses, as explained in the previous section, can be directly removed, step that can not be performed on misplaced points, which need then to be corrected.

In order to obtain the most appropriate error correction, various techniques were investigated during the thesis research. The selected approach was denoted Bidirectional Separate Kalman Filters, a variation of the widely adopted Kalman Filter.

A Kalman Filter is a structure which predicts the following observation (in our case position) in time series and joins it together with the observed value to obtain the final observation. The predicted value of the next observation, represented by a state vector, is based on the covariance and relation of the different components, combined with an external influence and uncertainty. The values for the covariance and uncertainty were derived from previous researches in the field.

The proposed variation applies two separate Kalman Filters for each detected error area, one in each direction, and takes the mean of the resulting corrected positions as the final ones, smoothing so the initial corrections exploiting the availability of the entire time series.

The corrected version of the trace is then exported in the GPX format.

Running the application

In order to run the application, please follow the subsequent steps:

  1. Download the last released package from the Release section of this repository.
  2. Install the downloaded package by executing the following command: pip install --extra-index-url https://google-coral.github.io/py-repo/ gpsclean-x.y.z-py3-none-any.whl
  3. Now you are ready to clean your first GPS trace by executing the following command: gpsclean path/to/your_trace.gpx
  4. In the same folder where the original trace resides, you will find a cleaned version of the trace with the suffix "_cleaned"

gpsclean's People

Contributors

dependabot[bot] avatar sbettid avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

gpsclean's Issues

Axis Error

Hi
Was trying to use the cleaning application but I am getting the following error:


/ || _ \ / | / || | ___ __ _ _ __
| | _ | |
) |_
\ | | | | / _ \ / ` || ' \
| |
| || __/ ) || | | || __/| (
| || | | |
_
||
| |/ _||| ___| _,||| ||

Version: 1.0.0

Reading your trace...
Loading the model...
Predicting points...
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
Traceback (most recent call last):
File "/disk1/raksha/GPSClean/raksha-clean-env/bin/gpsclean", line 8, in
sys.exit(main())
File "/disk1/raksha/GPSClean/raksha-clean-env/lib/python3.9/site-packages/gpsclean/gpsclean.py", line 77, in main
segments, indices, predictions = ft.predict_trace(interpreter, deltas, 15, 2)
File "/disk1/raksha/GPSClean/raksha-clean-env/lib/python3.9/site-packages/gpsclean/FullTraining.py", line 114, in predict_trace
predictions=np.argmax(predicted_segments,axis=2)
File "<array_function internals>", line 180, in argmax
File "/disk1/raksha/GPSClean/raksha-clean-env/lib/python3.9/site-packages/numpy/core/fromnumeric.py", line 1216, in argmax
return _wrapfunc(a, 'argmax', axis=axis, out=out, **kwds)
File "/disk1/raksha/GPSClean/raksha-clean-env/lib/python3.9/site-packages/numpy/core/fromnumeric.py", line 54, in _wrapfunc
return _wrapit(obj, method, *args, **kwds)
File "/disk1/raksha/GPSClean/raksha-clean-env/lib/python3.9/site-packages/numpy/core/fromnumeric.py", line 43, in _wrapit
result = getattr(asarray(obj), method)(*args, **kwds)
numpy.AxisError: axis 2 is out of bounds for array of dimension 1

Attaching the sample gpx file
https://drive.google.com/file/d/1yNoTzNmDQM5jwPiSksnbVg52ssLKaw-X/view?usp=sharing

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.