Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

image_style_transfer中,格拉姆矩阵的疑惑 #16

Open
charmpeng opened this issue Jul 5, 2018 · 0 comments
Open

image_style_transfer中,格拉姆矩阵的疑惑 #16

charmpeng opened this issue Jul 5, 2018 · 0 comments

Comments

@charmpeng
Copy link

charmpeng commented Jul 5, 2018

def _single_style_loss(self, a, g):
        ###############################
        ## TO DO
        N = a.shape[3]
        M = a.shape[1] * a.shape[2]
        gram_a = self._gram_matrix(a, N, M)
        gram_g = self._gram_matrix(g, N, M)
        return tf.reduce_sum((gram_g - gram_a) ** 2) / (4 * (N ** 2) * (M ** 2))

在这里,a是style image的feature representation, g是generated image的feature representation。在计算generated image的格拉姆矩阵时候,调用了 self._gram_matrix(g, N, M)函数,但这里的输入N和M都是style image的数据。这样计算没有问题么?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant