dcgan.torch icon indicating copy to clipboard operation
dcgan.torch copied to clipboard

net:evaluate() unexpected behaviour

Open Guim3 opened this issue 8 years ago • 3 comments

After commit e0578020ecd5c1b5df6356e7059b2b46670ae5a8, net:evaluate() mode no longer displays correct images, but noise.

I have two trained nets, one before and another after this commit. In net:training() mode they both have a normal behaviour, but in net:evaluate() the first one correctly generates the same images as in training mode, but the later just outputs noise.

Here's an example of an MNIST trained model after the commit. Left one is on training mode, right one is on evaluate.

1

After some tests I can say that it is not the way nets are loaded - a network trained before the commit but loaded after it works correctly.

Also, I have run some batch iterations before saving the model in order to update running_mean and running_var from BN layers.

Guim3 avatar Jul 14 '16 18:07 Guim3

I have found the origin of the problem.

https://github.com/soumith/dcgan.torch/blob/e0578020ecd5c1b5df6356e7059b2b46670ae5a8/main.lua#L240

Generator is saved as netG:clearState(). If saved without clearState(), images on evaluation mode are generated properly.

Guim3 avatar Jul 14 '16 21:07 Guim3

@szagoruyko does clearState clear running_mean / running_std? I dont think so right...wonder what's going on here.

soumith avatar Jul 27 '16 06:07 soumith

I trained a model for a couple of epochs and saved one with clearState and one without clearState, they both produce identical images (with the same seed). @Guim3 did you modify the code in any way? can you post the 2 models so that we can debug the issue?

szagoruyko avatar Jul 27 '16 08:07 szagoruyko