class for running the Kalman filter for dynamic texture inference. More...
#include <DytexKalmanFilter.hpp>
Public Member Functions | |
| DytexKalmanFilter (Dytex &dt, int tau) | |
| Create an instance of a pre-computed Kalman Filter for a DT. | |
| void | loglike (const vector< Mat > &videos, Mat &lik, bool mahal=false) |
| compute log-likelihood of a set of videos using instantiated Kalman filter. | |
| double | loglike (const Mat &video, bool mahal=false) |
| compute log-likelihood of a video using instantiated Kalman filter. | |
Static Public Member Functions | |
| static void | loglike (const Dytex &dt, const vector< Mat > &videos, Mat &lik, bool mahal=false) |
| compute the log-likelihood of a set of videos for the given DT (no caching). | |
| static double | loglike (const Dytex &dt, const Mat &video, bool mahal=false) |
| compute the log-likelihood of a video for the given DT (no caching). | |
| static void | loglike_old (const Dytex &dt, const vector< Mat > &videos, Mat &lik, bool mahal=false) |
| old version of loglike. | |
| static void | dytex_kalman (Mat Y, Dytex dt, string di3opt, std::vector< Mat > &xt, Mat &Vt, Mat &Vt1, Mat &L) |
| conditional state inference using Kalman smoothing filter. | |
Public Attributes | |
| Mat | cache_Kt |
| cache for an instantiated Kalman filter: Kalman gain matrices [n x m x tau]. | |
| Mat | cache_detMt |
| cache for an instantiated Kalman filter: determinant term [1 x tau]. | |
| Mat | cache_invMt |
| cache for an instantiated Kalman filter: inverse covariance matrix [m x m x tau]. | |
| Dytex * | cache_dt |
| cache for an instantiated Kalman filter: DT reference (use a pointer). | |
Private Types | |
| enum | kf_mode { KF_CACHE, KF_COMPUTE_WITH_CACHE, KF_COMPUTE_WITHOUT_CACHE } |
mode for running loglike_internal. More... | |
Static Private Member Functions | |
| static void | loglike_internal (const Dytex &dt, const vector< Mat > *videos, Mat *lik, int cache_tau, Mat *cache_Kt, Mat *cache_detMt, Mat *cache_invMt, bool mahal, kf_mode kfmode) |
| internal function for calculating log-likelihood. | |
class for running the Kalman filter for dynamic texture inference.
There are two ways to use the class: 1) instantiate with a DT to create a Kalman filter where most matrices are pre-computed. The KF instance can then be used for fast inference; 2) use the static functions to compute inference on a DT. In general, the first method should be used if the DT will not change and the KF will be used many times. The second method should be used if inference is required only once before the DT changes.
Definition at line 26 of file DytexKalmanFilter.hpp.
enum DytexKalmanFilter::kf_mode [private] |
mode for running loglike_internal.
| KF_CACHE |
cache filter matrices. |
| KF_COMPUTE_WITH_CACHE |
compute LL from cache. |
| KF_COMPUTE_WITHOUT_CACHE |
compute LL w/o using cache. |
Definition at line 86 of file DytexKalmanFilter.hpp.
| DytexKalmanFilter::DytexKalmanFilter | ( | Dytex & | dt, | |
| int | tau | |||
| ) |
Create an instance of a pre-computed Kalman Filter for a DT.
| dt | the Dytex | |
| tau | the maximum video length that will be used |
Definition at line 47 of file DytexKalmanFilter.cpp.
| void DytexKalmanFilter::dytex_kalman | ( | Mat | Y2, | |
| Dytex | dt, | |||
| string | opt, | |||
| std::vector< Mat > & | xt, | |||
| Mat & | Vt, | |||
| Mat & | Vt1, | |||
| Mat & | L | |||
| ) | [static] |
conditional state inference using Kalman smoothing filter.
| Y | cell array of video in format Y(:,i,t) w/ mean subtracted | |
| dt | dynamic texture. | |
| di3opt | explicitly subtract mean or not. | |
| xt | output: state expectation: E(x_t|y_1,...y_tau); (cell array entries for each sequence Y) | |
| Vt | state covariance: cov(x_t|y_1,...,y_tau); (3-dim matrix) | |
| Vt1 | state covariance: cov(x_t,x_{t-1}|y_1,...,y_tau); (3-dim matrix) | |
| L | vector of log-likelihoods of videos in Y |
Definition at line 442 of file DytexKalmanFilter.cpp.
| double DytexKalmanFilter::loglike | ( | const Dytex & | dt, | |
| const Mat & | video, | |||
| bool | mahal = false | |||
| ) | [static] |
compute the log-likelihood of a video for the given DT (no caching).
The Kalman filter matrices are not cached for later.
| dt | the Dytex | |
| video | the Mat video | |
| mahal | if true, calculate the Mahalanobis distance. Otherwise, calculate the log-likelihood. |
Definition at line 207 of file DytexKalmanFilter.cpp.
| void DytexKalmanFilter::loglike | ( | const Dytex & | dt, | |
| const vector< Mat > & | videos, | |||
| Mat & | lik, | |||
| bool | mahal = false | |||
| ) | [static] |
compute the log-likelihood of a set of videos for the given DT (no caching).
The Kalman filter matrices are not cached for later.
| dt | the Dytex | |
| videos | the set of Mat videos | |
| lik | computed likelihood for each video | |
| mahal | if true, calculate the Mahalanobis distance. Otherwise, calculate the log-likelihood. |
Definition at line 214 of file DytexKalmanFilter.cpp.
| double DytexKalmanFilter::loglike | ( | const Mat & | video, | |
| bool | mahal = false | |||
| ) |
compute log-likelihood of a video using instantiated Kalman filter.
| video | the Mat video | |
| mahal | if true, calculate the Mahalanobis distance. Otherwise, calculate the log-likelihood. |
Definition at line 67 of file DytexKalmanFilter.cpp.
| void DytexKalmanFilter::loglike | ( | const vector< Mat > & | videos, | |
| Mat & | lik, | |||
| bool | mahal = false | |||
| ) |
compute log-likelihood of a set of videos using instantiated Kalman filter.
| videos | the set of Mat videos | |
| lik | computed likelihood for each video | |
| mahal | if true, calculate the Mahalanobis distance. Otherwise, calculate the log-likelihood. |
Definition at line 63 of file DytexKalmanFilter.cpp.
| void DytexKalmanFilter::loglike_internal | ( | const Dytex & | dt, | |
| const vector< Mat > * | videos, | |||
| Mat * | lik, | |||
| int | cache_tau, | |||
| Mat * | cache_Kt, | |||
| Mat * | cache_detMt, | |||
| Mat * | cache_invMt, | |||
| bool | mahal, | |||
| kf_mode | kfmode | |||
| ) | [static, private] |
internal function for calculating log-likelihood.
do one of the following: 1) compute log-likelihood of videos under dt; 2) cache kalman filter matrices for a dt; 3) compute log-likelihood using kalman filter cache. this follows dytex_kalmanff_ll.m. note: it computes the inverse directly, so not for big videos. this is faster when the videos are small.
| dt | the Dytex | |
| videos | set of Mat videos | |
| lik | resulting log-likelihood (1 x size of videos) | |
| cache_tau | tau to use for caching | |
| cache_Kt | pointer to Kt cache matrix | |
| cache_detMt | pointer to detMt cache | |
| cache_invMt | pointer to invMt cache | |
| mahal | if true, compute Mahalanobis distance instead of LL | |
| kfmode | mode for running the function |
Definition at line 229 of file DytexKalmanFilter.cpp.
cache for an instantiated Kalman filter: determinant term [1 x tau].
Definition at line 32 of file DytexKalmanFilter.hpp.
cache for an instantiated Kalman filter: DT reference (use a pointer).
Definition at line 34 of file DytexKalmanFilter.hpp.
cache for an instantiated Kalman filter: inverse covariance matrix [m x m x tau].
Definition at line 33 of file DytexKalmanFilter.hpp.
cache for an instantiated Kalman filter: Kalman gain matrices [n x m x tau].
Definition at line 31 of file DytexKalmanFilter.hpp.
1.6.1