public IActionResult Recognize(string imageName) { if (imageName == null) { throw new ArgumentNullException(nameof(imageName)); } var imagePath = _imagesService.GetImageFilePath(imageName); var image = Image.FromFile(imagePath) as Bitmap; if (image == null) { throw new Exception(nameof(image)); } var inputArray = GetInputArray(image); _neuron = new Neuron(_rowsCount, _columnsCount, inputArray, _weights); _neuron.MultiplySignalByWeight(); _neuron.SignalsSum(); return(Json(new { Result = _neuron.GetResult(), Value = _neuron.Sum, Output = GetOutputArray(_neuron.Input) })); }