demos

PYTHON Demos

This repository contains several python3 scripts demonstrations. They all have MIT license.

How to run

All scripts from the demos are available in the demos folder.

One can run easily all demos using the demo.py script in the root folder.

The list of available demos is given by:

python3 demo.py -l

To run the demo you can execute:

python3 demo.py [demo_name]

To print the list of dependencies for a given demo you can run:

python3 demo.py -d [demo_name]

you can store it in a text file and install it with pip.

Demos

Total Variation on webcam

In this demonstration we perform online Total Variation regularization on the video captured on the webcam.

Screenshot:

screenshot

Shortcuts:

Dependencies:

This demo uses opencv-python for webcam access and visualization and prox_tv for total variation proximal operator.

Real time audio spectrum

In this demonstration we plot in real time the audio spectrum (and the time frequency analysis) of the microphone.

screenshot

Shortcuts:

Dependencies:

This demo uses pygame for visualization and PyAudio for microphone recording.

Real time 2D FFT of webcam

In this demonstration we perform online 2D fft of a webcam input. Both the absolute value and the log of the absolute values are displayed and the 0 frequency is centered on the window (fftshift).

Screenshot:

screenshot

Shortcuts:

Dependencies:

This demo uses opencv-python for webcam access and visualization.

Real time 2D filtering of webcam

In this demonstration we perform online 2D filtering of a webcam input. Both the original, filtered and FFT of the filtered video with 0 frequency centered on the window (fftshift) are displayed.

Screenshot:

screenshot

Shortcuts:

Dependencies:

This demo uses opencv-python for webcam access and visualization.

2D classification demo

In this demonstration we illustrate the decision function and update of 2D classifiers when adding training samples from negative or positive classes. We provide decision functions for Linear and Gaussian Kernel SVMs.

screenshot

Dependencies:

This demo uses pygame for visualization and Scikit-learn for classification.

2D Dictionary learning demo

In this demonstration we illustrate dictionary learning on 2D data. The user cla click on the window to add samples (left click) and to remove samples (right click). The dictionary is learned in real time and the atoms are displayed.

screenshot

Dependencies:

This demo uses pygame for visualization and Scikit-learn for classification.

Style Transfer Demo

In this demonstration we illustrate style transfer on image taken from the webcam. You can choose among several styles.

The implementation for style transfer has been shamelessly copied from Pytorch_WCT that is an implementation of the paper Universal Style Transfer via Feature Transforms.

Computational time for transfer takes a few seconds on a laptop with no GPU and freeze the windows.

screenshot

Dependencies:

This demo uses opencv-python for webcam access and visualization and torch/torchvision as deep learning framework.

Discrete Optimal Transport demo

In this demonstration we plot in real time the solution of optimal transport (OT) between discrete distributions. The samples from source can be added by a left clock and samples from target distribution can be added by a right click.

screenshot

Shortcuts:

Dependencies:

This demo uses pygame for visualization and POT for computing the solution of the OT problem.

Face detection

In this demo we use a Haar Cascade Classifier to detect faces and show the areas where a face was detected. We use the default face classifier from OpenCV that detect only frontal faces.

screenshot

This demo uses opencv-python for webcam access and visualization.

Installing dependencies

There is an important number of dependencies to run all the demos. Each script has its own dependencies. To print the list of dependencies for a given demo you can run:

python3 demo.py -d [demo_name]