Introduction to neural networks

The topic of neural networks in the IT area has become very popular in recent years. Neural networks are not a new concept, as they were already popular in the 1970s. However, their real development took place in the 21st century due to the technology’s huge leap forward. Neural networks are one of the areas of artificial intelligence (AI). The interest in neural networks is growing, thus forcing us to constantly develop and improve them.

Characteristics

In order to describe the way neural networks work, it is worth referring (in a certain simplification) to the way the human nervous system works. The characteristic of the functionality is acting as a biological system. Despite enormous progress and the use of innovative solutions, today’s networks still are not able to act as well as the human brain. However, it can’t be ruled out that in the future such an advanced stage of development will be reached.

Neural network structure

The neural network consists of a certain number of neurons. The simplest neural network is called perceptone, which consists of only one artificial neuron. Input data with assigned weight scales are sent to the perceptone – it determines the final result of a parameter. This set of data is later sent to the summation block. The summation block is just a pattern, an algorithm prepared by programmers. Summing all inputs gives a result, which in today’s advanced types of artificial neurons answers the form of a real number. The result informs about the type of decision that was made based on the calculations.

Illustrative diagram of the perceptron operation
Img 1 Schematic diagram of how a perceptron works. Each of the 4 input elements is multiplied by its corresponding weights. The products are summed (summation block) and the sum is passed to activation function (activation block), whose output is also the output of the perceptron.

The usage of neural networks

When it comes to the development of AI, it is closely connected to the development of neural networks. An unquestionable advantage of networks is that they have a wide range of applications. Furthermore, they leave room for unlimited possibilities for further development. Another advantage of it is that they deal well with large data sets, which are sometimes very problematic for people. What’s more, they can adapt to the new situation when new variables appear. However, most available on the market programs do not have this possibility.

Neural networks’ ability to work based on damaged data is still a field of development. They will find applications in a growing number of areas, mainly in finance, medicine, and technology. Neural networks will appear successively in areas that require solutions related to prediction, classification, and control. They will find their application wherever creating scenarios or making decisions is based on many variables.

Bibliography

[1] http://businessinsider.com.pl/technologie/czym-sa-sieci-neuronowe/pwtfrsy

[2] http://pclab.pl/art71255-2.html

Digital image processing

Signal processing accompanies us every day. All stimuli (signals) received from the world around i.e. sound, light, or temperature are processed into electrical signals, which are later sent to the brain. In the brain the analysis and interpretation of the received signal take place. As a result, we get information from the signal (e.g. we can recognize the shape of an object, we feel the heat, etc.).

Digital signal processing (DSP) works similarly. In this case, the analog signal is converted into a digital signal by an analog-digital converter. Then, using the digital computer, received signals are being processed. The DSP systems also use computer peripheral devices equipped with signal processors which allow to process signals in real-time. Sometimes it is necessary to re-convert the signal to an analog form (e.g. to control a device). For this purpose, digital-to-analog converters are used.

Digital signal processing has a wide range of applications. It can be used to process sound, speech recognition, or image processing. The last issue will be the subject of this article. We will deeply discuss the basic operation of convolutional filtration in digital image processing.

What is image processing?

Simply speaking, digital image processing consists in transforming the input image into an output image. The aim of this process is to select information – choosing the most important (e.g. shape) and eliminating unnecessary (e.g. noise). The digital image process features a variety of different image operations such as:

  • filtration,
  • thresholding,
  • segmentation,
  • geometry transformation,
  • coding,
  • compression.

  As we mentioned before, in this article we will focus on image filtration.

Convolutional filtration

Both in the one-dimensional domain (for audio signals) and also for two dimensions, there are specific tools for operating on signals – in this case on images. One of such tools is filtration. It consists of some mathematical operations on pixels which as a result give us a new image. Filtration is commonly used to improve image quality or to extract important features from the image.

The basic operation in the filtration method is the 2D convolutional function. It allows applying of image transformations using appropriate filters in a form of matrix coefficients. The use of filters consists of calculating a point’s new value based on the brightness values of points in the closest neighborhood. Such so-called masks containing pixel weights based on the closest pixels values are used in calculations. The usual sizes of masks are 3×3, 5×5, and 7×7. The process of image and filter convolution has been shown below.

