Early and low cost detection of Heart Failure

Heart Failure is a debilitating condition that most old people encounters. A PoC uses coded signals, Doppler and a sound ML classifier.

Similar projects worth following
Heart failure (HF) is a complex heart syndrome. It prevents the heart from fulfilling the circulatory demands of the body. It takes 10 years to progress from Stage I to Stage IV (severe). There is no remedy. Being able to detect the development of chronic diseases at an early stage is instrumental to preventive care.

We propose to use a point of care device, composed of a low cost Doppler device with a trained classifier, to detect suspicion of HF in primary care.

In order to detect HF with a ML classifier, we train it to recognize features in sounds from the Physionet Cinc or similar competitions.

In our case, signals acquired with a low cost fetal Doppler, are connected to a Linux box hosting the classifier and user GUI. It records heart beats without needs of any gel. We will later code the Doppler signal to obtain more features, specially about fibrous tissues. In a further iteration we will implement the ML classifier on a low cost controller.

Short list of desired features:

* This device can measure the acoustic impedance of heart and lung tissues even in non medical environment, no need to move to a medical center.

* This device measures the acoustic impedance of tissues by a home carer, without need for medical staff.

* This device mitigate issues due to unanticipated skin colors, sweating or medical conditions, as it can "phone home" if it found anomalous results. Conversely it receives updates automatically, so what is learn from a single case, is send to every devices at their next update.

* It is very low cost: Certainly less than $150 in its final version.

* It can be used for a long time without creating skin problems, as it uses no gel and is easy to clean.

Actually ultrasound specialists also use such artifacts to detect cysts, tumors, calcifications. B-line is an artifact that is used in ultrasound imaging (or lack of!) to infer medical conditions.

Acoustic impedance:

It is well known that the density of degenerated tissues is lower than those of normal tissues. This is due both to intracellular and extracellular damages.

While using machine learning to detect heart failure is not new, using ML features symptomatic of fibrous tissues is entirely new.

Based on the acoustic impedance the tissue could be classified as: normal, degenerated, granulated and fibrous. Each category indicates specific problems mostly in connective tissues.

Changes in tissues acoustic impedance alone, do not mean in themselves that the medical condition changed. What makes it accurate is that this device can recognize signatures of degenerated tissue thanks to modern statistical technologies such as Hidden Markov Chains.

Selecting a heart sound file in Simple_Hjerte.png

Here is a picture of the UI of the simplified version of Hjerte at version 0.1. There is only one button in the UI, push it to select the heart sound file that you want to classify. The outcome of the classification process appears after a few seconds, there is a message which tells you if the heart sound file is similar or not to the training set. A numeric indication is also provided, at "0" there is no similarity found with the training set, and at "one" there is a perfect similarity, whatever that really means. You can record the heart sound file with a fetal Doppler, or a direct recording. But the Doppler method gives better results (no ambient noises). You must record your heart sound file in WAV format. A test file is provided (heart_jp.aiff). A fetal Doppler costs $50 and the executable and sources are available below. It is written in Java so you need it on your machine.

Portable Network Graphics (PNG) - 36.21 kB - 07/26/2017 at 09:23


This is a PoC that uses HMM with near 300 heart sound files in the training set. Go to the ./dist folder and launch the jar file (on Windows you may use the .bat file). There is only one button in the UI, push it to select the heart sound file that you want to classify. The outcome of the classification process appears after a few seconds, there is a message which tells you if the heart sound file is similar or not to the training set. A numeric indication is also provided, at "0" there is no similarity found with the training set, and at "one" there is a perfect similarity, whatever that really means. Please send me your remarks or comments. (this is a crude hack intended to gather feedback, it is not a medical device, please do not use it for checking a health problem, if you have a health question, please ask it to your medical doctor)

Zip Archive - 594.12 kB - 07/26/2017 at 09:04


