Search code examples
cntkdcgan

CNTK ImageDeserializer and DCGAN sample


I'm reworking this sample https://github.com/Microsoft/CNTK/blob/master/Tutorials/CNTK_206B_DCGAN.ipynb to work with png MNIST files (rather than flat 1d array image input that tutorial uses). I use ImageDeserializer (and map file to load the data):

def create_mb_source(map_file, image_dims, num_classes, randomize=True):
transforms = [
    xforms.scale(width=image_dims[2], height=image_dims[1], channels=image_dims[0], interpolations='linear')]
return MinibatchSource(ImageDeserializer(map_file, StreamDefs(
    features=StreamDef(field='image', transforms=transforms),
    labels=StreamDef(field='label', shape=num_classes))),
                       randomize=randomize)

I changed the input output of to Discriminator to expect 28x28 image (and output of Generator). See the code here: https://github.com/olgaliak/cntk-cyclegan/blob/master/trainDCGan.py

the problem is that trainDCGan.py is generating noise now. Appreciate your help!


Solution

  • The issue got solved once I 1) Switched to used 3 channels in ImageDeserializer 2) Changed network architecture to use 2d strides\kernels instead 1d. This commit highlights the changes that made things working.