\[z^{(1)} \leftarrow G (f_{\theta}(P^{(1)}(x))), \\
z^{(2)} \leftarrow f_{\theta}(G(P^{(1)}(x))); \\
\[\mu^{(1)}, y^{(1)} \leftarrow \text{KMeans}(\{z_i^{(1)}[p]: i \in [n], p \in [HW] \}), \\
\mu^{(2)}, y^{(2)} \leftarrow \text{KMeans}(\{z_i^{(2)}[p]: i \in [n], p \in [HW] \}); \\
我们希望特征
\(z[p]\)
靠近所指定的类别, 即需要关于
\(\theta\)
最小化如下损失:
\[\mathcal{L}_{within} = \sum_{i, p} \mathcal{L}_{clust}(z_{i}^{(1)}[p], y_{i}^{(1)}[p], \mu^{(1)}) + \mathcal{L}_{clust}(z_{i}^{(2)}[p], y_{i}^{(2)}[p], \mu^{(2)}),
\]
其中
\[\mathcal{L}_{clust}(z_i[p], y_i[p], \mu) := -\log \frac{\exp(-d(z_i[p], \mu_{ip}))}{\sum_{k} \exp(-d(z_i[p], \mu_{k}))},
\]
以及
\(d(\cdot, \cdot)\)
为 cosine similarity;
但是注意到, 即便
\(z\)
中的各个元素都靠近了各自的聚类中心, 我们没法保证聚类是按照 '语义' 来分割的, 为此, 我们引入 Invariance 和 Equivariance:
\[\mathcal{L}_{cross} = \sum_{i, p} \mathcal{L}_{clust}(z_{i}^{(1)}[p], y_{i}^{(2)}[p], \mu^{(2)}) + \mathcal{L}_{clust}(z_{i}^{(2)}[p], y_{i}^{(1)}[p], \mu^{(1)}),
\]
即采用了 photometric 和 geometric 变换后的特征保持语义分割上的一致.
[
official
]