Portable Network Graphics (PNG) - 139.30 kB - 06/08/2017 at 08:16


  • 1 × 3 MHz low cost ultrasound probe It costs only $50, but indeed it does not offer beam forming!
  • 1 × A ultrasound pulser This is done with transistors and other discrete components!
  • 1 × Analog front end It uses ordinary operational amplifiers
  • 1 × ML classifier To detect features in the training set, I used a modified subset of jAudio. The training set comes from Physionet, but there are other freely accessible on the net. The classifier is a HMM derived from a speech processing project. I want to use a HMM because it is able to predit states and offer an explanation of the model (the probability of transitions between states)

  • About usefulness of early detectors

    Jean Pierre Le Rouzic08/03/2017 at 07:39 1 comment

    When one claim to design an early detector of some illness, it is important to think about early detection in healthcare in general, what are the benefits, inefficiencies and the new problems it creates.

    As a personal anecdote about usefulness of early detectors, I had a skin carcinoma, that two doctors (the family and the company MDs) saw without reacting for years, one of them even asked me what it was. At the end it was a cardiologist who told me it was probably a carcinoma and that I had to consult quickly a specialist.
    MDs have to know what to make of the tests results of those devices. For example some medical organizations start to provide free kit for genetic screening for some conditions [0], as we know some drugs work well for some genomes but less for others, which is a concept a bit weird in itself but very fashionable at the moment.
    But those kits do not work the same way, so their results are not comparable with each others, some may analyze the DNA in blood, while others may take a sample with a biopsy needle. Neither can claim to capture the full picture of the tumor’s mutations. In addition tumors' genome evolves very quickly and is not homogeneous, it is as if many mutations are branching out quickly from a common ancestor cell. At some time later a tumor is the site of several unrelated mutations.
    Some tests sometimes provide conflicting or overlapping results from the same patient. Researchers at the University of California, San Diego, published a 168-patient study on discordance in early 2016 that shows there are overlap as well as differences, between DNA analyses from biopsies of tissue and blood samples.
    Some tests even make suggestions for drugs, studies have shown that different commercial solutions may in some cases suggest different drugs, or do not suggest drugs that a MD would have prescribed. Those commercial products need to improve, and doctors' professional bodies need to develop guidelines to teach how to cope with those new tools.

    Another thing is the false negative, the press reported recently an unfortunate case where a women felt something was wrong with her baby, in the last months of her pregnancy. She then used a fetal Doppler and found an heart beat, unfortunately the baby was stillborn. It is possible that if she had not used her fetal Doppler, she would have gone immediately to her hospital which may have saved the baby.
    False positive are another problem, as an older man I am regularly reminded to check for PSA by the state health insurance, PSA (prostate-specific antigen) is a marker of prostate cancer. I am aware of the risk of cancer, but two large studies, one in US and two in Europe told that for a thousand people screened positively, one man will probably be saved, but several dozens will suffer severe degradation in their life quality and health in general.

    The testing process may also induce traveling cost for the patient, lost of time and revenues, incomfort or even suffering, especially in women healthcare. Unnecessary biopsies and other medical procedures for people who are wrongly diagnosed or whose cancer might never have spread, can also hasten health problems.
    While early detectors might seem a good idea in general, one problem is the anxiety they generate, for example even if everything is right, it does not mean everything will stay right in the future so there is a constant urge to re-check. Even medical doctors could succumb to cognitive bias, when they find "something" in mammography, then ask for more tests which are negative but nevertheless urge to have more frequent testing in the future, creating unnecessary anxiety for the patient[1].

    What does all this mean for a designer of an early detector of heart failure? Certainly that there is a need to not make big unwise claims. There is also a need to collaborate with real doctors, not only scientists.
    At the same time how to attract attention of people to make them use it and finance...

    Read more »

  • Refactoring and randomness test

    Jean Pierre Le Rouzic07/12/2017 at 17:07 0 comments

    The first usable versions of our features detection code ( were full of hardwired constant and heuristics.

    The code has now been modularized with clean condition of method exit.
    We were proud that our design was able to look at each beat and heart sound, which is a far greater achievement than what ML code does usually. Something really interesting was how we used compression to detect heart sounds features automatically in each beat.
    Now we introduce something similar in spirit: Until now sometimes our code was unable to find the correct heart rate if the sound file was heavily polluted by noise. Now we use a simple statistical test akin to standard deviation, to test the randomness of beats distribution. If it is distributed at random, then it means our threshold is too low: We detect noise in addition to the signal.
    This helped us to improve the guessing of the heart rate.

    In an unrelated area, we also started to work on multi-HMM, which means detecting several, concurrent features. An idea that we toy with, would be to use our compression trick, at beat level, whereas now it is used at heart sound level. This is tricky and interesting in the context of a multi-HMM. Indeed it makes multi-HMM more similar to unsupervised ML algorithms.

  • Multi-HMM Approach

    Jean Pierre Le Rouzic07/03/2017 at 14:30 0 comments

    Up to now the feature detection has used something that I find funny, but it works really well. As we use Hidden Markov Models, we must create a list of "observations" for which the HMM infer a model (the hidden states). So creating trustable observations is really important, it is a design decision that those observations would be the "heart sounds" that cardiologists name S1, S1, etc..

    In order to detect those events, we first have to find the heart beats, then find sonic events in each of them. In CINC/Physionet 2016 they use a FFT to find the the basic heart rate, and because a FFT cannot inform on heart rate variability, they compute various statistical indicators linked to heart rate variability.
    And its not a very good approach as the main frequency of a FFT is not always the heart beat rate.
    Furthermore this approach is useless at the heart beat level and indeed at heart sound level. So what we did, was to detect heart beats (which is harder that one could think) and from that point, we can detect heart sounds.

    Having a series of observations that would consist only of four heart sounds, would not be useful at all. After all a Sn+1 heart sound, is simply the heart sound that comes after the Sn heart sound. We needed more information to capture and somehow pre-classify the heart sounds.

    It was done (after much efforts) by computing a signature based somehow on a compressed heart sound. Compression is a much more funny thing that it might seem. To compress one has to reduce the redundant information as much as possible, which means that a perfectly compressed signal could be used as a token about this signal, and logical operations could be done with it.

    Sometimes people in AI research fantasize that compression is the Graal of machine learning by making feature detection automatic. We are far from thinking that, as that in order to compress one has to understand how the information is structured, and automatic feature detection implies that we do not know its structure.

    It is the same catch-22 problem that the Semantic Web met 10 years ago, it can reason on structured data but not on unstructured data, and the only thing that would have been a real breakthrough was reasonning on unstructured data. That is why now we have unsupervised Machine Learning with algorithms like Deep Forest. While Cinc 2016 submissions used heavily unsupervised ML, we used compression (Run Limited Length) to obtain a "signature" of each heart sound, and it works surprisingly well with our HMM.

    The next step is to implement a Multi-HMM Approach, because there are other possibilities to pre-categorize our heart sounds than its RLL signature, for example the heart sound might be early or late and that characteristic could be used to label it.

  • Heart beat detection and segmentation

    Jean Pierre Le Rouzic06/15/2017 at 21:18 0 comments

    You can find a good description of the current detection and segmentation of the heart rate on the Padirac Innovation web site:

    Why is segmentation so important? Because we want to be able to explain our classification result. This means that we share understanding and vocabulary with cardiologists. This is opposed to current approaches to deep learning like "deep forest" that fit their internal model with features that might be only remotely connected to the physiology.

    Why is it important to be able to understand what is going on at physiological level? Because the horror stories here are studies that claim to be able to predict with 98% accuracy re-hospitalization next year in diseases such as diabetes or heart failure, simply by looking at medical records. Obviously one does not need deep forest algorithms to predict that someone with a HF condition will be re-hospitalized next year.

    We must make credible statements, if we want MDs and scientists to take us seriously.

  • A library, a few modifications to GUI and feature detection

    Jean Pierre Le Rouzic06/15/2017 at 06:56 0 comments

    In order to work toward a controller implementation, I separated the core Hjertle (early heart failure detection) and its GUI.
    The new Hjertle library could be found at:

    Minor modifications were made to the GUI and to feature detection:

  • A milestone between phase 0 and phase 1.

    Jean Pierre Le Rouzic06/11/2017 at 10:35 0 comments

    When I started this project I stated there would be several phases:

    - The phase 0: Fetal Doppler and Linux box, which was possible for you to implement from the onset thanks to the code from Physionet 2016.

    - The phase 1 is a dedicated device (Arduino?) combining a 3Mhz ultrasound probe and associated software .

    - The phase 2 hardware (phase 1 + fibrous tissue detection) will be also under a BSD or MIT license.

    Today we achieved a milestone between phase 0 and phase 1. A HMM software for Hjerte has been uploaded on Github in the master branch.

    It enables to train a HMM and classify another heart sound file with respect to this HMM. This software addresses the limitation I perceived in the Physionet code (no GUI, huge computing needs, black box solution). There is still no device, so you still have to use a Linux box (whatever kind as long as it runs Java 1.2) with a commercial low cost Fetal Doppler.

    I will now take a break to think about my other HaD project, and then resume the work toward phase 1. Comments or suggestions are heartily welcomed!

  • A GUI to manage HMMs

    Jean Pierre Le Rouzic06/07/2017 at 17:43 0 comments

    Our tool is intended to explore several HMMs and find how they perform on different training sets. This implies there is a need to manage HMMs.
    A HMM may have an author, an intended usage, belonging to a portfolio, and having a name. It can be saved and loaded and shown in a pretty way.
    However this is mostly not implemented at the moment, it is just the initial effort.

    Stay tuned!

  • New branch

    Jean Pierre Le Rouzic06/04/2017 at 21:59 0 comments

    The previous branch ..../draft_0 was removed and replaced by :
    It brings a slightly different GUI and a better detection of small features in heart sounds.

  • Heart sound files

    Jean Pierre Le Rouzic06/04/2017 at 09:22 0 comments

    Not much to show, but some news: Sounds files have problems that I did not anticipated. What I was expecting from the analysis of Physionet 2016 submissions was noise, spikes, weird amplitude and similar distortions of the signal.
    What I found was different, there is little noise while you filter it a bit, there are few spikes.
    However sometimes the signal is biased (more negative values than positive), the signal also appears to have little in common with textbooks, I can easily detect S1 and S2 events, but it is difficult to find S3 and S4.

    When you hear the sounds, half of them looks weird, I am not a cardiologist, but I find it difficult to find what I could hear in a "textbook" heart sound.
    This makes me think again about the Physionet 2016, successful submissions where mainly about heavily filtering, dealing with spikes with sophisticated algorithms and finding characteristics (features in ML slang) that encompass the whole file such as RR variability as in:

    Clearly my approach is different, I focus on what identify a heart beat, which is entirely new. But I still plan to implement the RR variability analysis and tied it to my HMM classifier which will become quite hybrid in the process.

  • A Github account and some code

    Jean Pierre Le Rouzic05/27/2017 at 08:01 0 comments

    We have added a tool to explore a tiny training set (100 files) and training a HMM.

    There is no code for classification at the moment, only for training.

    This is a draft, whose purpose is to be open and provide hints to where we are aiming, but in no ways the quality of the code should be asserted, we expect much, much work on it.

    It is deliberately in Java 1.2 for making it easy to port it to controllers that support Java or to a language that have an enough similar syntax (for ex. Go)

    The Github account for Hjerte:

    The branch where the new code was pushed:

View all 12 project logs

  • 1
    Step 1

    At the moment all you need is to buy a Fetal Doppler ($70) and connect it to a Linux box, where you will have downloaded, both the Physionet 2016 training set and the winning Matlab code (and associated libraries) by Christhian Potes and Saman Parvaneh.

  • 2
    Step 2

    As people asked for a Github repository, I created one with Potes and Parvaneh submission to Physionet 2016.
    However I added missing libraries and a documentation folder.
    In my view those two docs are worth much more than the code. They tell you the same story that Kaggle and similar competitions taught: The deep learning algorithm is not interesting, what has value is the feature detection, and it is hard!
    Indeed this remark should have a strong impact on design of any medical device.
    The Github is:

  • 3
    Step 3

    About copywrites, licenses, regulations and safety:
    - The code of Potes and Parvaneh, indeed belong to them and is licensed in GPL.
    - The current hardware (phase 0: Fetal doppler and Linux box), you have to buy it somewhere as I do not provide it, so if they have licenses, you are responsible to behave accordingly.
    - The phase 1 device, that I will design (a combo of a 3Mhz ultrasound probe and associated software providing roughly the same services as the fetal doppler, the Linux box and the code of Potes and Parvaneh) will be under a liberal open source like BSD or MIT.
    - The phase 2 hardware (phase 1 + fibrous tissue detection) will be also under a BSD or MIT license.
    - The software for phase 2 hardware will be either a community version under a BSD or MIT license or a commercial license whose code may differ from the community version.
    - About regulations: In most countries you cannot use this project in a medical context. It as to be approved beforehand by regulators. I will probably apply in EU for a device *helping to* and not *making* a diagnosis. It will be in a year or two and I will need lot of money and help from people at that time. Be careful, even if my organization obtain someday an EU authorization, that will not grant any authorization to other makers except the current right to study this device and for personal usage.
    - About safety, be careful, piezo-electric drivers have voltages in the hundred range. If they are not isolated (battery/transformer) they are dangerous. Same for any gel that you could buy by yourself. Another thing is about the outcome of the device, it may vary depending on the gender, age, weight, ambient noises, etc... It is not safe to assume that it is correct if you are not trained.

View all 3 instructions

Enjoy this project?



Jean Pierre Le Rouzic wrote 08/03/2017 at 17:30 point

Thanks Transcendence, it is very kind!

  Are you sure? yes | no

Transcendence wrote 08/03/2017 at 09:57 point

Inspiring work jean!

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates