This repository contains several python3 scripts demonstrations. They all have MIT license.
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.
In this demonstration we perform online Total Variation regularization on the video captured on the webcam.
Screenshot:
Shortcuts:
- q : Quit demo
- s : Save screen to png
- s : Save screen to png
- Space : Do full image TV
- h : Do half image TV (screenshot)
- + : Make TV regularization stronger
- - : Make TV regularization weaker
- n : Add salt and pepper noise
- b : Make noise more aggressive
- , : Make noise less aggressive
Dependencies:
This demo uses opencv-python for webcam access and visualization and prox_tv for total variation proximal operator.
In this demonstration we plot in real time the audio spectrum (and the time frequency analysis) of the microphone.
Shortcuts:
- q or Esc : Quit demo
- Space : Pause/unpause demo
- r : Reset time
- + or N : Multiply nfft by 2 (zoom in to lower frequencies)
- - or n : Divide nfft by 2 (zoom out)
- W : Multiply time window size by 2
- w : Divide time window size by 2
- P/p : Change scale of power spectrum (up/down)
- S/s : Change scale of power spectrum (up/down)
Dependencies:
This demo uses pygame for visualization and PyAudio for microphone recording.
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.
- q : Quit demo
- left click : Add samples from red class
- right click : Add samples from blue class
- c : Clear training data
- Space : Show/hide decision function
- m : Change classifier (Linear/Gaussian SVM)
- Up : Make Gaussian Gamma parameter larger
- Down : Make Gaussian Gamma parameter smaller
- s : save screenshot
Dependencies:
This demo uses pygame for visualization and Scikit-learn for classification.
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.
- q : Quit demo
- p : Take picture/unfreeze webcam
- s : Switch target style
- Space : Apply selected style
- w : Save images to disk (folder out/)
- r : Run transfer for all styles and save to file (takes forever)
Dependencies:
This demo uses opencv-python for webcam access and visualization and torch/torchvision as deep learning framework.
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.
Shortcuts:
- q or Esc : Quit demo
- Space : Show/Hide the optimal transport matrix
- c : Clear all samples
- r : Activate/deactivate entropic regularization
- p or m : Increase or decrease regularization parameter
- t : Rotate the target distribution
- e : remove some samples so that they have equal number
- d : change the metric in OT loss
Dependencies:
This demo uses pygame for visualization and POT for computing the solution of the OT problem.
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.
- q : Quit demo
- s : Save screenshot
This demo uses opencv-python for webcam access and visualization.
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]