コード例 #1
0
        private void обработатьПланшетПреобученнойСетьюToolStripMenuItem_Click(object sender, EventArgs e)
        {
            BoxerDLL.BoxCut2D cutter = new BoxerDLL.BoxCut2D(7, 10, 0.143f, 0.1f);
            if (openImageDialog.ShowDialog() == DialogResult.OK)
            {
                Bitmap       map    = new Bitmap(openImageDialog.FileName);
                RectangleF[] rects  = cutter.Rects1D(map.Width, map.Height);
                Color[]      colors = new Color[rects.Length];
                Color        plus   = Color.FromArgb(100, Color.Red);
                Color        minus  = Color.FromArgb(100, Color.Green);
                var          maps   = cutter.Enumerator(ref map);
                int          j      = 0;
                //List<double[,,]> rgbs = new List<double[,,]>();
                do
                {
                    double[,,] output = pretrain.ProcessAutoEncoder(ImageDataConverter.GetRGBArray(new Bitmap(maps.Current, NetworkData.image_size)));
                    GC.Collect();
                    colors[j] = output[0, 0, 0] > output[0, 0, 1] ? plus : minus;
                    j++;
                } while (maps.MoveNext());

                var bitmap = DrawColoredRects(map, rects, colors);

                ImageShow img_show = new ImageShow(bitmap);
                img_show.Show();
            }
        }
コード例 #2
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (pretrain_task != null)
            {
                if (pretrain_task.IsCompleted)
                {
                    pretrain.UpdateWeights(ref NetworkData.network);
                    label1.Text    = "Error: " + (float)pretrain_task.Result;
                    double[,,] res = pretrain.ProcessAutoEncoder(base_arr);
                    ContinuePretrain();

                    double max = -1;
                    res.ForEach((x) => { max = Math.Max(max, x); });
                    res.ForEach((x) => x / max);
                    //pictureBox2.Image = ImageDataConverter.GetImage(res.ConvertToRGD());
                }
            }
        }