public Form1() { FilePath = "IRIS_Train.csv"; Tuple <double, double, double, double> Norm = Tuple.Create(10.0, 0.0, 3.0, 0.0); List <double[]> input = new List <double[]>(); List <double[]> output = new List <double[]>(); var t = Data.ReadData("IRIS.csv", 4, 1, Norm, false); input = t.Item1; output = t.Item2; PerceptronNetwork network = new MLP.PerceptronNetwork(new int[] { 4, 5, 5, 1 }); NetworkController = new MLP.Network_Control(network, output, input, 0.02, false, Norm, 4, 1); InitializeComponent(); //Set image to the starting network's image if (!cbdisabledrawing.Checked) { var Image = NetworkImage.Draw(network, network.Layers.Count); IMG_NetworkTopography.Image = Image; IMG_NetworkTopography.SizeMode = PictureBoxSizeMode.Zoom; } rtbConsole.Text = ""; NetworkController.Paused = true; }
private void bControllerReset_Click(object sender, EventArgs e) { int inputCount; int outputCount; var structure = ParseStructureBox(out inputCount, out outputCount); Tuple <double, double, double, double> Norm = Tuple.Create(10.0, 0.0, 3.0, 0.0); List <double[]> input = new List <double[]>(); List <double[]> output = new List <double[]>(); var t = Data.ReadData(FilePath, inputCount, outputCount, Norm, rbMNIST.Checked); input = t.Item1; output = t.Item2; PerceptronNetwork network = new MLP.PerceptronNetwork(structure); NetworkController = new MLP.Network_Control(network, output, input, Double.Parse(tbLearningRate.Text), false, Norm, inputCount, outputCount); cartesianChart1.Series[0].Values.Clear(); cartesianChart2.Series[0].Values.Clear(); cartesianChart3.Series[0].Values.Clear(); if (!cbdisabledrawing.Checked) { var Image = NetworkImage.Draw(NetworkController.Network, NetworkController.Network.Layers.Count); IMG_NetworkTopography.Image = Image; } }
private void bControllerStep_Click(object sender, EventArgs e) { NetworkController.Step(); if (!chartsDisabled) { cartesianChart1.Series[0].Values.Add(NetworkController.CurrentError); } rtbConsole.Text += "Error: " + NetworkController.CurrentError + " | Iteration: " + NetworkController.CurrentIteration + "\n"; if (!chartsDisabled) { cartesianChart2.Series[0].Values.Add(NetworkController.Delay_Historian[NetworkController.Delay_Historian.Count - 1].TotalMilliseconds); } rtbConsole.SelectionStart = rtbConsole.Text.Length; rtbConsole.ScrollToCaret(); lbElapsed.Text = "" + (NetworkController.Delay_Historian.Sum(item => item.Milliseconds)) + "ms"; lbBestError.Text = "" + Math.Round(NetworkController.BestError, 4); lbIterationNumber.Text = "" + NetworkController.CurrentIteration; if (!cbdisabledrawing.Checked) { var Image = NetworkImage.Draw(NetworkController.Network, NetworkController.Network.Layers.Count); IMG_NetworkTopography.Image = Image; } if (NetworkController.Error_Historian.Count > 2) { if (!chartsDisabled) { cartesianChart3.Series[0].Values.Add(NetworkController.Error_Historian[NetworkController.Error_Historian.Count - 2] - NetworkController.Error_Historian[NetworkController.Error_Historian.Count - 1]); } } }
public static Image network( string src, Key key = null, float scale = 1.0f, float?width = null, float?height = null, Color color = null, BlendMode colorBlendMode = BlendMode.srcIn, BoxFit?fit = null, Alignment alignment = null, ImageRepeat repeat = ImageRepeat.noRepeat, Rect centerSlice = null, bool gaplessPlayback = false, FilterMode filterMode = FilterMode.Point, IDictionary <string, string> headers = null ) { var networkImage = new NetworkImage(src, scale, headers); return(new Image( key, networkImage, width, height, color, colorBlendMode, fit, alignment, repeat, centerSlice, gaplessPlayback, filterMode )); }
void LoadImage(string url) { Dictionary <string, string> headers = new Dictionary <string, string>(); NetworkImage networkImage = new NetworkImage(url, headers: headers); ImageConfiguration imageConfig = new ImageConfiguration(); this._stream = networkImage.resolve(imageConfig); }
private void bConstruct_Click(object sender, EventArgs e) { if (!cbdisabledrawing.Checked) { var Image = NetworkImage.Draw(NetworkController.Network, NetworkController.Network.Layers.Count); IMG_NetworkTopography.Image = Image; } bControllerReset_Click(sender, e); }
public static FadeInImage memoryNetwork( byte[] placeholder, string image, Key key = null, ImageErrorWidgetBuilder placeholderErrorBuilder = null, ImageErrorWidgetBuilder imageErrorBuilder = null, float placeholderScale = 1.0f, float imageScale = 1.0f, TimeSpan?fadeOutDuration = null, Curve fadeOutCurve = null, TimeSpan?fadeInDuration = null, Curve fadeInCurve = null, float?width = null, float?height = null, BoxFit?fit = null, AlignmentGeometry alignment = null, ImageRepeat repeat = ImageRepeat.noRepeat, bool matchTextDirection = false, int?placeholderCacheWidth = null, int?placeholderCacheHeight = null, int?imageCacheWidth = null, int?imageCacheHeight = null ) { alignment = alignment ?? Alignment.center; fadeOutDuration = fadeOutDuration ?? TimeSpan.FromMilliseconds(300); fadeOutCurve = fadeOutCurve ?? Curves.easeOut; fadeInDuration = fadeInDuration ?? TimeSpan.FromMilliseconds(700); fadeInCurve = fadeInCurve ?? Curves.easeIn; ImageProvider memoryImage = new MemoryImage(placeholder, placeholderScale); ImageProvider networkImage = new NetworkImage(image, imageScale); //placeholder = ResizeImage.resizeIfNeeded(placeholderCacheWidth, placeholderCacheHeight, memoryImage); //image = ResizeImage.resizeIfNeeded(imageCacheWidth, imageCacheHeight, networkImage); return(new FadeInImage( placeholder: ResizeImage.resizeIfNeeded(placeholderCacheWidth, placeholderCacheHeight, memoryImage), placeholderErrorBuilder: placeholderErrorBuilder, image: ResizeImage.resizeIfNeeded(imageCacheWidth, imageCacheHeight, networkImage), imageErrorBuilder: imageErrorBuilder, fadeOutDuration: fadeOutDuration, fadeOutCurve: fadeOutCurve, fadeInDuration: fadeInDuration, fadeInCurve: fadeInCurve, width: width, height: height, fit: fit, alignment: alignment, repeat: repeat, matchTextDirection: matchTextDirection, key: key )); }
public static FadeInImage assetNetwork( string placeholder, string image, AssetBundle bundle = null, float?placeholderScale = null, float imageScale = 1.0f, TimeSpan?fadeOutDuration = null, Curve fadeOutCurve = null, TimeSpan?fadeInDuration = null, Curve fadeInCurve = null, float?width = null, float?height = null, BoxFit?fit = null, Alignment alignment = null, ImageRepeat repeat = ImageRepeat.noRepeat, Key key = null ) { D.assert(placeholder != null); D.assert(image != null); D.assert(fadeOutDuration != null); D.assert(fadeOutCurve != null); D.assert(fadeInDuration != null); D.assert(fadeInCurve != null); D.assert(alignment != null); var imageProvider = placeholderScale != null ? new ExactAssetImage(placeholder, bundle: bundle, scale: placeholderScale ?? 1.0f) : (ImageProvider) new AssetImage(placeholder, bundle: bundle); var networkImage = new NetworkImage(image, imageScale); return(new FadeInImage( imageProvider, networkImage, fadeOutDuration, fadeOutCurve, fadeInDuration, fadeInCurve, width, height, fit, alignment, repeat, key )); }
public static FadeInImage memoryNetwork( byte[] placeholder, string image, float placeholderScale = 1.0f, float imageScale = 1.0f, TimeSpan?fadeOutDuration = null, Curve fadeOutCurve = null, TimeSpan?fadeInDuration = null, Curve fadeInCurve = null, float?width = null, float?height = null, BoxFit?fit = null, Alignment alignment = null, ImageRepeat repeat = ImageRepeat.noRepeat, Key key = null ) { D.assert(placeholder != null); D.assert(image != null); D.assert(fadeOutDuration != null); D.assert(fadeOutCurve != null); D.assert(fadeInDuration != null); D.assert(fadeInCurve != null); D.assert(alignment != null); var memoryImage = new MemoryImage(placeholder, placeholderScale); var networkImage = new NetworkImage(image, imageScale); return(new FadeInImage( memoryImage, networkImage, fadeOutDuration, fadeOutCurve, fadeInDuration, fadeInCurve, width, height, fit, alignment, repeat, key )); }
public static ImageProvider _createImageProvider(AvatarImageType imageType, string _imagePath) { ImageProvider tmp_ImageProvider = null; switch (imageType) { case AvatarImageType.NetWork: tmp_ImageProvider = new NetworkImage(_imagePath); break; case AvatarImageType.Asset: tmp_ImageProvider = new AssetImage(_imagePath); break; case AvatarImageType.Memory: byte[] bytes = File.ReadAllBytes(_imagePath); tmp_ImageProvider = new MemoryImage(bytes: bytes); break; } return(tmp_ImageProvider); }
private Widget BuildTextUsingMixedContent( BuildContext context, IEnumerable <MixedContent> summary) { if (summary is null) { return(new Container()); } var version = DocApp.of(context).version; return(new SelectableWealthyText( textSpanList: summary.Select(item => { switch (item) { case DocumentCharData charData: return new TextSpan(charData.content); case DocumentTagLink link: return new TextSpan( link.content, style: HyperLinkStyle, recognizer: new TapGestureRecognizer { onTap = () => LocationUtil.Go(link.@ref), } ); case DocumentTagBreak br: return new TextSpan("\n"); case DocumentTagBold bold: return new TextSpan( bold.content, style: new TextStyle( fontWeight: FontWeight.w500 ) ); case DocumentTagImage image: var networkImage = new NetworkImage( $"{Configuration.Instance.cdnPrefix}/{version.unityVersion}/{version.parsedVersion}/scripting/static/{image.name.Replace('-', '_')}"); networkImage.resolve(new ImageConfiguration()); return new ImageSpan( networkImage, margin: EdgeInsets.symmetric(vertical: 16f), imageWidth: _imageMetas[image.name].width, imageHeight: _imageMetas[image.name].height ); case DocumentTagItalic italic: return new TextSpan( italic.content, style: new TextStyle( fontStyle: FontStyle.italic ) ); } return null; }).Where(span => span != null).ToList(), style: NormalTextStyle )); }