titu1994 / Neural-Style-Transfer

Keras Implementation of Neural Style Transfer from the paper "A Neural Algorithm of Artistic Style" (http://arxiv.org/abs/1508.06576) in Keras 2.0+
Apache License 2.0
2.26k stars 481 forks source link

Trying to under stand the loss functions #53

Closed csinpi closed 5 years ago

csinpi commented 5 years ago

https://github.com/titu1994/Neural-Style-Transfer/blob/536a96df79dc6c155eb84ded3bd71cdd21553d1e/INetwork.py#L513

Between these two lines, sl is only decided by the last style image? Am I understanding it correctly?

titu1994 commented 5 years ago

J is indexing each of the available style layers. Sl1 and Sl2 compute the loss separately for each of the J style images passed, and then sl computes the difference between each of these (sl1_j, sl2_j) pairs, and these differences are summed up using geometric weighing of the loss terms based on depth of the network.

csinpi commented 5 years ago

That makes sense. For some reason I thought Line 518 was outside the for-loop started in Line 513. Thanks for the prompt reply.

titu1994 commented 5 years ago

Glad I could help!