Getting started • Principle • Persistence Diagram
Dependencies are in requirements.txt.
Basic use
python src/main.py
This will display a default image of cells. Select a point to run the analysis on. The output images are stored in out/
.
GIF of animated persistence diagram
python src/main.py --gif
The GIF is stored at out/persistence_diagram.gif
.
See python src/main.py -h
for available options (change the image, hyperparameters values, etc).
Goal: classify the selected pixel (red) as belonging to a corner, an edge or simply background.
We use persistence diagrams to count the number of peaks of significant intensity in the blue ring around the selected pixel.
We then apply the following classification rule:
- if the intensity in the ring has two main peaks, then our point belongs to an edge
- if the intensity in the ring has three or more major peaks, our point belongs to a corner
- else, our point belongs to background.
Left: The intensity of the pixels in the ring as a function of their angle in the ring. Right: The corresponding persistence diagram.
Let
We then vary the intensity
In the example above, the persistence diagram shows that 4 CCs have a significant lifetime. We then apply the classification rule and deduce that the point of interest is located on a corner (4 major intensity peaks).
Intuition of persistence diagrams
In the ring, consider the mapping angle --> intensity
as a mountain relief, where the angle is the horizontal position and the intensity is the altitude.
Fill this landscape with water until the highest mountain is covered up. Then, slowly empty the water and keep track of two events:
- The
birth
of a mountain: the water level when it first emerges. - The
death
of a mountain: the water level when it merges with another moutain (when the level becomes too low to separate the two islands).
We plot these two events in the persistence diagram, where each mountain is graphically representation as a point [birth, death]
.
Intuitively, during the water descent, noisy peaks will emerge and quickly be merged with a higher peak: they have a small persistence. On the contrary, major peaks are characterized by a longer persistence.
Therefore, noisy peaks end up close to the diagonal, while major peaks lay further away from it.