unibas-gravis / scalismo-faces

Scalable Image Analysis and Shape Modelling: Module to work with 2d images, with a focus on face images
Apache License 2.0
118 stars 27 forks source link

Masking Models #95

Closed andreas-schneider closed 6 years ago

andreas-schneider commented 6 years ago

Compute the marginal of a MoMo on a set of points.

How to create a masked model:

Andreas-Forster commented 6 years ago

I think the functionality is useful for some applications. But the interpretability of the model is somehow changed. An orthogonal basis will most probably no longer be orthogonal if we just "mask" the model. Could this be problematic for some of the model operations? If yes, can we find a way to communicate this to our software users? Having not thought through all implications of this model transformation I find it dangerous to provide this in our core library. But maybe my concerns can be disproven.

andreas-schneider commented 6 years ago

Yes orthogonality is lost:

    def orthognality[A](gp: PancakeDLRGP[_3D, UnstructuredPointsDomain[_3D], A]) = {
      def getCol(c: Int) = gp.basisMatrix(::, c)
      getCol(0).dot(getCol(1))
    }
    println(orthognality(model.neutralModel.shape))
    println(orthognality(maskedMoMo.neutralModel.shape))

Output:

original model: 7.235728834674438E-11 masked model: 0.021161337168098197

Do you think that orthogonality is a necessary requirement for the MoMo or is it only required for the DiscreteLowRankGaussianProcess?

Andreas-Forster commented 6 years ago

We should check the interface of momo if any function assumes orthogonality. For example, is def project(sample: VertexColorMesh3D) still well defined?

Ghazi-Bouabene commented 6 years ago

For masking the shape, the same functionality exists in Scalismo by using the marginal method of DLRGP. I saw that the PancakeDLRGP also implements this functionality. This should correctly preserve the same basis for the "masked" model.

andreas-schneider commented 6 years ago

@Ghazi-Bouabene thanks! This makes the whole thing much simpler. I updated the PR accordingly.

Will the orthogonality issue be solved by using the marginal?

andreas-schneider commented 6 years ago

Integrated marginal into MoMo.