C# and neural networks. Where to start and which way to look?

The question is quite general, I know.

But I will clarify a little here that it would not be so vague.

  1. I am interested in the general compressed theory. Which article should I start with?
  2. Interested in current C#libraries
  3. I am interested in the approximate implementation of the idea already created in several variations - you feed the neural network a lot of images-pairs: large and small. And the neural network learns to make a big one out of a small one and then compares the big one and the big one a large one that was fed to him to understand what was done wrong. Which neuron is better to choose for this task?
  4. Isn't it too difficult and how much of a real problem in 3, considering that I'm not a boom-boom in neural networks at all?
  5. If the task is too much for a beginner in the NS, then what training tasks are better to start with?
Author: Eugene Bartosh, 2017-02-10

3 answers

One of the most sophisticated problems for NS is given in this article, you can understand the level of problems and algorithms that are used to solve this class of problems and where the NS is really needed. Examples on OpenCV, which is also great.

OpenCV is the most open source library, written in C++. Under C# there are wrappers - EmguCV, OpenCV for Unity (you can use it without Unity). There is an adaptation for Visual Studio (C++), Objective C, Android Studio, Python.

Even for moderately complex tasks, NS is usually not necessary, and is not even very applicable - you often have to do real-time video stream processing, and NS is not the fastest thing by far. For this and a number of other reasons, most developers, who are initially sure that they need an NS, later abandon this idea. Fortunately, OpenCV implements a huge number of algorithms for all occasions - almost everything related to video processing and the images are there.

After editing by the author of the question, I edit the answer :-)

Most algorithms implemented in the available packages are mainly designed for down-scaling, the demand for this is obvious - the camera shoots in high resolution, and in Internets it is better to post, having previously reduced the photo - this is used by all active users of Internets and social networks.

The Up-scaling task is also quite well developed, just the demand for it is disproportionately less - nevertheless, any designer knows perfectly well what to do so that the image can be enlarged without problems-take Corel Draw or another vector graphics package, that is, make the image vector.

Thus, if we convert a small bitmap image into vectors, do up-scaling, we will most likely already get something interesting - pay attention to the program Potrace. In OpenCV ready for raster->vector there is nothing. Although you can make something out of the available tools, it is unlikely that it will turn out better than Potrace - after all, people there dealt with this problem specifically. Potrace comes with the source code and a detailed description of the algorithms, so there is plenty of room for creativity: -)

And the most interesting thing for dessert - it's time to look at your enlarged image, and by comparing it with the result obtained as a result of vectorization and up-scaling, identify deviations. Identified deviations they can be used as a material for training the NS. For example, you can go by vectorizing a large image, identifying matching curves, and comparing their characteristics. Based on the results of the training, the NS will start issuing some recommendations for correcting curves in arbitrary images. It may even be possible to add curves, such as additional color contours of the gradient (although the gradient in the resulting image will be easier to smooth using the Blur functions, etc.)

 17
Author: Eugene Bartosh, 2017-02-25 21:14:31
  1. If you want to learn the mathematical apparatus of neural networks, I recommend that you start by studying the perceptron. It is easy to find articles on this type of INS.
  2. The situation with C# neural network libraries is quite bad. For C#, the best library from Microsoft, in my opinion, is the Microsoft cognitive toolkit. (https://github.com/Microsoft/CNTK/wiki). Cons: you can't train and build a network model in C# / code.NET and while the implementation is in beta, so there may be bugs. Among the advantages: it is easy to build various networks using the Brainscript scripting language, there is support for computing / training models on the GPU from nVidia (in C#/.NET, you can only calculate), various types of neural networks are supported. On github, in the Wiki section, you can find all the information you need and examples for implementing the INS using the Microsoft cognitive toolkit in C#. You can also look at neural networks in the Accord mathematical framework, but as far as I remember, there are not very many features and calculations are available only on the CPU.
  3. Specifically for this task, I would use a convolutional neural network. http://engineering.flipboard.com/2015/05/scaling-convnets here you can even see an approximate architecture of such a network for the task you set.
  4. If you are not going to write a neural network from scratch, then it is quite feasible :)
  5. Try to study a multi-layer perceptron first and implement it, for example, to solve the XOR problem.
 8
Author: Павел Козин, 2017-03-01 15:40:20

I will supplement the previous answers regarding CNTK. The recently released version 2.2 already has a full-fledged binding to C#. Accordingly, you can not only apply, but also train the network, without switching to Python or BrainScript.

 2
Author: Serge Sotnyk, 2017-11-02 07:39:19