AccumulateStat.h

Go to the documentation of this file.
00001 /*
00002 This file is part of LIA_RAL which is a set of software based on ALIZE
00003 toolkit for speaker recognition. ALIZE toolkit is required to use LIA_RAL.
00004 
00005 LIA_RAL project is a development project was initiated by the computer
00006 science laboratory of Avignon / France (Laboratoire Informatique d'Avignon -
00007 LIA) [http://lia.univ-avignon.fr <http://lia.univ-avignon.fr/>]. Then it
00008 was supported by two national projects of the French Research Ministry:
00009         - TECHNOLANGUE program [http://www.technolangue.net]
00010         - MISTRAL program [http://mistral.univ-avignon.fr]
00011 
00012 LIA_RAL is free software: you can redistribute it and/or modify
00013 it under the terms of the GNU Lesser General Public License as
00014 published by the Free Software Foundation, either version 3 of
00015 the License, or any later version.
00016 
00017 LIA_RAL is distributed in the hope that it will be useful,
00018 but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00020 GNU Lesser General Public License for more details.
00021 
00022 You should have received a copy of the GNU Lesser General Public
00023 License along with LIA_RAL.
00024 If not, see [http://www.gnu.org/licenses/].
00025 
00026 The LIA team as well as the LIA_RAL project team wants to highlight the
00027 limits of voice authentication in a forensic context.
00028 The "Person Authentification by Voice: A Need of Caution" paper
00029 proposes a good overview of this point (cf. "Person
00030 Authentification by Voice: A Need of Caution", Bonastre J.F.,
00031 Bimbot F., Boe L.J., Campbell J.P., Douglas D.A., Magrin-
00032 chagnolleau I., Eurospeech 2003, Genova].
00033 The conclusion of the paper of the paper is proposed bellow:
00034 [Currently, it is not possible to completely determine whether the
00035 similarity between two recordings is due to the speaker or to other
00036 factors, especially when: (a) the speaker does not cooperate, (b) there
00037 is no control over recording equipment, (c) recording conditions are not
00038 known, (d) one does not know whether the voice was disguised and, to a
00039 lesser extent, (e) the linguistic content of the message is not
00040 controlled. Caution and judgment must be exercised when applying speaker
00041 recognition techniques, whether human or automatic, to account for these
00042 uncontrolled factors. Under more constrained or calibrated situations,
00043 or as an aid for investigative purposes, judicious application of these
00044 techniques may be suitable, provided they are not considered as infallible.
00045 At the present time, there is no scientific process that enables one to
00046 uniquely characterize a persones voice or to identify with absolute
00047 certainty an individual from his or her voice.]
00048 
00049 Copyright (C) 2004-2010
00050 Laboratoire d'informatique d'Avignon [http://lia.univ-avignon.fr]
00051 LIA_RAL admin [alize@univ-avignon.fr]
00052 Jean-Francois Bonastre [jean-francois.bonastre@univ-avignon.fr]
00053 */
00054 
00055 #if !defined(ALIZE_AccumulateStat_h)
00056 #define ALIZE_AccumulateStat_h
00057 
00058 #if defined(_WIN32)
00059 #if defined(LIA_SPKTOOLS_EXPORTS)
00060 #define LIA_SPKTOOLS_API __declspec(dllexport)
00061 #else
00062 #define LIA_SPKTOOLS_API __declspec(dllimport)
00063 #endif
00064 #else
00065 #define LIA_SPKTOOLS_API
00066 #endif
00067 
00068 #include <alize.h>
00069 #include "liatools.h"
00070 using namespace alize;
00071 using namespace std;
00072 
00073 
00074 //-------------------------------------------------------------------------
00075 //-- Accumulate the log likelihood for the selected frames and a given llk statistic accumulator
00076 LIA_SPKTOOLS_API void accumulateStatLLK(StatServer &ss,FeatureServer &fs,MixtureStat &llkAcc, unsigned long idxBeginFrame,unsigned long nbFrames,
00077                        Config &config);  
00078 // one a Segment
00079 LIA_SPKTOOLS_API void accumulateStatLLK(StatServer &ss,FeatureServer &fs,MixtureStat &llkAcc,Seg* seg,Config &config);
00080 // One on Cluster
00081 LIA_SPKTOOLS_API void accumulateStatLLK(StatServer &ss,FeatureServer &fs,MixtureStat &llkAcc,SegCluster &selectedSegments,Config &config);
00082 
00083 //-------------------------------------------------------------------------
00084 //-- Accumulate the log likelihood for the selected frames and a given llk statistic accumulator
00085 LIA_SPKTOOLS_API void accumulateStatLLK(StatServer &ss,FeatureServer &fs,MixtureStat &llkAcc, unsigned long idxBeginFrame,unsigned long nbFrames,double &weight,
00086                        Config &config);  
00087 // one a Segment
00088 LIA_SPKTOOLS_API void accumulateStatLLK(StatServer &ss,FeatureServer &fs,MixtureStat &llkAcc,Seg* seg,double &weight,Config &config);
00089 // One on Cluster
00090 LIA_SPKTOOLS_API void accumulateStatLLK(StatServer &ss,FeatureServer &fs,MixtureStat &llkAcc,SegCluster &selectedSegments,double &weight,Config &config);
00091 
00092 //-------------------------------------------------------------------------
00093 //-- accumulate the statistic for EM, using a current accumulator 
00094 //-- CAUTION: THE ACCUMULATOR SHOULD BE INITIALIZED (resetEM) BEFORE THE CALL
00095 //--          A GET CALL SHOULD BE DONE AFTER THE CALL  
00096 // One a part of the feature stream
00097 LIA_SPKTOOLS_API double accumulateStatEM(StatServer &ss,FeatureServer &fs,MixtureStat &emAcc,
00098                                unsigned long idxBeginFrame,unsigned long nbFrames,Config &config);
00099 // one a Segment
00100 LIA_SPKTOOLS_API double accumulateStatEM(StatServer &ss,FeatureServer &fs,MixtureStat &emAcc,Seg* seg,Config &config);
00101 // One on Cluster
00102 LIA_SPKTOOLS_API double accumulateStatEM(StatServer &ss,FeatureServer &fs,MixtureStat &emAcc,SegCluster &selectedSegments,Config &config);
00103 
00104 // This is internal, you should only call accumulateStatEM
00105 // Threaded version
00106 #if defined(THREAD)
00107 LIA_SPKTOOLS_API double accumulateStatEMThreaded(StatServer &ss,FeatureServer &fs,MixtureStat &emAcc,SegCluster &selectedSegments,Config &config);
00108 #endif
00109 // UnThreaded version
00110 LIA_SPKTOOLS_API double accumulateStatEMUnThreaded(StatServer &ss,FeatureServer &fs,MixtureStat &emAcc,SegCluster &selectedSegments,Config &config);
00111 // Weighted Version
00112 LIA_SPKTOOLS_API double accumulateStatEM(StatServer &ss,FeatureServer &fs,MixtureStat &emAcc,SegCluster &selectedSegments,double & weight, Config &config);
00113 
00114 /* Alex Preti things
00115 double accumulateStatEM(StatServer &ss,FeatureServer &fs,MixtureStat &emAcc,
00116                                unsigned long idxBeginFrame,unsigned long nbFrames,double &weight,Config &config);
00117 // one a Segment
00118 double accumulateStatEM(StatServer &ss,FeatureServer &fs,MixtureStat &emAcc,Seg* seg,double &weight,Config &config);
00119 // One on Cluster
00120 double accumulateStatEM(StatServer &ss,FeatureServer &fs,MixtureStat &emAcc,SegCluster &selectedSegments,double &weight,Config &config);*/
00121 
00122 //-------------------------------------------------------------------------
00123 //-- accumulate the statistic on the frames (mean and cov), using a current 
00124 //-- FrameAcc
00125 //-- CAUTION: THE ACCUMULATOR SHOULD BE INITIALIZED BEFORE THE FIRST CALL
00126 //--          A COMPUTE_ALL AND A GET CALL SHOULD BE DONE AFTER THE CALLS  
00127 LIA_SPKTOOLS_API void accumulateStatFrame(FrameAcc & frameAcc,FeatureServer &fs,
00128                          unsigned long idxBeginFrame,unsigned long nbFrames,Config &config);
00129 // one a Segment
00130 LIA_SPKTOOLS_API void accumulateStatFrame(FrameAcc & frameAcc,FeatureServer &fs,Seg* seg,Config &config);
00131 // One on Cluster
00132 LIA_SPKTOOLS_API void accumulateStatFrame(FrameAcc &frameAcc,FeatureServer &fs,SegCluster &selectedSegments,Config &config);
00133 
00134 
00135 //-------------------------------------------------------------------------
00136 //-- accumulate the statistic on the frames raw distribution of each coefficient using a current 
00137 //-- CAUTION: 
00138 //         *THE ACCUMULATOR SHOULD BE INITIALIZED BEFORE THE FIRST CALL
00139 //          initHistoTab()
00140 //         *THE HISTO SHOULD BE COMPUTED BEFORE TO USE THE STAT
00141 //          computeHistoTab()
00142 //         *The histoTab should be freezen after use
00143 //          freezeHistoTab();
00144 //      
00145 // Init the Histo array (one by coeff)
00146 LIA_SPKTOOLS_API double areaHisto(const Histo & histo,unsigned long bin);
00147 LIA_SPKTOOLS_API double areaHisto(const Histo & histo,unsigned long bin, double nonObserved);
00148 LIA_SPKTOOLS_API double linearInterpolation(double val,double lower,double higher);
00149 LIA_SPKTOOLS_API void freezeHistoTab(Histo* &histoT);
00150 LIA_SPKTOOLS_API void initHistoTab(Histo* &histoT,unsigned long size, unsigned long nbBins);
00151 //void resetHistoTab(Histo* histoT,unsigned long size);
00152 LIA_SPKTOOLS_API void computeHistoTab(Histo* histoT,unsigned long size);
00153 LIA_SPKTOOLS_API void accumulateHistoFrame(Histo  *histoT,FeatureServer &fs,
00154                           unsigned long idxBeginFrame,unsigned long nbFrames,Config &config);
00155 // one a Segment
00156 LIA_SPKTOOLS_API void accumulateHistoFrame(Histo *histoT,FeatureServer &fs,Seg* seg,Config &config);
00157 // One on Cluster
00158 LIA_SPKTOOLS_API void accumulateHistoFrame(Histo *histoT,FeatureServer &fs,SegCluster &selectedSegments,Config &config);
00159 
00160 
00161 #endif //!defined(ALIZE_AccumulateStat_h)