Face tracking based on particle filter
Project description
Particle Filter Toolbox
Particle Filter for face tracking in video sequences.
This is a Python framework implemented for perfoming face tracking with particle filter algorithms. It cointains Sequential Importance Sampling filter, Sequential Importance Resampling filter, Generic Particle Filter and Auxiliary Particle Filter algorithms. Besides it suports differents options for model specifications and filtering.
For model specifications it provides three state space models and two observation models (HSV color- based and Local Binary Patterns (LBP) based). Among filtering options it presents diverse resampling and estimation methods.
It also provides three face detector algorithms to be used in the initialization step of particle filter algorithms. These detectors are Viola and Jones (VJ), Single Shot Detector (SSD) and Histogram of Oriented Gradient (HOG).
Videos for testing face tracking can be loaded from disk or recorded from
webcam. Resulting videos can be store on disk too. Users can also select
to save estimation track and plot precision and recall metrics if the
ground truth of the tested video sequence are available. Besides,
users can define the number of algorithm runs on the same video sequence.
The idea of this tool is to provide comfortable handling and analysis of the particle filter algorithms and their parameters, as well as the evaluation of the face tracking for different video inputs. In this way, it allows any user, regardless of the level of knowledge on the subject, to easily use these tools and quickly compare their results.
Installation
Via PyPI
The package is hosted on PyPI, so the most easy installation is using pip:
pip install pftracker
Note: The pftracker package is dependent on dlib for face dectection with HOG classifier. dlib package could be hard to install because it requires cmake and other C++ tools dependent on the operation system. The only version of dlib that has been previously compiled to a Built Distribution (.whl file), is for Python 3.6 on Windows 10. So, it is strongly recommend to install a virtual environment with this characteristics if you want to avoid the hard dlib installation.
Via Github
You also can obtain the code by getting it from the GitHub repository:
https://github.com/bdager/pftracker
For this you can do:
cd <directory you want to install to>
git clone http://github.com/bdager/pftracker
python setup.py install
Note
In the GitHub repository there is a file trackUI.py, this file runs the pftracker package as a graphical interface. Once you have the pftracker installed and the trackUI.py, you can run the graphical interface since the command prompt, a python virtual environment or shell by:
[python interpreter] trackUI.py
Requirements
This graphical interface uses NumPy, OpenCV, PyQt5, imutils,
dlib, scikit-image, Matplotlib, FilterPy and Python 3.
Example
First construct the object and defined input video, filter parameters and target model if you want different options than the default ones.
from pftracker.track import Track
pf = Track(video="pftracker\input\Aaron_Guiel\Aaron_Guiel5.avi")
Note: To perform face tracking on webcam video just run: pf = Track()
Then run the algorithm with the previous definitions and specify the number of algorihm iterations and ground truth file is you want to calculate precision and recall error metrics. Also specify errorFile, saveTrackFile and saveVideo for saving error, estimates and resulting video files.
pf.run(iterations=2,
gt="pftracker\input\Aaron_Guiel\Aaron_Guiel5.labeled_faces.txt")
Note that if you want to specify a file for saving error you should provide the ground truth file too.
After that you are going to see the face tracking performing over the selected input video.
If you want to plot the precision and recall metrics per frame (and per iteration in case of you have more than one) and you provided the ground truth file previously, then you can run:
pf.plotError()
See pftracker documentation for more details on http://pftracker.readthedocs.org
Useful links
Source code: https://github.com/bdager/pftracker
Documentation: http://pftracker.readthedocs.org
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pftracker-0.0.2.tar.gz
.
File metadata
- Download URL: pftracker-0.0.2.tar.gz
- Upload date:
- Size: 10.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.6.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1d4c58cac5b9808638e4f4c65619b3cddb840a9516128960293d77afdd1eac4 |
|
MD5 | 574b26646cd7f2aea6433ca0cde26160 |
|
BLAKE2b-256 | e0e08a4623fb8c363cdef2c3664bb7612df18be82d729f6c81960660eeffaa3e |
File details
Details for the file pftracker-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: pftracker-0.0.2-py3-none-any.whl
- Upload date:
- Size: 10.5 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.6.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 77183133f3993d50a806ef34ad1f9db46008e31801d8dd3222a0520fad50ca81 |
|
MD5 | 3ea17bfb89a2c949c6b412b7e37df3d4 |
|
BLAKE2b-256 | 36c877fe369eeafb0dd90a1e44a5082811d1a36549c9f138566dfea73ee8b9e4 |