public NetNeural(int xPixelWidth, int xPixelHeight, int xHiddenNodes, int xOutputNodes, double xLearningRate, MODE xMode) { //SWITCH MODE int netWidth = xPixelWidth, netHeight = xPixelHeight; switch (xMode) { case MODE.HSENSOR: netWidth = 1; //ONE LINE OF SENSORS break; } //TRANSFER VARIABLES PixelWidth = xPixelWidth; PixelHeight = xPixelHeight; NodesInput = netWidth * netHeight; NodesHidden = xHiddenNodes; NodesOutput = xOutputNodes; LearningRate = xLearningRate; Mode = xMode; //SET MAIN SIZE SizeNet = new Size(PixelWidth, PixelHeight); SizeScale = Mod_PNG.getScale(SizeNet, new Size(140, 140), true); //KEEP RELATIONS //INITIALIZE WEIGHTS initWeights(); }
public static void drawCheck(Image xDraw, params UniPanel[] xPanel) { //CHECK DRAWN BITMAP double[] dblArray = NetMain.Cam.getDoubleArray(); //GET ANSWER int answer = NetMain.neuralNetworkQuery(dblArray, 0.0, true); //ABBRUCH if (xPanel.Length == 0 || answer == int.MinValue) { return; } //TRANSFER IMAGE AND TOOLTIP TO NEXT PANEL for (int i = xPanel.Length - 2; i >= 0; i--) { if (xPanel[i].BackgroundImage != null) { xPanel[i + 1].BackgroundImage = xPanel[i].BackgroundImage; } ; xPanel[i + 1].setToolTip(xPanel[i].getToolTip()); } //SET FIRST PANEL Size size = xPanel[0].Size; xDraw = (Bitmap)Mod_PNG.getScaleImage(xDraw, size, false); Graphics g = Graphics.FromImage(xDraw); g.DrawString(Mod_Convert.IntegerToString(answer), Fonts.getFontCooper(9), new SolidBrush(Color.Red), new Point(size.Width - 14, size.Height - 18)); xPanel[0].BackgroundImage = xDraw; xPanel[0].setToolTip(NetMain.ConsoleBox.Tag.ToString()); }
public static Image ScaleDown(Image xImage) { //SCALE IMAGE DOWN return(Mod_PNG.getScaleImage(xImage, NetMain.Net.SizeNet, false)); }
public static Image ScaleUp(Image xImage) { //SCALE IMAGE UP return(Mod_PNG.getScaleImage(xImage, NetMain.Net.SizeScale, false)); }