Skip to main content
. 2023 Jan 13;23(2):929. doi: 10.3390/s23020929
Algorithm 1 Face geometry representation using hierarchical shifted windows architecture
  • Input: 

    P = {px1,px2,,pxn} where pxn is the nth 4×4 patch of image x.

    E = learned linear embedding matrix.

    Epos = positional encoding matrix.

    MSA, SW-MSA = multiheaded self-attention and shifted window MSA.

    MLP = multi-layer perceptron

    LN = layer normalization

  • Output: 

    Face Representation Classification

  •  1:

    forpPdo                      ▹ For each patch

  •  2:

        p flatten(p)

  •  3:

        p[pf1E;pf2E;;pf48E]

  •  4:

        pp+Epos

  •  5:

    end for

  •  6:

    XP

  •  7:

    for block pair in transformer blocks do

  •  8:

        X← MSA(LN(X)) + X

  •  9:

        X← MLP(LN(X)) + X

  • 10:

       X← SW-MSA(LN(X)) + X

  • 11:

       X← MLP(LN(X)) + X

    If at block pair 1, 2, 11:

  • 12:

        for x1,1xM,NX do

  • 13:

            xm,n merge(x2m,2n,x2m+1,2n,x2m,2n+1,x2m+1,2n+1)

  • 14:

        end for

  • 15:

    end for