junyanz / CycleGAN

Software that can generate photos from paintings, turn horses into zebras, perform style transfer, and more.
Other
12.23k stars 1.93k forks source link

where does the code implement the averaging operation following the PatchGAN? #95

Open knaffe opened 6 years ago

knaffe commented 6 years ago

I have a question on the implement of PatchGAN. In the Section 3.2.2 of the paper, it said

We run this discriminator convolutationally across the image, averaging all responses to provide the ultimate output of D.

But I couldn't find anywhere to implement of this averaging operation? In the code, the D outputs the 30x30x1 feature map data, and the loss of D is calculated by the GANLoss function(MSE or BCE loss) with the 30x30x1 feature map. Where does the averaging operation? Maybe I miss something. Thank you !

junyanz commented 6 years ago

In the code, we first calculate the loss on the 30x30 map and then average the loss. @phillipi

mannoppilly commented 4 years ago

@knaffe Did you figure it out? I still dont understand how they average the (n, 1, 30, 30) output into a (n, 1) which can then be fed into a BCELoss function?