Precomputation of cached matrices in IVectorMachine can't be disabled
Created by: laurentes
[originally posted on the bob-devel mailing list]
Creating an IVectorMachine object using an externally-computed T matrix is very slow. With a 400x2048x38 TVM in a 250mb binary file, and its matching UBM in another binary file, loading the UBM in a GMMMachine is fine (this takes less than a second). But loading the TVM into a new IVectorMachine takes >8 hours using the 2.0 C++ API.
The IVectorMachine class is doing some premature precomputation. For example, just calling the constructor with the GMMMachine takes a very long time, precomputing arrays that will have to be discarded since the constructor doesn't even know the T matrix yet.
Currently, it is not possible to create an empty IVectorMachine() and then set the UBM and T matrix, because of the assertion in the setT method that requires the dimension to match the uninitialized m_t.
A suggestion would be that IVectorMachine's precomputation policy change to precompute-on-demand. That is, during initialization or after any parameter change, just set a flag indicating that precomputation is required; but do not actually do the precomputation until forward() is called.