CNTK icon indicating copy to clipboard operation
CNTK copied to clipboard

Problems with the output from autoencoder

Open L-Ramos opened this issue 9 years ago • 2 comments

I'm using the autoencoder example from: https://github.com/Microsoft/CNTK/blob/master/Examples/Image/GettingStarted/07_Deconvolution_BS.cntk

In this example the features are scaled (featScale = 1/256). I did not scale my features, just used them with the conv,pool,deconv and unpool layers and saved the output from the model.

While my feature values range from -1000 to 2000, with variations per sample, the results from the model are not related at all to those values. Instead I get values ta are very small and totally incomparable to my input features (decimal values like -0.0005). My rmse is incredibly high due this difference from input and output.

What am I doing wrong?

` BrainScriptNetworkBuilder = { imageShape = 102:102:19:1 labelDim = 2

    model = inputFeatures => {
        

		
		conv1=ConvolutionalLayer{16, (7:7:7),activation=ReLU}(inputFeatures)  
		pool1=MaxPoolingLayer {(2:2:2), stride = (1:1:1)}(conv1)
        conv2=ConvolutionalLayer {16,(5:5:5),activation=ReLU}(pool1)
		pool2=MaxPoolingLayer {(2:2:2), stride = (1:1:1)}(conv2) 
		conv3=ConvolutionalLayer {32, (3:3:3),activation=ReLU}(pool2)
		pool3=MaxPoolingLayer {(2:2:2), stride = (2:2:2)}(conv3)
		
		unpool3 = MaxUnpoolingLayer {(2:2:2), stride=(2:2:2)}(pool3, conv3)
		deconv3 = DeconvLayer {16, (3:3:3),32}(unpool3)
		unpool2 = MaxUnpoolingLayer {(2:2:2), stride=(1:1:1)}(deconv3,conv2)
		deconv2 = DeconvLayer {16, (5:5:5),16}(unpool2)
		unpool1 = MaxUnpoolingLayer {(2:2:2), stride=(1:1:1)}(deconv2,conv1)
		deconv1=DeconvLayer {1, (7:7:7),16}(unpool1)
		
    }.deconv1

  
    features = Input {imageShape}
 
	

    z = model (features)


    err = z - features
    sqErr = ElementTimes(err, err)
    mse = ReduceMean(sqErr)
    rmse = Sqrt(mse)

    featureNodes = (features)
    #labelNodes      = (label)
    criterionNodes = (rmse)
    evaluationNodes = (rmse)  
    outputNodes = (z)
}`

L-Ramos avatar Aug 18 '17 14:08 L-Ramos

Please try normalizing your input values to positive [0, 1] range. You can easily transform decoded output back to [-1000, 2000] if required.

pkranen avatar Aug 18 '17 14:08 pkranen

I normalized my output and now I have more reasonable numbers to work with. With values ranging from -1000 to 3000 the output from my autoencoder were numbers e^25, which would take a lot of time to normalize. Thanks for the answer!

L-Ramos avatar Aug 22 '17 08:08 L-Ramos