Ejemplo 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));
     }
 }
Ejemplo n.º 2
0
 /// <summary>Either creates a siamese of the given <code>ConvolutionalNN</code> instance or clones it.</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> otherwise.</param>
 protected ConvolutionalNN(ConvolutionalNN original, bool siamese)
 {
     this.errorArray      = Backbone.CreateArray <float>(firstPart.OutputDepth * firstPart.OutputWidth * firstPart.OutputHeight);
     this.errorImage      = new Image(this.firstPart.OutputDepth, this.firstPart.OutputWidth, this.firstPart.OutputHeight);
     this.layersConnected = false;
     if (siamese)
     {
         this.firstPart = (PurelyConvolutionalNN)original.CreateSiamese();
         this.i2a       = (ImageToArray)original.i2a.CreateSiamese();
         this.fnn       = (FeedForwardNN)original.fnn.CreateSiamese();
         this.siameseID = original.SiameseID;
     }
     else
     {
         this.firstPart = (PurelyConvolutionalNN)original.firstPart.Clone();
         this.i2a       = (ImageToArray)original.i2a.Clone();
         this.fnn       = (FeedForwardNN)original.fnn.Clone();
         this.siameseID = new object();
     }
 }