Giter Club home page Giter Club logo

ecg-htm's Introduction

ECG + HTM

ECG Anomaly Detection System using HTM

Abstruct

In this projects, We build Electrocardiogram(ECG) anomaly detection system using HTM(NuPIC). This system will detect Palpitation, Arrhythmia and Heart Rate anomaly.

System Structure and Usage

There are about three parts of the projects.

  • Data Collector
  • FFT Converter
  • Anomaly Detector

Data Collector

It's not difficult to make your own ECG device. If you are not interested in collecting data by yourself, You can skip this part and use data in data directory.

We use

device

Sparkfun's tutorial is very friendly. You can also use Sparkfun's Github Repository to get simple visualization of ECG Data. Visualization output is like this video.

Next, Collect ECG Data through the script.

$ python src/take_data.py > data/foobar.csv

Collected Data have this format.

2015-10-17 21:05:10.078937,483
2015-10-17 21:05:10.094542,481
2015-10-17 21:05:10.094833,480
2015-10-17 21:05:10.094949,485
2015-10-17 21:05:10.095044,492
2015-10-17 21:05:10.110693,501

If you want to visualize collected data, You can use Gnuplot.

$ gnuplot
set datafile separator ","
plot "< head -1000 data/foobar.csv" using 2 with line

2015-11-09 21 48 35

FFT Converter

Before detecting anomalous part of the ECG data, We use a signal processing technique, FFT(Fast Fourier Transform). FFT can be used to extract charactaristics of data sequence. Numpy library contain FFT, and we use that.

See example for using FFT Converter with ECG data collected by take_data.py. You can also use the preset data of the repository. FFT converter can use like this.

$ python src/fft_converter.py --target healthy_person1
2015-10-17 21:05:12.685818,11.808565811567473,...,10.957521665215634
2015-10-17 21:05:12.701433,11.808734646395951,...,7.7589930598122354
...
2015-10-17 21:05:57.033917,11.821344935267192,...,8.5655396209023618

You can use --target option to specify the target file's name. Dont's forget to remove .csv string from file name.

FFT Converted data are can be visualized using Gnuplot.

2015-11-07 18 54 14

Non uniform parts are corredpond to the anomalous of ECG data.

Anomaly Detection

We use anomaly detection using vector_anomaly.py Script. You shoud use FFT Converted data.

$ python src/vector_anomaly.py 

This is the visualization of the output.

d2378b575a8f02188069ef80a08ae6fd 1

Data

This repository include some helathy and abnormal ECG data. These data are in data directory.

Nomral ECG data

  • data/healthy_person1.csv
  • data/healthy_person2.csv
  • data/healthy_person3.csv
  • data/healthy_person4.csv

Abnormal ECG data

  • data/disease_person1.csv
    • This data contain big anomalous part.
  • data/disease_person2.csv
    • This data contain small anomalous part.
  • data/disease_person3.csv
    • This data is chronically abnormal in QRS wave.

ecg-htm's People

Contributors

iizukak avatar rhyolight avatar

Watchers

 avatar  avatar

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.