Skip to main content
. 2026 Jul 25;26(15):4728. doi: 10.3390/s26154728
Algorithm 5 Token-Level Multimodal Fusion for Skin Cancer Classification
  •   1:

    procedure Train/Infer(I,m,ed)

  •   2:

        fimg←EfficientNet(I)

  •   3:

        himgtokens←reshape(fimg,7×7patches)       ▹ 49 tokens, 128-dim each

  •   4:

        hmeta←MLPmeta(encodeMetadata(m))          ▹ 1 token, 32-dim

  •   5:

        hkgtokens←MLPkg(ed)                ▹ 5 tokens, 32-dim each

  •   6:

        hfused←CrossAttn(Qimg,K[meta,kg],V[meta,kg])         ▹ Token-level fusion

  •   7:

        z←ReLU(Wh1hfused+bh1)

  •   8:

        y^←softmax(Wcz+bc)

  •   9:

        return y^

  • 10:

    end procedure