Assuming that the image is represented by a 5×5 matrix which contains color values and the filter is represented by a 3×3 matrix, the image was modified by joining these matrices.

The first thing to do is to transpose coefficients in a filter. We assume that the center of the filtration core h(0,0) is in the middle of the matrix, as shown in the picture below. Therefore (m,n) indexes denoting rows and columns of the filter matrix will be both negative and positive.

Image filtration diagram
Img 1 Filtration diagram

Considering the filter matrix (the blue one) as inverted vertically and horizontally we can perform filtration operations. They start by placing the h(0,0) → h(m,n) element of the blue matrix over the s(-2,-2) → s(i,j) element of the yellow matrix (the image). Then we multiply the overlapping values of both matrices and add them up. In this way, we have obtained the convolution result for the (-2,-2) cell of the output image. It is important to remember the normalization process, which allows us to adjust the brightness of a result by dividing it by the sum of filter coefficients. It prevents the output image brightness from being out of a scale of 0-255 (in the case of 8-bit image representation).

The next stages of this process are very similar. We move the center of the blue matrix over the (-2,-1) cell, then again multiply the overlapping values. Next, add them together and divide the result by the filter coefficients to get the result. We consider cells that go beyond the area of the matrix s (i,j) to be undefined. Therefore, the values do not exist in these places, so we do not multiply them.

The usage of convolutional filtration

Depending on the type of filter we can distinguish several applications of convolutional filtration. Low-pass filters are used to remove noise from images, while high-pass filters are used to sharpen or emphasize edges. To illustrate the effects of different filters, we will apply them to the real image. The picture below is a “jpg” format and was loaded in Octave software as an MxNx3 pixel matrix.

Original input image
Img 2 Original Input Image

Gaussian blur

To blur the image we need to use a convolutional function as well as the properly prepared filter. One of the most commonly used low-pass filters is the gaussian filter. It allows you to lower the sharpness of the image but also it is used to reduce the noise from it.

For this article, a 29×29 matrix based on Gaussian function with a standard deviation of 5 was generated. The normal distribution gives weights to the surrounding pixels during the process of convolution. A low-pass filter suppresses high-frequency image elements while passing low-frequency elements. The output image compared to the original one is blurry, and the noises are significantly reduced.

Blurred input image
Img 3 Blurred input image

Sharpen

We can make the image blurry but there is also a way to make it sharpen. To make it happen a suitable high-pass filter should be used. The filter passes through and amplifies image elements that are characterized by high frequency e.g. noise or edges. However, low-frequency elements are suppressed. By using this filter the original image is sharpened – it can be easily noticed especially in the arm area.

Sharpened input image
Img 4 Sharpened input image

Edges detection

Another possible image process is called edge detection. Shifting and subtracting filters are used to detect edges on the image. They work by shifting the image and subtracting the original image from its copy. As a result, of this procedure, edges are being detected, as shown in the picture below.

Edge detection
Img 5 Edge detection

BFirst.Tech experience with image processing

Our company hires well-qualified staff with experience in the field of image processing. One of our original projects was called TIRS, i.e. a platform which diagnoses areas in the human body that might be affected by cancerous cells. It works based on the use of advanced image processing algorithms and artificial intelligence. It allows to automatically detect cancerous areas with the use of medical imaging data obtained from tomography and magnetic resonance imaging. This platform finds its use in clinics and hospitals.

Our other project, which also required the usage of image processing, is called the Virdiamed platform. It was created in cooperation with Rehasport Clinic. This platform allows a 3D reconstruction of CT and MRI data and also viewing 3D data in a web browser. If you want to read more about our projects click here.

Digital signal processing, including image processing, is a field of technology with a wide range of application possibilities, and its popularity is constantly growing.  Non-stopping technological progress means that this field of technology is also constantly developing. Moreover, any technologies used every day are based on signal processing, which is why it is certain that in the future the importance of DSP will continue to grow.

Bibliography

[1] Leonowicz Z.: „Praktyczna realizacja systemów DSP”

[2] http://www.algorytm.org/przetwarzanie-obrazow/filtrowanie-obrazow.html