public ConvSuperResolution() { superres_enc_front = InputLayer.Create(StartSide, 3); superres_enc_back = ActivationLayer.Create <ReLU>(); var pooling_0 = PoolingLayer.Create(2, 2); var pooling_1 = PoolingLayer.Create(2, 2); var pooling_2 = PoolingLayer.Create(2, 2); var pooling_3 = PoolingLayer.Create(2, 2); superres_enc_front.Append( ConvLayer.Create(5, 128, 2).Append( //o = 96 ActivationLayer.Create <ReLU>().Append( pooling_0.Append( //o = 48 ConvLayer.Create(3, 128, 1).Append( //o = 48 ActivationLayer.Create <ReLU>().Append( pooling_1.Append( //o = 24 ConvLayer.Create(3, 64, 1).Append( //o = 24 ActivationLayer.Create <ReLU>().Append( pooling_2.Append( //o = 12 ConvLayer.Create(3, 32, 1).Append( //o = 12 ActivationLayer.Create <ReLU>().Append( pooling_3.Append( //o = 6 ConvLayer.Create(3, 32, 1).Append( //o = 6 superres_enc_back )))))))))))))); superres_dec_front = InputLayer.Create(6, 32); superres_dec_back = ActivationLayer.Create <Tanh>(); superres_dec_front.Append( ConvLayer.Create(3, 32, 1).Append( //o = 6 ActivationLayer.Create <ReLU>().Append( UnpoolingLayer.Create(pooling_3).Append( //o = 12 ConvLayer.Create(3, 64, 1).Append( //o = 12 ActivationLayer.Create <ReLU>().Append( UnpoolingLayer.Create(pooling_2).Append( //o = 24 ConvLayer.Create(3, 128, 1).Append( //o = 24 ActivationLayer.Create <ReLU>().Append( UnpoolingLayer.Create(pooling_1).Append( //o = 48 ConvLayer.Create(3, 128, 1).Append( //o = 48 ActivationLayer.Create <ReLU>().Append( UnpoolingLayer.Create(pooling_0).Append( //o = 96 ConvLayer.Create(5, 3, 2).Append( //o = 96 superres_dec_back )))))))))))))); superres_enc_back.Append(superres_dec_front); //TODO: come up with an approach that saves the convolution/multiplication indexes and rearranges the weights etc so they fit into cache better //TODO: unpooling layer tied to pooling layers //Initialize Weights superres_enc_front.SetupInternalState(); superres_enc_front.InitializeWeights(new UniformWeightInitializer(0, 0.001f)); }
public ReversibleAutoencoder() { superres_enc_front = InputLayer.Create(StartSide, 3); superres_enc_back = ActivationLayer.Create <LeakyReLU>(); var pooling_0 = PoolingLayer.Create(2, 2); var pooling_1 = PoolingLayer.Create(2, 2); var pooling_2 = PoolingLayer.Create(2, 2); var pooling_3 = PoolingLayer.Create(2, 2); superres_enc_front.Append( ConvLayer.Create(3, 12).Append( //o = 94, 16 ActivationLayer.Create <LeakyReLU>().Append( ConvLayer.Create(3, 12).Append( //o = 92, 16 ActivationLayer.Create <LeakyReLU>().Append( ConvLayer.Create(3, 12).Append( //o = 90, 16 ActivationLayer.Create <LeakyReLU>().Append( ConvLayer.Create(3, 12).Append( //o = 88, 16 ActivationLayer.Create <LeakyReLU>().Append( pooling_0.Append( //o = 44, 16 ConvLayer.Create(3, 12).Append( //o = 42, 16 ActivationLayer.Create <LeakyReLU>().Append( ConvLayer.Create(3, 12).Append( //o = 40, 16 ActivationLayer.Create <LeakyReLU>().Append( ConvLayer.Create(3, 12).Append( //o = 38, 16 ActivationLayer.Create <LeakyReLU>().Append( ConvLayer.Create(3, 12).Append( //o = 36, 16 ActivationLayer.Create <LeakyReLU>().Append( ConvLayer.Create(3, 12).Append( //o = 34, 16 ActivationLayer.Create <LeakyReLU>().Append( ConvLayer.Create(3, 12).Append( //o = 32, 16 ActivationLayer.Create <LeakyReLU>().Append( ConvLayer.Create(3, 12).Append( //o = 30, 16 ActivationLayer.Create <LeakyReLU>().Append( ConvLayer.Create(3, 12).Append( //o = 28, 16 ActivationLayer.Create <LeakyReLU>().Append( pooling_2.Append( //o = 14, 16 ConvLayer.Create(3, 12).Append( //o = 12, 16 ActivationLayer.Create <LeakyReLU>().Append( ConvLayer.Create(3, 12).Append( //o = 10, 16 ActivationLayer.Create <LeakyReLU>().Append( ConvLayer.Create(3, 12).Append( //o = 8, 16 ActivationLayer.Create <LeakyReLU>().Append( pooling_3.Append( //o = 4, 16 ConvLayer.Create(3, 8, 1).Append( //o = 4, 8 superres_enc_back ))))))))))))))))))))))))))))))))))); superres_dec_front = InputLayer.Create(4, 8); superres_dec_back = ActivationLayer.Create <Tanh>(); superres_dec_front.Append( //o = 4, 8 ConvLayer.Create(3, 8, 1).Append( //o = 4, 16 ActivationLayer.Create <LeakyReLU>().Append( UnpoolingLayer.Create(pooling_3).Append( //o = 8, 16 ActivationLayer.Create <LeakyReLU>().Append( ConvLayer.Create(3, 12, 2).Append( //o = 10, 16 ActivationLayer.Create <LeakyReLU>().Append( ConvLayer.Create(3, 12, 2).Append( //o = 12, 16 ActivationLayer.Create <LeakyReLU>().Append( ConvLayer.Create(3, 12, 2).Append( //o = 14, 16 UnpoolingLayer.Create(pooling_2).Append( //o = 28, 16 ActivationLayer.Create <LeakyReLU>().Append( ConvLayer.Create(3, 12, 2).Append( //o = 30, 16 ActivationLayer.Create <LeakyReLU>().Append( ConvLayer.Create(3, 12, 2).Append( //o = 32, 16 ActivationLayer.Create <LeakyReLU>().Append( ConvLayer.Create(3, 12, 2).Append( //o = 34, 16 ActivationLayer.Create <LeakyReLU>().Append( ConvLayer.Create(3, 12, 2).Append( //o = 36, 16 ActivationLayer.Create <LeakyReLU>().Append( ConvLayer.Create(3, 12, 2).Append( //o = 38, 16 ActivationLayer.Create <LeakyReLU>().Append( ConvLayer.Create(3, 12, 2).Append( //o = 40, 16 ActivationLayer.Create <LeakyReLU>().Append( ConvLayer.Create(3, 12, 2).Append( //o = 42, 16 ActivationLayer.Create <LeakyReLU>().Append( ConvLayer.Create(3, 12, 2).Append( //o = 44, 16 UnpoolingLayer.Create(pooling_0).Append( //o = 88, 16 ConvLayer.Create(3, 12, 2).Append( //o = 120, 16 ActivationLayer.Create <LeakyReLU>().Append( ConvLayer.Create(3, 12, 2).Append( //o = 122, 16 ActivationLayer.Create <LeakyReLU>().Append( ConvLayer.Create(3, 12, 2).Append( //o = 124, 16 ActivationLayer.Create <LeakyReLU>().Append( ConvLayer.Create(3, 3, 2).Append( //o = 126, 3 superres_dec_back ))))))))))))))))))))))))))))))))))); superres_enc_back.Append(superres_dec_front); //TODO: come up with an approach that saves the convolution/multiplication indexes and rearranges the weights etc so they fit into cache better //TODO: unpooling layer tied to pooling layers //Initialize Weights superres_enc_front.SetupInternalState(); superres_enc_front.InitializeWeights(new UniformWeightInitializer(0, 0.001f)); }