Esempio n. 1
0
 /// <summary>Creates an instance of the <code>ImageAutoencoder</code> class.</summary>
 /// <param name="encoder">The first part of the autoencoder.</param>
 /// <param name="decoder">The second part of the autoencoder.</param>
 /// <param name="codeSize">The size of the output of the encoder and of the input of the decoder.</param>
 public ImageAutoencoder(ConvolutionalNN encoder, DeConvolutionalNN decoder, int codeSize, bool createIO = true) : base(encoder, decoder, codeSize)
 {
     this.depth  = encoder.InputDepth;
     this.width  = encoder.InputWidth;
     this.height = encoder.InputHeight;
     if (createIO)
     {
         this.SetInputGetOutput(new Image(encoder.InputDepth, encoder.InputWidth, encoder.InputHeight));
     }
 }
Esempio n. 2
0
 /// <summary>Either creates a siamese or clones the given <code>DeConvolutionalNN</code> instance.</summary>
 /// <param name="original">The original instance to be created a siamese of or cloned.</param>
 /// <param name="siamese"><code>true</code> if a siamese is to be created, <code>false</code> if a clone is.</param>
 protected DeConvolutionalNN(DeConvolutionalNN original, bool siamese)
 {
     this.errorArray      = Backbone.CreateArray <float>(original.cnn.InputDepth * original.cnn.InputWidth * original.cnn.InputHeight);
     this.errorImage      = new Image(original.cnn.InputDepth, original.cnn.InputWidth, original.cnn.InputHeight);
     this.layersConnected = false;
     if (siamese)
     {
         this.firstPart = (FeedForwardNN)original.firstPart.CreateSiamese();
         this.a2i       = (ArrayToImage)original.a2i.CreateSiamese();
         this.cnn       = (PurelyConvolutionalNN)original.cnn.CreateSiamese();
         this.siameseID = original.SiameseID;
     }
     else
     {
         this.firstPart = (FeedForwardNN)original.firstPart.Clone();
         this.a2i       = (ArrayToImage)original.a2i.Clone();
         this.cnn       = (PurelyConvolutionalNN)original.cnn.Clone();
         this.siameseID = new object();
     }
 }