Exemplo n.º 1
0
        protected override void ConfirmField(object shared)
        {
            double sd = Math.Sqrt(1.0 / (InArea));

            if (shared != null)
            {
                var obj = shared as Utility.Shared.ModelParameter;
                var w   = new Utility.Shared.ModelParameter.WeightData(1);
                w.Data[0] = new Components.RNdMatrix(InArea + 1, OutArea, 1, 1);
                Utility.Randomizer.Noize(ref w.Data[0].Data, Utility.Randomizer.Sign.Both, 0, sd);
                obj.Weignt.Add(w);

                Weight           = new Components.RNdMatrix(w.Data[0].Shape);
                Weight.Data      = (w.Data[0].Data.Clone()) as Components.Real[];
                WeightDifference = w.Difference.Clone() as Components.Real[];
            }
            else
            {
                if (!ObjectDecoded)
                {
                    Weight = (new Components.RNdMatrix(InArea + 1, OutArea, 1, 1)) as Components.RNdMatrix;
                    Utility.Randomizer.Noize(ref Weight.Data, Utility.Randomizer.Sign.Both, 0, sd);
                }
                WeightDifference = new Components.Real[1];
            }
        }
Exemplo n.º 2
0
 protected override void ConfirmField(object shared)
 {
     OutputChannels = InputChannels;
     OutWidth       = InWidth;
     OutHeight      = InHeight;
     if (shared != null)
     {
         var obj = shared as Utility.Shared.ModelParameter;
         var w   = new Utility.Shared.ModelParameter.WeightData(0);
         obj.Weignt.Add(w);
     }
 }
Exemplo n.º 3
0
        protected override void ConfirmField(object shared)
        {
            CompressSize = CompressSize <= 0 ? 1 : CompressSize;
            ExpandSize   = ExpandSize <= 0 ? 1 : ExpandSize;

            OutputChannels = InputChannels;
            OutWidth       = (int)(((double)ExpandSize / (double)CompressSize) * InWidth);
            OutHeight      = (int)(((double)ExpandSize / (double)CompressSize) * InHeight);

            Map = new Components.RNdMatrix(BatchCount, OutputChannels, InWidth, InHeight);

            if (shared != null)
            {
                var obj = shared as Utility.Shared.ModelParameter;
                var w   = new Utility.Shared.ModelParameter.WeightData(0);
                obj.Weignt.Add(w);
            }
        }
Exemplo n.º 4
0
        protected override void ConfirmField(object shared)
        {
            OutWidth  = (int)(OutScale * InWidth);
            OutHeight = (int)(OutScale * InHeight);

            double sd_b = Math.Sqrt(1.0 / (InputChannels * KernelLength));
            double sd_k = Math.Sqrt(1.0 / (InputChannels * KernelLength));

            if (shared != null)
            {
                var obj = shared as Utility.Shared.ModelParameter;
                var w   = new Utility.Shared.ModelParameter.WeightData(2);
                w.Data[0] = new Components.RNdMatrix(OutputChannels, 1, 1, 1);
                w.Data[1] = new Components.RNdMatrix(InputChannels, OutputChannels, 2 * KernelSize + 1, 2 * KernelSize + 1);
                Utility.Randomizer.Noize(ref w.Data[0].Data, Utility.Randomizer.Sign.Both, 0, sd_b);
                Utility.Randomizer.Noize(ref w.Data[1].Data, Utility.Randomizer.Sign.Both, 0, sd_k);
                obj.Weignt.Add(w);

                WeightBias        = new Components.RNdMatrix(w.Data[0].Shape);
                WeightBias.Data   = (w.Data[0].Data.Clone()) as Components.Real[];
                WeightKernel      = new Components.RNdMatrix(w.Data[1].Shape);
                WeightKernel.Data = (w.Data[1].Data.Clone()) as Components.Real[];
                WeightDifference  = w.Difference.Clone() as Components.Real[];
            }
            else
            {
                if (!ObjectDecoded)
                {
                    WeightBias   = (new Components.RNdMatrix(OutputChannels, 1, 1, 1)) as Components.RNdMatrix;
                    WeightKernel = (new Components.RNdMatrix(InputChannels, OutputChannels, 2 * KernelSize + 1, 2 * KernelSize + 1)) as Components.RNdMatrix;
                    Utility.Randomizer.Noize(ref WeightBias.Data, Utility.Randomizer.Sign.Both, 0, sd_b);
                    Utility.Randomizer.Noize(ref WeightKernel.Data, Utility.Randomizer.Sign.Both, 0, sd_k);
                }
                WeightDifference = new Components.Real[2];
            }
        }