/// <summary>Creates an instance of the <code>DeConvolutionalNN</code> class.</summary> /// <param name="firstPart">First part of the network.</param> /// <param name="cnn">Second part of the network.</param> /// <param name="createIO">Whether the input array and the output image of the netwok are to be created.</param> public DeConvolutionalNN(FeedForwardNN firstPart, PurelyConvolutionalNN cnn, bool createIO = true) { this.firstPart = firstPart; this.a2i = new ArrayToImage(cnn.InputDepth, cnn.InputWidth, cnn.InputHeight, false); this.cnn = cnn; this.errorArray = Backbone.CreateArray <float>(cnn.InputDepth * cnn.InputWidth * cnn.InputHeight); this.errorImage = new Image(cnn.InputDepth, cnn.InputWidth, cnn.InputHeight); this.layersConnected = false; if (createIO) { this.SetInputGetOutput(Backbone.CreateArray <float>(firstPart.InputSize)); } this.siameseID = new object(); }
/// <summary>Either creates a siamese of the given <code>ArrayToImage</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> if a clone is.</param> protected ArrayToImage(ArrayToImage original, bool siamese) { this.inputSize = original.InputSize; this.outputDepth = original.OutputDepth; this.outputWidth = original.OutputWidth; this.outputHeight = original.OutputHeight; if (siamese) { this.siameseID = original.SiameseID; } else { this.siameseID = new object(); } }
/// <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(); } }