· 4 years ago · May 18, 2021, 08:22 PM
1\section{Issue introduction}
2\subsection{Anthropology}
3Anthropology is characterized by Echaudemaison as a broad set of disciplines that are related to man. It specifically mentions disciplines such as biology, philosophy, economics, pedagogy, but it also includes archeology, sociology and theology \cite{1}.
4
5The oldest part of anthropology is biological anthropology (physical anthropology), which in the historical notion of anthropology is defined by Soukup as a science studying the variability, morphology and physiology of the human organism within different racial, ethnic and cultural groups of the population in timespace \cite{2}.
6
7In practice, anthropology is used mainly as applied anthropology, thanks to the use of knowledge of human science, especially in sports, criminology (forensic anthropology) and industry. Thus, a person can be included in a suitable work process due to his natural physical and mental characteristics, in a place where he could best apply himself in human society as an individual \cite{3}.
8
9\subsection{Anthropometry}
10Anthropometry is the study of the measurement of the human body. In its most basic form, anthropometry is used to help scientists and anthropologists understand physical variations between humans. Anthropometry is useful for a wide range of applications and provides some basis for human measurements.
11
12\subsubsection{History of anthropometry}
13The study of anthropometry has had several scientific applications in history. For example, in the 18th century, scientists used anthropometry to analyze facial characteristics and head size to predict the likelihood that a person was prone to be a criminal, when in fact there is little scientific evidence to support this.
14
15In modern times, anthropometrics have had more practical applications, especially in the field of genetic research and workplace ergonomics. Anthropometry also provides insight into the study of human fossils and can help paleontologists better understand developmental processes.
16
17Typical body measurements used in anthropometrics include height, weight, body mass index (BMI), waist to hip ratio, and body fat percentage. By studying the differences in these measurements in humans, scientists can assess risk factors for a variety of diseases \cite{4}.
18
19\subsubsection{Use of anthropometry}
20Anthropometry has a very accurate system of measuring and observing the human body and its parts. This is due to the points located on the body, which are covered only by the skin and not by muscle or fat. Thanks to the exact data obtained in this way, it is widely used in various areas such as:
21
22\begin{itemize}
23 \item medicine,
24 \begin{itemize}
25 \item development and growth of the individual
26 \item nutritional status (diagnostics)
27 \item epidemiology
28 \end{itemize}
29 \item architecture,
30 \item criminology,
31 \item sport,
32 \item industrial design,
33 \item textile industry,
34 \item gaming industry.
35\end{itemize}
36
37\subsubsection{Anthropometric research parameters}
38\noindent The target parameters that are the subject of the survey are classified into specific groups as follows:
39\begin{itemize}
40 \item Whole body,
41 \begin{itemize}
42 \item Height (cm)
43 \item Weight (kg)
44 \item 3D character model (scan)
45 \item Photos from every angle
46 \end{itemize}
47 \item Torso,
48 \begin{itemize}
49 \item Torso length (cm, \%)
50 \item Chest circumference (cm)
51 \item Waist circumference (cm)
52 \item Shoulder width (cm)
53 \item Spread width (cm)
54 \item Basin width (cm)
55 \item Neck length (cm)
56 \item Torso length index versus total height (\%)
57 \item Arm width index to total height (\%)
58 \item Center of gravity location index relative to height (cm, \%)
59 \item Arm span to height index (cm, \%)
60 \end{itemize}
61 \item Arms,
62 \begin{itemize}
63 \item Full arm length (cm)
64 \item Forearm length (cm)
65 \item Forearm circumference (cm)
66 \item Biceps bone length (cm)
67 \item Biceps circumference (cm)
68 \item Elbow joint thickness (cm)
69 \item Elbow hypermobility rate (degrees)
70 \item Index of arm length to body height (cm, \%)
71 \item Forearm to biceps index (\%)
72 \end{itemize}
73 \item Legs,
74 \begin{itemize}
75 \item Full leg length (cm)
76 \item Shin length (cm)
77 \item Shin circumference (cm)
78 \item Femur length (cm)
79 \item Femur circumference (cm)
80 \item Basin width (cm)
81 \item Knee hypermobility rate (degrees)
82 \item Leg index versus body height (cm, \%)
83 \item Shin index to femur (\%)
84 \end{itemize}
85 \item Foot,
86 \begin{itemize}
87 \item Foot size (cm, number)
88 \item Foot width (cm)
89 \item Foot, arch, toe and ankle shape (photo)
90 \item Foot size index versus body height (cm, %)
91 \item Thumb size index to foot length (%)
92 \end{itemize}
93 \item Palm,
94 \begin{itemize}
95 \item Palm length (cm)
96 \item Palm width (cm)
97 \item Finger length (cm)
98 \item The coarsest gripping object with the touch of fingers (cm diameter)
99 \item Index of finger length to palm
100 \item Palm and finger shape (Photography)
101 \item Palm size index versus body height (cm, \%)
102 \end{itemize}
103 \item Head.
104 \begin{itemize}
105 \item 3D scan of the head (location of different parts, size and proportions)
106 \item Front and side head shape (photo)
107 \item Skull height (cm)
108 \item Face tilt from forehead to chin (angle)
109 \item Skull width (cm)
110 \item Jawline length (cm)
111 \item Tooth Shape (Photography)
112 \item The shape of the palate in the mouth
113 \item Distance of the center of the eyes from each other (cm)
114 \item Nasal bone length (cm)
115 \item The shape of the nose, ear, teeth (photo) and their location on the face (indexes / dimensions / proportions) \cite{5}
116 \end{itemize}
117\end{itemize}
118
119\subsection{Data collection method - photogrammetry}
120
121Photogrammetry is a scientific discipline that deals with determining the position, shape and dimensions of objects and phenomena in their photographic images. It is an optical measuring method, and therefore the measurement is made on the measuring images, not directly on the object.
122
123\noindent It is a modern mapping method that has many advantages, such as:
124\begin{itemize}
125 \item the measurement takes place without contact with the object,
126 \item information about the object is obtained at the moment of taking the picture, (ensures the measurement of objects that are shape-changing and moving)
127 \item the mapping is performed outside the space of the object,
128 \item the measured object can be in any state of matter and in any size (microscopically small or extremely large),
129 \item changing phenomena can be detected over time and during its measurement \cite{6}.
130\end{itemize}
131
132Nowadays, the trend of transition from photogrammetric image to electronic image creation via digital sensors such as e.g. \acrshort{CCD}. Their importance has increased with the development of computer capacity, the production of special equipment for digitizing analogue photogrammetric images (scanners), as well as digital cameras for online digital image processing. At the same time, various digital image processing methods or photogrammetric algorithms were developed, which ultimately paved the way for digital photogrammetry applications \cite{7}.
133
134\subsection{Technical parameters in Smartphone cameras}
135Cameras in mobile phones are based on classic cameras, but they are scaled down, which affects the quality of the photos. However, the determining technical parameters are the same.
136
137\begin{figure}[!htbp]
138 \centering
139 \includegraphics[width=16cm]{img/DP_camera.png}
140 \caption{Schema of camera parameters}
141 \label{Schema of camera parameters}
142\end{figure}
143\pagebreak
144
145\subsubsection{Focal length}
146It is the distance between the center of the lens and the plane on which the lens focuses the beams (where all the lines that pass through the lens intersect). For classic cameras, the focal length is given to the full frame size. Full frame is an image format that is considered the standard image sensor size of conventional cameras and is derived from the original 36 x 24 mm film frame. When using a lens with a focus of 50 mm, the view is almost the same dimensions as when viewed from the human eye. The angle of view is then approximately 40 degrees and is called normal, natural to the eye. The smaller the focal length, the larger the angle of view and is referred to as wide-angle. If we use a lens with a focal length higher than 50 mm, we call it a telephoto lens. For mobile phones, manufacturers also state the focal length, of course, but it is converted to the aforementioned full frame size so that it can be better compared. This value is called the equivalent focal length. The actual focal length due to the small size of the camera itself is most often around 4 mm.
147
148\subsubsection{Focal ratio}
149This parameter is related to the focal length. The focal ratio (F) is defined as the ratio of the focal length (f) to the aperture diameter. For conventional cameras, an aperture is placed in place of the lens. It can be tightened as necessary and thus reduce its diameter (D). This relation is described by:
150\[ F = \frac{f}{D} \]
151\indent The lower the focal ratio, the smaller the depth of field. Depth of field is the range from the closest to the farthest point that appears in focus in the image. A low focal ratio is characteristic of classic large cameras with a shallow depth of field, where only one part of the image is in focus and the background is blurred. The focal ratio is very related to the luminosity of the lens. Luminosity is the minimum value of the focal ratio. Because for most mobile phones it is not possible to change the aperture diameter, the given focal ratio is usually equal to the luminosity. This parameter is especially important because it indicates the amount of light that can hit the sensor.
152
153\subsubsection{Number of pixels}
154The number of pixels indicates how many of them are located on the image sensor. This parameter is related to the size of the sensor itself and also to the size of individual pixels. When looking at the specifications, we very often see only one number. This is created by multiplying the number of pixels in portrait and landscape. Because image sensors in phones are generally very small, a high number of pixels can have a negative impact. When using a chip with a number of over 20 million pixels, so-called megapixels, the size of individual pixels is much smaller than when using half the number. Small pixels are able to capture less light, the resulting photo contains more noise, and its quality is usually lower.
155
156The higher number of these pixels also has indisputable advantages. If we use digital zoom, where the photo is cropped, we get a picture of higher quality. Another reason why a higher number of pixels may be useful is to shoot video. To capture video in 4K (3840 x 2160 pixels), it is necessary to have at least an 8.3-megapixel sensor. The total number of pixels of the sensor does not have to be the same number as the number of usable pixels to capture the image, which is referred to as the effective number of pixels. The value of this number is usually lower and indicates the size of the resulting image.
157
158The Bayer mask, which allows you to capture colors, reduces the real resolution. For example, if we use a 30-megapixel camera, there will be 15 million pixels sensitive to green, another 7.5 to red, and 7.5 to blue color. Due to this fact, it is necessary to perform the so-called interpolation. It works on the principle of calculating the remaining two colors using algorithms.
159
160\subsubsection{Pixel size}
161The size of each pixel affects the amount of incident light per dot. The larger the size, the more light is captured. For mobile phones, this parameter is in the order of micrometers. The size of one pixel can be easily calculated from the number of pixels and size of the image sensor.
162
163\subsubsection{Image sensor size}
164The size of the image sensor itself is affected by the two parameters already mentioned. For smaller sensors, the size parameter is usually given in one dimension in inch units. This figure is not the diagonal of the sensor, but is derived from the diameter of cylindrical electron tubes intended for television shooting in the 1950s. The real diagonal is approximately two-thirds of this number. Using a larger image sensor usually means higher quality, as a larger area of the sensor can detect more light. The area of the image sensor of a mobile phone is about fifty times smaller than with the full frame format.
165
166\subsubsection{Focusing}
167Focusing makes the image look sharp to the human eye. There are two focusing options. There is fixed focus at a specific distance when the camera does not focus, and automatic focusing, or autofocus. Fixed focus has a fixed distance from the factory, at which the captured image will appear sharp.
168
169Autofocus can be divided into several methods according to the method of focusing. When focusing with contrast detection, an algorithm is used to evaluate when the captured image is sharp. This is possible by testing different focus combinations until the software detects that the local contrast is highest. This method is not suitable if the lighting conditions are poor. The speed of this method is not dizzying.
170
171Active focusing methods used in modern devices include laser focusing. The phone has a laser beam transmitter and receiver next to the camera sensor. The principle is to send a beam, which is then returned. The phone measures this time and then uses it to calculate the distance to the subject to focus on. This method works very well even in low light conditions, on the contrary, it is not suitable for scanning objects at a distance, because the laser beam does not have to return to the source.
172
173\subsubsection{Stabilization}
174The stabilization in the phone camera can be electronic or optical.
175
176Electronic stabi-lization works by keeping the entire camera fixed and stationary. Stabilization is done bystabilizing the scanned image based on software algorithms that analyze the movementof the phone using its motion sensors. With optical stabilization, the camera module isphysically moved based on gyroscope data. This eliminates unwanted shocks, for examplewhen scanning by hand. Standard optical stabilization only takes place in two axes, moreadvanced cameras also offer four-axis stabilization.
177
178Optical stabilization is especially suit-able for video stabilization and also when shooting in low light conditions, as this allowsa longer shutter speed to be set \cite{8} \cite{9}.
179
180\subsection{Neural networks}
181Neural networks are currently considered by many to be one of the best machine learning algorithms. They can bring results with very high accuracy in selected tasks and have a relatively wide range of applications. For example, in computer vision or audio processing applications. Depending on the architecture used, they can sometimes be referred to as deep machine learning \cite{10}.
182
183\subsubsection{Vector, matrix, tensor}
184Vector, matrix and tensor are basic concepts that need to be understood to get closer to neural networks. The neural network does not recognize images like humans, so they need to be "translated" into a language it understands. This language is mathematics.
185
186To get started, you need to define the vector correctly. It is defined by the form $X \epsilon R^{D}$, which suggests a column vector that has D elements. It is also known as a first-degree tensor because it consists of a one-dimensional array.
187
188The higher class of a vector is a matrix that can be written in the form x ∈ RHxW. It follows that we have a matrix that has H rows and W columns. As with the vector, we can call it a second-degree tensor, since it is a two-dimensional array. Furthermore, it is to be understood that a vector is a matrix that is written as a single column and D rows.
189
190However, an even higher degree is the tensor (from which the name of the framework TensorFlow is derived), which can be written in the form x ∈ RHxWxD. This is a designation for a third-degree tensor, as it is a three-dimensional array containing HxW-shaped matrices.
191
192Since color images are stored in RGB formats, then the tensor in the image can be presented as HxWx3, i.e. the image has three channels (red, green and blue). As a result, each channel is an HxW matrix that contains RGB pixel values. Thanks to such background math, the network can work with the image right from the start. However, working with the matrix is easier than working with the tensor, so the image is converted to a gray color, consisting only of black and white. Subsequently, we will remain in the form of HxW \cite{11}.
193\begin{figure}[!htbp]
194 \centering
195 \includegraphics[width=14cm]{img/DP_vector-matrix-tensor.jpeg}
196 \caption{Vector, Matrix, Tensor}
197 \label{Vector, Matrix, Tensor}
198\end{figure}
199\pagebreak
200
201\subsubsection{Neuron}
202In figure 3 is a mathematical neuron model. It works by entering the values of a vector, matrix or tensor into the input neuron, but the neuron accepts these values in the form:
203\[ x = (x1, x2, x3, ..., xn+1) \]
204
205\noindent and then multiplies them by the weight vector:
206\[ w = (w1, w2, w3, ..., wn+1) \]
207
208These weights determine the importance of the particular component of a given input tensor that comes to the input. At the same time, they can acquire binary or real values. Inside the neuron, the values pass through the activation function and continue to the output. A similar scenario occurs in neurons that are in other layers, depending on which part of the process is to be performed \cite{14}.
209
210\begin{figure}[!htbp]
211 \centering
212 \includegraphics[width=14cm]{img/DP_neuron.jpeg}
213 \caption{Neuron scheme}
214 \label{Neuron scheme}
215\end{figure}
216\pagebreak
217
218\subsubsection{Convolutional neural network}
219Convolutional neural network is a type of network that has found its application mainly in the field of computer vision, but successful systems also appear in the processing of speech and natural language.
220
221Those type networks use several properties. The basic property taken from the visual part of the brain is the local connection, which allows the neuron in the hidden layer to connect to the area of neurons in the previous layer (receptive field). The second property of convolutional networks is the n-dimensional dimension of layers. For image data, the layers have three dimensions, i.e. height, width and depth, so that the input layer can have a depth represented by three RGB channels. A third critical feature is that certain weights are shared, for example, all neurons in the convolutional layer at a given depth have shared weights. These properties are an advantage over conventional forward networks, in which the input layer for the image would consist of many neurons and a huge number of link-weights to the next layer.
222
223Convolutional networks mostly consist of the input layer, followed by combined layers of convolution, pooling and ReLU. Before the output layer, there is one more fully connected layer into which the data compressed into one dimension enters. The output from such a layer can be used as a descriptor for other machine learning algorithms.
224
225A description of the convolution and pooling layer can be found in the following sections. Convolutional networks are trying to learn more and more complex signs. In the initial layers, the convolutional network encodes low-level signs such as edge detectors and simple color transitions. In the following layers, these can already be, for example, signs for shapes such as a semicircle or multicolor gradients. In the last layers we already find signs for individual objects or very complex shapes.
226
227\begin{figure}[!htbp]
228 \centering
229 \includegraphics[width=14cm]{img/DP_CNN.png}
230 \caption{Convolutional neural network}
231 \label{Convolutional neural network}
232\end{figure}
233
234\newline
235\newline\noindent \textbf{Convolution layer}
236\newline\indent The basic building block of convolutional networks is the convolutional layer. We will explain the architecture and properties of this layer on the problem of image recognition. In this case, the layers have three dimensions, i.e. height, width and depth. The convolution layer is fed either to the input data (input layer) or to the Pooling layer, ReLU or convolution again. Each neuron in the convolutional layer is connected to a subregion in the previous layer. This subarea is local in the dimensions of width and height but complete in depth. We can imagine this connection in the following example. Assume that the output from the previous layer has a size of 30x30x5, where the first two numbers indicate the height and width and the last number indicates the depth. Let the subregion perceived by the neuron in the convolutional layer have the dimensions of a square of size 4. Then the given neuron forms a 4x4x5 connection / weights to the previous layer. It is necessary to be aware of the completeness of the connection of this neuron in depth, therefore, in addition to the areas of the square, it also forms a connection for neurons in depth in the previous layer.
237
238\newline\noindent \textbf{Pooling layer}
239\newline\indent The pooling layer is an important layer in convolutional networks. This layer serves to spatially reduce the inputs, thus subsampling the input from the previous layers. This reduction will cause a reduction in the number of parameters in the other layers. A smaller number of parameters in the layers accelerates the overall training of such a network. Also, smaller layers in terms of the number of parameters improve the generalization of the model.
240
241For this layer, two parameters are specified, step and window / filter size, similar to the convolution layer. Normally, the size of the filter 2 is used in steps of the same size so that the areas do not overlap. The pooling layer can be represented by the type of filters. If the filter selects the maximum value from the area, we talk about the MaxPooling layer. For some models we can find a filter that averages the values in a given area (AvgPooling). This layer does not store any weights, it only serves to transform the input to the output, similar to the activation layer. The figure above shows how such a pooling operation takes place \cite{30} \cite{31}.
242
243\begin{figure}[!htbp]
244 \centering
245 \includegraphics[width=14cm]{img/DP_pooling.png}
246 \caption{MaxPooling vs AvgPooling}
247 \label{MaxPooling vs AvgPooling}
248\end{figure}
249\pagebreak
250
251\newline\noindent \textbf{\acrshort{ReLU} layer}
252\newline\indent The \acrshort{ReLU} layer represents the activation layer. In the context of convolutional networks, activations are written separately as the layer itself, as it can be fed to conventional fully interconnected layers, convolutional layers, or pooling layers. The \acrshort{ReLU} layer is used in convolutional networks for its speed, since, unlike sigmoidal functions, it does not have to compute complex exponents. It can also deal with a disappearing gradient well enough. Most often, the \acrshort{ReLU} layer is fed immediately after the convolutional layer or the fully interconnected layer \cite{32}.
253
254\newline\noindent \textbf{Network learning}
255\newline\indent With a few exceptions, the learning of convolutional networks is the same as in classical common networks. An error backpropagation algorithm is used. Convolutional networks, like other models of neural networks, require a lot of data for training. The technique is often used, where an already trained network is taken and only trained for another problem (finetuning). Convolutional network training can be very computationally intensive. The initial convolution layers take up the most memory space for large input and often more filters. The outputs from these filters must be temporarily stored in memory as they will be used in the reversal. However, the initial convolution layers do not contain as many parameters as they use weight sharing. Fully interconnected layers in the network contain the most parameters \cite{33}.
256
257\noindent \textbf{Transfer learning}
258\newline\indent In order for the neural network to be as successful as possible and for the individual layers to be able to represent quality signs, the convolutional neural network requires training on a large sample of data. The large sample of data, means several hundred gigabytes or even terabytes of data. Training on such an extensive data set can take a long time (several weeks) even on a computer farm with graphics cards. In addition, virtually a few companies in the world, such as Google, Microsoft, Apple, Facebook, Baidu, and photo banks such as Flickr and Picasa, have access to such data and at the same time high computing power. It is these companies that cooperate with research groups as they also have sufficient computing power. There are two basic approaches that are mainly used in convolutional networks, those are fine-tuning and the use of the network as a sign extractor \cite{34}.
259
260\noindent \textbf{Fine-tunning}
261\newline\indent Fine-tuning is a technique where we take an already trained net or weights of net layers and use this net for a new problem. Such a network can be, for example, a convolutional neural network trained on a data set from Imagenet. This old network already has sufficiently good features (edge and shapes detectors) encoded in the first layers, which will probably be suitable for the new problem as well. Then just change the layers we need, most often the last or last two layers of the network. We can freeze layer weights that we do not want to adjust completely. Training a network on a new dataset will be much faster than on a network with random weights at the beginning \cite{35}.
262
263\noindent \textbf{Extractor network}
264\newline\indent The second common way is to use the created network and use the output from one layer as a sign vector for another model in the field of machine learning. When classifying images, the output from one of the penultimate layers of the convolutional network and subsequent use in the algorithm to the nearest neighbors is often used. The autoencoder can also be used to extract signs. For example, in the context of images, it can learn to detect edges. With this type of model, we remove the decoding part from the network and obtain new signs when passing data through the coding part \cite{36}.
265
266\subsubsection{Recurrent neural network}
267A recurrent neural network is a type of model that can receive data with a time context. It is therefore sequential data of the type of stock price development on the stock exchange or video. The advantage is that the length of the sequence can vary within both the training and test set, and there is not as much limitation of the fixed input as we know from the classical forward neural network.
268
269The ability of the variable length of the input sequence is crucial in a recurrent network. This capability results from the property of the network that the weights in the network are shared for all parts of the sequence. The step of the sequence \textit{x} at time \textit{t} is denoted as $x_{t}$.
270
271This network has the ability to partially remember what was input in the previous time context. The reason is the hidden state and recurrent connection of certain neurons or layers. This means that, for example, neurons in a hidden layer have two types of connections. In addition to being connected to the next layer, they also contain recursive connections to each other. Also important is the state in the hidden layer $h_{t}$ in which all previous steps that passed through the model are gradually coded.
272
273\noindent Let's consider a network with one hidden recurrent layer. The forward passage of a sequence through such a network has three basic calculations, which are repeated for each step of the $x_{t}$ sequence:
274\begin{itemize}
275 \item from the entrance to the hidden neuron / layer,
276 \item from the hidden layer / neuron to the next hidden layer,
277 \item from the hidden layer / neuron to the output.
278\end{itemize}
279
280Thus, let's label the connections from the input to the hidden layer as $W_{hx}$, from the hidden layer to the output as $W_{hy}$, and from the hidden layer recursively as $W_{hh}$. The state in the hidden layer $h_{t}$ at time t is calculated as follows:
281
282\[ h_{t} = \sigma((W_{hh}h_{t-1}) + W_{xh}X_{t} + b_{h}) \]
283
284\noindent The output of the network y at time t is calculated using the following formula:
285
286\[ y_{t} = \sigma(W_{hy}h_{t}) \]
287
288Consider a step of the sequence $x_{t}$ where t takes the values \{0, ..., T\}, where T > 1. Before the sequence passes through the network, the hidden state is initialized to zero. For the first step of the sequence $x_{0}$, the output from the input layer through the hidden layer and from the hidden layer to the output is calculated. The output is calculated based on the output from the hidden layer and the hidden state. In the next steps of calculating $x_{t}$ for t > 0, the output is calculated again, but this time the previous sequence is also encoded in the hidden state.
289
290\noindent \textbf{Learning recurrent networks}
291For the training of recurrent networks, a time-propagated backpropagation algorithm is again used. During training, must be again defined the error, i.e. the objective function of the problem. Cross entropy is most often used in recurrent networks.
292
293\begin{figure}[!htbp]
294 \centering
295 \includegraphics[width=14cm]{img/DP_RNN.png}
296 \caption{Sequence transition in recurrent neural network}
297 \label{Sequence transition in recurrent neural network}
298\end{figure}
299\break
300
301\noindent The error for one sequence, where $y'_{t}$ is the network prediction for the given step and $y_{t}$ represents the expected value, is given as:
302
303\[ J(y, y') = - \sum_{t=1}^{T} y_{t} \log y'_{t} \]
304
305Thus, the total error for a single sequence is defined as the sum of the errors for all steps of that sequence. In other words, when passing a sequence over a network, we get the error value that we accumulate for each step based on the cross entropy. The gradient for one sequence is defined as:
306
307\[ \frac{\Delta J}{\Delta W} = \sum_{t=1}^{T} \frac{\Delta J_{t}}{\Delta W} \]
308
309Training of recurrent networks is challenging, as they are directly affected by the problem of the disappearing (and exploding) gradient. This means that propagating the error across many layers leaves the gradients either too small or too large. In this case, it is the propagation of the error of the whole sequence over time. So, the longer the sequence, the more demanding the training is. The recurrent network works very well for short sequences. However, for longer sequences, we may require information that was almost at the very beginning when predicting the rest of the sequence. This information is quickly lost in normal recurrent networks \cite{37} \cite{38}.
310
311\section{Used technologies}
312This chapter contains a basic description of all technologies used during implementation such as frameworks, libraries and 3D reconstruction software.
313
314\subsection{Docker}
315Docker provides the ability to package and run an application in a freely isolated environment called a container. Isolation and security allow you to run multiple containers on a given host at the same time. Containers are lightweight because they do not require additional hypervisor loading, but run directly in the host computer's core. This means that you can run more containers on a given combination of hardware than if you were using virtual machines. You can even run Docker containers on hosts, which are actually virtual machines. Docker is available for free in a community release, but corporations are encouraged to purchase an enterprise version of the platform. The key difference is that the enterprise version of Docker includes professional support. Docker can be run on Unix systems, Windows and even macOS. Docker offers an extension called Docker Compose, which is primarily designed to define and run Docker applications with multiple containers. This program uses the YAML file to configure services.
316
317\begin{figure}[!htbp]
318 \centering
319 \includegraphics[width=9cm]{img/DP_docker-yaml2.png}
320 \caption{Example of docker-compose.yml file}
321 \label{Example of docker-compose.yml file}
322\end{figure}
323\pagebreak
324
325Docker allows you to virtualize the entire environment in which the test databases run, so that all databases can be in the same environment. Docker uses so-called images. Such an image is a template that contains a set of instructions for creating a container that can be run on the Docker platform. It provides a convenient way to package applications and preconfigured environments. Thanks to this, we can create an image of the database, which already contains the necessary configurations and data. This simplifies overall testing and ensures fairness, as all databases run in the same environment. Because of all these features, Docker was chosen as one of the primary testing tools. Although working with Docker is not trivial, it allows you to create a testing environment in which the ability to repeat tests is extremely easy. It also allows you to easily extend the test environment to other people who would be interested, because all the images used in the practical testing are available for download for everyone in the online repository \cite{12}.
326
327\subsection{Meshroom}
328Meshroom is a freely available open-source software based on the framework
329AliceVision. AliceVision provides algorithms for 3D reconstruction and camera surveillance. AliceVision's goal is to provide a strong software base with state-of-the-art computer vision algorithms that can be tested, analyzed and reused. To run the program itself, you must have the AliceVision framework installed. Meshroom is supported on Windows and Linux operating systems \cite{13}.
330
331\noindent Meshroom focuses on two possible uses:
332\begin{itemize}
333 \item easy retrieval of a 3D model from a dataset with minimal user action,
334 \item offering a modifiable solution for advanced users.
335\end{itemize}
336
337\newline\indent AliceVision is a framework using the so-called pipeline, i.e. a stream of data from the initial modifications to the final rendering of the 3D model.
338
339\noindent AliceVision photogrammetric pipeline contains:
340\begin{itemize}
341 \item Extraction of natural functions
342 \item Comparison of images
343 \item Comparison of features
344 \item Structure from motion
345 \item Depth map estimation
346 \item Meshing
347 \item Texturing
348 \item Localization
349\end{itemize}
350
351\newline\indent The advantage of Meshroom is great simplicity of operation, the disadvantage is the non-existent documentation, system instability and insufficient response to the user.
352
353\subsection{PostgreSQL - !!! zrejme tu nebude !!!}
354
355\subsection{OpenCV - !!! zrejme tu nebude !!!}
356
357\subsection{TensorFlow}
358TensorFlow is an open-source library for machine learning. TensorFlow was developed by Google to meet the needs of systems capable of creating and educating neural networks. To find and decipher patterns and correlations, analogous learning and reasoning used by people. TensorFlow is currently used in Google products. It often replaces the role of its closed-source predecessor, DistBelief. TensorFlow was originally developed by the Google Brain team for internal Google use. But then it was released on February 9, 2015 under the open source Apache 2.0 license.
359
360TensorFlow is the second generation of machine learning. The architecture allows you to work on multiple CPUs and GPUs. The environment uses a Python interface. It can use optional CUDA add-ons for graphics card calculations. It can be used on Windows, Linux, macOS platforms. It can also be used on Android and iOS mobile platforms.
361
362TensorFlow calculations are expressed as state graphs of data flows. The name TensorFlow is based on multidimensional arrays, so-called tensors, on which neural networks perform operations. Google made its own TPU (Tensor Processing Unit) for these calculations \cite{39}.
363
364\subsubsection{Advantages of Tensorflow}
365The biggest advantage that TensorFlow provides is abstraction. Instead of having to implement various algorithms and other things, the developer can focus directly on the overall logic of the application. TensorFlow takes care of the details in the background and the developer uses ready-made objects / methods.
366
367Another advantage is the TensorBoard. It is a visualization tool that displays the TensorFlow graph itself. TensorBoard therefore shows what the network looks like and where this data passes. How the data that passes through the graph changes and evolves. The advantage of TensorBoard itself is that its output can be viewed in a standard Internet browser.
368
369\subsubsection{Usage of TensorFlow}
370TensorFlow is used by many large companies for various purposes. Airbnb uses TensorFlow to classify images and improve the customer experience. Thanks to machine learning from Google, PayPal is able to recognize fraudsters and their plans. Thanks to TensorFlow, Twitter is able to ensure that a user does not miss an important tweet if they follow hundreds of people. Last but not least, Google uses them in its own products such as Gmail, Google search or translator. TensorFlow offers a lot of possibilities to use it. It can also be used by anyone.
371
372\subsubsection{Image recognition}
373Image recognition focuses not only on recognizing people and objects in images and identifying them, but also on understanding their context. That is, what the object does or why it is there. It is most often used on social networks or security devices.
374
375TensorFlow algorithms identify and classify objects within larger images. This is very often used in engineering applications to recognize shapes for modeling purposes (3D spatial construction from 2D images). Another example of use is the tagging of people in photos on social networks (Facebook Deep Face).
376
377Image recognition is beginning to expand in the healthcare sector, where TensorFlow algorithms can process more information and record more samples. Computers are now able to scan scans and record more disease than humans.
378
379In some cases, it can be seen that the program cannot unambiguously determine which image it is. This is because the machine cannot divide the image into smaller parts and separate them from each other. It simply scans the image pixel by pixel and then looks for a similar match for any images it has previously specified or looks for them in already managed specified images.
380
381\subsubsection{Voice and sound recognition}
382Other known uses of TensorFlow are audio-based applications. Neural networks are able to decipher audio signals if the sound is given to them as they need it.
383
384\noindent Some sample usages:
385\begin{itemize}
386 \item \textbf{Voice recognition} - Used in security (when entering a building).
387 \item \textbf{Voice search} - Most commonly used in telecommunications. For example, Google uses voice search when used by a search engine.
388 \item \textbf{Defect detection} - Most commonly used in the automotive and aerospace industries.
389 \item \textbf{Voice-activated helpers} - They are widely used in smartphones and computers. These helpers can be dictated by the voice of the action, which is then performed by the mobile phone. Whether writing SMS messages, emails or adding notifications to your calendar. The most famous helpers are Siri from Apple, Google Now for Android and Cortana for Windows and Windows Phone.
390 \item \textbf{Speech-to-text applications} - These applications first analyze an audio file to identify the language and then transcribe it from spoken word to text. These applications can be used to specify mere snippets of audio or also in larger audio files. For example, they can create movie subtitles \cite{40}.
391\end{itemize}
392
393
394\subsection{Ionic}
395In the original version, the Ionic framework was built directly on the Angular framework. In the current stable version 5.3.4, it integrates the Web Components standard, it is independent of Angular, although it is expected to be used by developers. The goal of developing the current version was to enable the use of the Ionic framework by developers who prefer other technologies - such as React or VueJS \cite{15}.
396
397Angular as such is completely independent of use within a particular technology - all it needs is a modern web browser. It provides the programmer with the basic functions necessary for application development - the ability to create components, \acrshort{URL} routing, property / event binding and dependency injection. However, it does not provide us with any components for creating a user interface, it does not offer any integration with Cordova, it is simply a web framework for application development, nothing more, nothing less.
398
399\noindent Here is exactly Ionic, which provides us with some very important features for mobile application development:
400
401\begin{itemize}
402 \item connection to Cordova framework / Capacitor runtime,
403 \item user interface components supporting touch control,
404 \item integration with native mobile phone functionality,
405 \item assembly support tools and utilities.
406\end{itemize}
407
408Thanks to this, we have technology at our disposal that allows us to easily connect the development in Angular from the point of view of the developer, but at the same time it complements our pre-prepared integration with the Cordova framework. It is important to mention here that Ionic does not replace Angular technology, but on the contrary - it builds on it and expands it with other possibilities \cite{16}.
409
410\subsubsection{\acrshort{GUI} components}
411Ionic provides a large number of \acrshort{GUI} components optimized for use on mobile devices such as list, navigation menu, form input elements, toast alerts (information message displayed for a short time on the device). These components are implemented as components of Angular technology, so we do not have to use anything special or specific for Ionic to use them. Of course, all components also support property or event binding, so they can be easily used in Angular.
412
413One of the great benefits of the Ionic framework over older technologies (e.g. jQuery Mobile) is the adaptation of the appearance of components to the given platform. Ionic uses so-called "Platform CSS" - specific \acrshort{CSS} styles that only apply to certain platforms. The aim is to ensure the most similar appearance to native applications - ie. to look natural for users of the platform \cite{17}.
414
415\noindent In the current version, Ionic uses the following platform skins by default:
416\begin{itemize}
417 \item \textbf{Material Design} – used on the Android platform, built on the design pattern of the same name by Google,
418 \item \textbf{iOS Design} – standardly used on Apple's iOS platform, based on its standard appearance and iOS Design Guidelines.
419\end{itemize}
420
421\subsubsection{Responsive design}
422Responsive design is a modern trend in web development and user interface design. The basic idea is very simple. The design adapts to the screen size so that the same design can be used at different resolutions and physical screen sizes. This approach is extremely important when developing multiplatform applications - the application can run on a mobile phone (and each model has a different resolution and screen), but also, for example, on a tablet or desktop computer.
423
424\noindent Responsive design has several basic differences from previously used techniques:
425\begin{itemize}
426 \item not using absolute coordinates,
427 \item limited use of absolute units (eg pixel) - we prefer relative (eg vw / vh - ratio to page width / height, em / rem - based on font size),
428 \item flexible layout changes depending on the size (eg on the large display we always display the menu, on the small one we hide it, etc.).
429\end{itemize}
430
431\noindent The following \acrshort{CSS3} technologies are key elements for the implementation of responsive design:
432\begin{itemize}
433 \item \textbf{Flexbox} - a technology used for dynamic, horizontal positioning. Used e.g. to set the sizes of controls side by side (eg for forms),
434 \item \textbf{Grid} - expands the possibilities of Flexbox with the possibility of vertical positioning..
435\end{itemize}
436
437Both technologies make it possible to define which elements can be enlarged and how, as well as to define their dimensions relative to other controls.
438In the Ionic framework, these technologies are used to implement the so-called typographic grid. Its principle is very simple - the horizontal surface is divided into 12 separate parts called columns and the sizes of individual components are specified as multiples of one piece.
439
440\newline\noindent The second no less important principle are the so-called device categories (display sizes):
441\begin{itemize}
442 \item \textbf{xs} < 576px
443 \item \textbf{sm} >= 576px
444 \item \textbf{md} >= 768px
445 \item \textbf{lg} >= 992px
446 \item \textbf{xl} >= 1200px
447\end{itemize}
448
449These categories are used in cooperation with Flexbox and Grid to create different sizes for different displays - eg for lg 1/12, or for sm eg 4/12 grid width. In addition, the grid will automatically take care of the break if the size in one row would exceed 12/12 of the size. This allows us to very efficiently create user interfaces that look good on both large displays (PC, tablet) and small (mobile devices) \cite{18}.
450
451\subsubsection{Modules}
452Plug-ins Ionic supports a large number of plug-ins. These plugins are typically linked to Cordova plugins or Capacitor plugins. The reason for this "packaging" is that the mentioned technologies use pure JavaScript. In the Ionic framework, however, developers use TypeScript language, which is a syntactic superset of JavaScript / ECMAScript 6.
453
454Direct use of Cordova plugins would therefore not be convenient or natural for the programmer. For this reason, Ionic plug-ins are used, which we typically import into the application as Angular modules. It provides TypeScript / Angular services that we can obtain using dependency injection. These services usually do not execute their own logic, but only call the appropriate Cordova or Capacitor modules and provide type definitions of their data structures. An example is the use of the Storage plugin, which allows access to the local memory of the phone \cite{19}.
455
456\subsubsection{Command line interface}
457The Ionic team has developed "ionic-cli", a command line support utility for creating new projects, translating existing ones, and managing plugins. It is an alternative to the "ng" utility provided directly by the Angular framework, which is used to build and test applications.
458
459\newline\noindent This utility (ionic-cli) integrates several assistive technologies to ensure its functionality:
460\begin{itemize}
461 \item \textbf{\acrshort{NPM}} – project dependency management,
462 \item \textbf{WebPack} - compilation of the resulting application, minification of JS and CSS files,
463 \item \textbf{Cordova} - management of platform applications and their plugins,
464 \item \textbf{Capacitor} - like Cordova, it allows you to manage platforms and their plugins,
465 \item \textbf{\acrshort{TSC}} - translation of TypeScript codes into ECMASCript 2015,
466 \item \textbf{\acrshort{SASS}} – translation of SCSS styles into CSS,
467 \item \textbf{Ionic Pro} – optional cloud commercial service for testing and building applications provided by framework developers.
468\end{itemize}
469
470The use of ionic-cli is therefore by no means necessary or required - on the other hand, the integration of all these, usually necessary, technologies together is very complex and complicated. Therefore, the use of ionic-cli is the absolute standard in almost all Ionic projects \cite{20}.
471
472\subsection{VueJS}
473VueJS (Vue) is a JavaScript framework used on the frontend to create dynamic user interfaces. This is a relatively new framework created by a former developer from the Angular team. Vue is so fast and at the same time small (meaning size) library, because it does not contain many functionalities. A fast learning curve can be considered as a big advantage.
474
475\subsubsection{Components}
476The basic element of a Vue application is a component. Components are written to a file with a \textit{.vue} extension. The file can be divided into three parts as a template, model and styles. Templates use HTML-based syntax. You can also use v-directives, which are special HTML attributes prefixed with "v-". If the value of such a directive changes, Vue reactively updates the interface. Such directives include, for example, v-if for conditional content rendering or v-for for loop usage.
477\newline
478\begin{figure}[!htbp]
479 \centering
480 \includegraphics[width=8cm]{img/DP_vue.png}
481 \caption{Example of Vue component}
482 \label{Example of Vue component}
483\end{figure}
484\pagebreak
485
486The part defining the model for the template must be written between the script tags and its syntax corresponds to a javascript object. The most important part of an object is the data function, which represents its state. Data must be stored within a function to maintain a unique instance for each component instance. If the data were stored as a simple object, changing the data in one component would be reflected in the other instances.
487
488Individual items of this object can be printed in a template. Any change to this object will automatically reflect the change to the template. An object can contain many other attributes, such as the methods, properties, or lifecycle hooks. The last part of the component is cascading styles written between style tags. These styles are scoped primarily to the component \cite{21}.
489
490\subsubsection{Router}
491The single page application is a non-standard behavior for users, because it is only one page whose content changes dynamically, but the \acrshort{URL} does not. The user is accustomed to changing the \acrshort{URL} address of individual pages and that the forward and backward buttons can be used in navigation. The Vue Router library is used to remove this obstacle. It allows you to map components to different paths. Each page is defined by a path, name, and component \cite{22}.
492
493\subsubsection{Vuex}
494The Vuex library is used to maintain the global state of the application and was created directly for Vue. It can be used in a project if multiple components depend on one state or components from different parts of the application need to access or change the same data.
495
496\noindent The basic parts of Vuex include:
497\begin{itemize}
498 \item \textbf{state} - represents an object that contains data to be available throughout the application
499 \item \textbf{getter} - used to access data stored in the state
500 \item \textbf{mutations} - used to make changes
501 \item \textbf{actions} - used for asynchronous processing or mutation invocation
502\end{itemize}
503
504Vuex storage can grow to a large size and thus become very confusing. The solution is to divide it into logical units. One of the possibilities is the disintegration into its individual parts as separate files. The second option is to create modules. Each module should contain its own states, mutations, actions and getters and represents a certain functionality of the application. Individual modules can exist both in the global namespace and in their own namespace, which eliminates the problem of possible collisions in variable names \cite{23}.
505
506\subsection{Laravel}
507Laravel is a PHP Framework for web applications. The Laravel framework was created by Taylor Otwell as a replacement for the older PHP Framework CodeIgniter. The first official version of the framework was published on June 20, 2011. Until the end of 2014, the development of this framework was Otwell's side activity. Since January 2015, working on Laravel has been his main activity. Laravel is generally based on simple and clear code and is optimized for real web applications.
508
509\begin{figure}[!htbp]
510 \centering
511 \includegraphics[width=14cm]{img/DP_laravel.png}
512 \caption{Laravel}
513 \label{Laravel}
514\end{figure}
515\pagebreak
516
517\subsubsection{\acrshort{MVC} architecture}
518This type of architecture uses many web frameworks, including Symfony, .NET and also Laravel. Model-View-Controller is a software architectural model whose basic idea is to separate logic from output. The main application is most often client / server applications (web applications). It aims to solve the problems of the so-called "spaghetti code", where we have logical operations in one class and at the same time render the output. This means that the file contains database queries, logic, and various \acrshort{HTML} tags. The author of this architecture is Trygve Reenskaug, who designed it in the 1970s.
519
520\begin{figure}[!htbp]
521 \centering
522 \includegraphics[width=14cm]{img/DP_MVC.png}
523 \caption{\acrshort{MVC} design pattern}
524 \label{MVC design pattern}
525\end{figure}
526\pagebreak
527
528\noindent The whole application is therefore divided into three parts, which are called: model, view, controller.
529\begin{itemize}
530 \item \textbf{Model} – contains application logic and data, which includes database queries, calculations, validation, etc. The function of the model is based on the acceptance and processing of parameters. He does not know about the existence of a view or controller.
531 \item \textbf{View} – this layer takes care of displaying the output to the user. It contains the minimum amount of logic required to render. The view layer does not know where the data comes from, it only takes care of their listing. Web frameworks typically use template systems for greater user convenience.
532 \item \textbf{Controller} – is a control layer that acts as an intermediary for the model and view. It processes all requests from the user, communicates with the model and the view and interconnects them.
533\end{itemize}
534
535\newline\indent The user performs an action in the user interface. This action is captured by the controller. The controller uses the model to get all the data it needs. The controller transmits this data to the correct view. Subsequently, the view is displayed to the user \cite{24}.
536
537\subsubsection{Directory structure}
538The default directory structure provides a good start for small and large applications. The user can adapt other directory organization to his needs.
539
540\begin{itemize}
541 \item \textbf{app} – this directory contains the main application code.
542 \item \textbf{bootstrap} – the files contained in this directory are used to start the framework and configure autoloading. Inside the directory, there is also a cache folder, which contains framework-generated files to optimize performance.
543 \item \textbf{config} – contains all application configuration files.
544 \item \textbf{database} – this folder contains database migrations and seeders.
545 \item \textbf{public} – this directory contains the index.php file, which is the entry point for all application requests. There are also images, javascript or css files.
546 \item \textbf{resources} – here are all views and uncompiled files, such as \acrshort{SASS} or Javascript. There are also multilingual files for easy translation.
547 \item \textbf{routes} – this folder contains all defined paths (routes) of the application. There are three files web.php, api.php and console.php.
548 \item \textbf{storage} – this directory contains compiled blade templates, sessions, cache and other files generated by the framework, as well as app, framework and logs folders.
549 \item \textbf{tests} – this directory contains all integration tests and unit tests.
550 \item \textbf{vendor} – here are placed all composer packages.
551\end{itemize}
552
553\noindent Important files located in the project directory:
554\begin{itemize}
555 \item \textbf{.env} – application environment settings.
556 \item \textbf{artisan} – PHP script implementing the console. Allows you to run artisan commands on the command line that are used when developing an application.
557 \item \textbf{composer.json and composer.lock} – contains information about PHP library versions.
558 \item \textbf{package.json} – this file contains npm. library version information.
559 \item \textbf{webpack.mix.js} – webpack settings \cite{25}.
560\end{itemize}
561
562\subsubsection{Migrations}
563Migration can be thought of as a database versioning system that allows a team of collaborators to modify and share a database structure. Migrations eliminate the need to create database tables manually. For larger applications, this process is very time consuming and error prone. Migration unifies this process. This works by creating a migration file in which the required structure of database tables is defined. Then we start the migration and Laravel will take care of the rest for us. Migrations after generation can be found in the app / database / migrations folder and are typically paired with the Schema builder, which is a class containing methods for defining and modifying database table structures \cite{26}.
564
565\subsubsection{Seeders}
566Laravel offers its users an easy way (seeding) to upload test data to a database using special classes. Using these seed classes, we define Laravel, what type and how much data to insert into a particular table. This data can be defined manually or randomly generated using the Factories described below. All seed classes are stored in the database / seeds directory \cite{27}.
567
568\subsubsection{Factories}
569When testing, a developer may need to insert data into a database. Instead of manually specifying values for each column of the table, Laravel allows you to define basic attribute settings for each Eloquent model using Factories. The Faker generator library is used to generate specific records. This library generates data so that its shape is as similar to reality as possible. We can generate records of various kinds, such as e-mail addresses, first names, user surnames, telephone numbers. Factories are usually stored in the database / factories directory.
570
571\subsubsection{Eloquent ORM}
572Eloquent \acrshort{ORM} provides a simple implementation of the ActiveRecord design pattern for working with a database. Each database table has an appropriate Model for their interaction. The model allows you to create database queries, edit or insert new records without having to write raw \acrshort{SQL} queries \cite{28}.
573
574\subsubsection{Blade template system}
575Web frameworks use a variety of tools to work with templates. These tools aim to separate \acrshort{HTML} code from the programming language.
576
577\newline\indent Blade is a simple template engine provided by the Laravel framework. Unlike most template systems, Blade does not prohibit the use of \acrshort{PHP} code in a view, so it is not only used to insert variables into \acrshort{HTML} code. This template system uses a special syntax and compiles all views into pure \acrshort{PHP} code.
578
579These views are cached for future use for faster loading. Templates are cached each time you make a new edit. The Blade template system files use the \textit{.blade.php} extension and are stored in the \textit{resources/views} directory.
580
581Undisputed advantages of this template system include inheritance and division of views into sections or components. Each section then displays a specific part of the application. The first is to define the main template, the so-called layout, which is used for all other templates. Here you define the parts of the application that are the same for all pages, such as the header, footer, and menu. The content of each page is then loaded into this main template. The great advantage of this method is its simple maintenance and extendability \cite{29}.
582
583\begin{figure}[!htbp]
584 \centering
585 \includegraphics[width=16cm]{img/DP_blade.png}
586 \caption{Example of blade syntax}
587 \label{Example of blade syntax}
588\end{figure}
589\pagebreak
590
591\section{Implementation}
592The expected implementation is divided to two aspects of view. The first one, is the view as a a customer, an application administrator, who needs to provide his own server-side \acrshort{API} to his clients. The second one is the end-user view, a regular person, who has downloaded mobile application from App Store or Google Play.
593
594The application administrator is supposed to maintain his \acrshort{CMS} application in a system level. It means availability to provide \acrshort{CRUD} operations for all entities.
595
596\subsection{Functional requirements}
597\noindent \textbf{Administrator (customer)}
598
599Administrator is the entity which is allowed to maintain application via \acrshort{CMS}. This entity is able to manage all the data engaged in the Vitruviani application. A customer is provided by the login credentials as an administrator of his clients who use the application.
600
601After login he sees fully responsive \acrshort{UI} color-styled similar to Smartphone application. On the left-side is the navigation menu, which contains two menu groups - \textbf{Content} and \textbf{Settings}. In content are three items that reflect application entities with their data attributes:
602
603\begin{itemize}
604 \item \textbf{Users} - entity which reflects end-user with these attributes:
605 \begin{itemize}
606 \item Name
607 \item Surname
608 \item Height
609 \item E-mail
610 \item Password
611 \item Email verified at
612 \item TOS (if the user aggreed with the Terms of Service)
613 \item Active
614 \end{itemize}
615 \item \textbf{Measurements}
616 \begin{itemize}
617 \item User (related to measurement)
618 \item Photo from camera scan
619 \item Data parts (name and its positions)
620 \item Data pairs (name and its length)
621 \item Measurement accuracy
622 \item Active
623 \end{itemize}
624 \item \textbf{Avatars}
625 \begin{itemize}
626 \item User (related to avatar)
627 \item Gallery collection
628 \item Avatar
629 \item Meshed at
630 \item Active
631 \end{itemize}
632\end{itemize}
633
634The administrator should has full access to all data of these entities, except sensitive data such as password. He should be able to modify or delete them, but also create the new one (in case of users).
635
636\noindent Settings group contains also three menu items, related to application setup:
637\begin{itemize}
638 \item \textbf{Manage access} - used for \acrshort{CMS} users management, more administrators can be created
639 \item \textbf{Translations} - used for managing multilingual versions of CMS and Smartphone application
640 \item \textbf{Tos} - administrator can set his own Terms Of Service
641\end{itemize}
642
643Administrator also can update his profile, change own password or logout from the system via dropdown placed on the right side of the header. The whole \acrshort{CMS} has to be easily extendable for future clients requirements and features.
644
645\noindent \textbf{End user}
646
647End user can be anybody who is interested about his body measures and progressive photogrammetry technologies. He can easily download the Vitruaviani application from his App Store or Google Play (based on his smartphone platform). The first step is to register him as a new user. After successful sign up, the new user receive verification mail with instructions to activate his account. If the user is active, he can sign in to application and follow text instructions on each page of application. The whole \acrshort{UI} of the Smartphone application should be perfectly intuitive.
648
649\noindent Navigation of the application is provided via these bottom tabs:
650\begin{itemize}
651 \item \textbf{Analysis} - extended by charts to visualize user's strenghts and weakness based on his measurements
652 \item \textbf{Avatar} - there is ability to create your own 3D avatar with uploading pictures from Smartphone gallery
653 \item \textbf{Scan} - this page contains body scanning process via Smartphone camera
654 \item \textbf{Comparison} - contains option to compare yourself with some sample users and find out the occurrence of your body type in different sports
655 \item \textbf{Profile} - user is able to edit his profile information (except the e-mail) or log out from the application
656\end{itemize}
657
658\subsection{Non-functional requirements}
659
660\noindent An \textbf{administrator} needs to have or meet these requirements:
661\begin{itemize}
662 \item Server hosting with Docker.
663\end{itemize}
664
665\noindent An \textbf{end user} needs to have or meet these requirements:
666\begin{itemize}
667 \item Smartphone with iOS or Android OS,
668 \item the lowest screen size 4" diagonally,
669 \item device with internet connection with transfer speed minimally 256kbps,
670 \item the lowest hardware power of device: quadcore CPU 1,2 GHz, 1GB RAM.
671\end{itemize}
672
673
674\subsection{Use-case diagrams}
675Use-case diagrams graphically interpretate available cases that can be done by specific user. Common diagrams displays use-cases for administrator and end user actors.
676
677\begin{figure}[!htbp]
678 \centering
679 \includegraphics[width=16cm]{img/DP_uml_cms.png}
680 \caption{Use-case diagram for \acrshort{CMS} application}
681 \label{Use-case diagram for CMS application}
682\end{figure}
683\pagebreak
684
685\begin{figure}[!htbp]
686 \centering
687 \includegraphics[width=16cm]{img/DP_uml_smartphone.png}
688 \caption{Use-case diagram for Smartphone application}
689 \label{Use-case diagram for Smartphone application}
690\end{figure}
691\pagebreak
692
693\subsection{Measuring}
694The initial state of making Vitruviani was to make robust research of possible solutions of described problematic. The essence of application idea was measuring human body parts with Smartphone camera. That means some OpenCV algorithms and artificial intelligence were more than necessary. There were introduced two parallel processes, the process of body measurement and the process of creating 3D avatar. This chapter aims the first one, measurement process, so let's take the problematic closer.
695
696\subsubsection{Posenet}
697The measurement process demands of some input data - such as picture of human or video in case of real-time pose estimaton. Those data needs to be pre-processed for neural network and then processed by itself. In general, pre-processing contains data representation to numbers. There are applied filters and every pixel is represented as a numeric value with specific point position.
698
699Based on research, Posenet by Tensorflow is the best option, to get joint positions on human body picture in aspects of accuracy and speed.
700
701\subsubsection{First calibration ideas}
702The biggest blocker that had to be solved, was camera calibration. In more human words, it means converting pixel metrics to real world metric units, such as centimeters. The first solution attempt was to calculate it via camera specifications such as focal length, number of fixels, etc..
703
704
705The second attempt was usage BodyPix net by Tensorflow
706
707\subsubsection{Final calibration and calculations}
708tu bude popisane finalne riesenie (ze si scanovana osoba musi zastat na vysku celeho camera previewu)
709
710\subsection{3D model meshing}
711
712tu budu nejake screeny
713
714\subsection{Server-side application}
715The main tool used as a server-side application is a Laravel - "The PHP Framework for Web Artisans".
716\subsubsection{Database}
717In the beginning of a backend application development it's necessary to analyze which type of data will be stored and how they will be represented. It is good to create some database scheme to better understand relations between some tables, their cardinality and attributes.
718
719In case of the Vitruviani, initial state of project analyse brought the PostgreSQL database as the best idea to go in. The main reason of this decision was possibility of usage the \acrshort{JSONB} database attribute type. This data-type is represented same as the basic \acrshort{JSON} data-type (which is also included in ordinary MySQL database), but the major practical difference is one of efficiency. The json data-type is stored as an exact copy of the input (like raw text). That means the higher dificulty of processing, because it must be reparsed on each execution, while \acrshort{JSONB} data is stored in a decomposed binary object. Binary format is little bit slower to store, but way faster to read, since no reparsing is needed. So, during the analyse was taken the look for table attributes like translations, measurements and brought the conclusion, that there will be more "read" query requests than inserting them. \acrshort{JSONB} also supports table indexing, which can be a significant advantage to improve database performance and query time.
720
721\noindent Common database scheme describes the whole application data:
722
723\begin{figure}[!htbp]
724 \centering
725 \includegraphics[width=14cm]{img/DP_DB_scheme.png}
726 \caption{Database diagram}
727 \label{Database diagram}
728\end{figure}
729\pagebreak
730
731\noindent\textbf{Migrations}
732\newline Pre pohodlnejsiu pracu s databazou Laravel prinasa tzv. migracie, prostrednictvom ktorych je mozne definovat databazove tabulky, ich atributy, foreign keys a indexy. Migracia by default obsahuje 2 metody \textit{up()} a \textit{down()}:
733
734\begin{itemize}
735 \item \textbf{up()} - obsahuje definovanie akcie pre vytvorenie tabulky, pridanie noveho stlpca alebo jeho indexu, ci pridanie novej referencie,
736 \item \textbf{down()} - obsahuje reverzne operacie pre vsetky akcie definovane v metode up(), ako napriklad: dropnutie tabulky, stlpca, indexu,...
737\end{itemize}
738
739Migracie su v ulozene aj v samostatnej tabulke s nazvom \textit{"migrations"} z dovodu nadefinovania \textit{batch} atributu, ktory umoznuje verzionovanie stavu databazy. Korektne nadefinovane migracie mozu byt spustene a ovladane prostrednictvom artisan commandov:
740
741\begin{itemize}
742 \item \texttt{php artisan migrate} - sluzi na zavolanie obsahu metod \textbf{up},
743 \item \texttt{php artisan migrate:rollback}- umoznuje zavolanie obsahu metod \textbf{down}, stav databazy vrati (rollbackne) o jedenu verziu (batch), pripadne je mozne dodefinovat priznakom \texttt{--step}, konkretny pocet verzii,
744 \item \texttt{php artisan migrate:reset} - droppne vsetky tabulky z databazy
745 \item \texttt{php artisan migrate:refresh} - vykona commandy \textit{rollback} a nasledne \textit{migrate}
746 \item \texttt{php artisan migrate:fresh} - vykona commandy \textit{reset} a nasledne \textit{migrate}
747\end{itemize}
748
749\noindent\textbf{Models}
750\newline V ramci frameworku je mozne vyuzitie objektoveho pristupu k records in database. To umoznuju tzv. modely, ktore funguju ako triedy reprezentujuce specificku tabulku. Su v nich definovane rozne atributy a metody, ktore sluzia na pristup a modifikaciu dat. Na backende aplikacie su vytvorene nasledovne modely:
751
752\begin{itemize}
753 \item \textbf{AdminUser},
754 \item \textbf{User},
755 \item \textbf{Measurement},
756 \item \textbf{Avatar},
757 \item \textbf{Tos}.
758\end{itemize}
759
760\subsubsection{Authentication}
761All authentication actions, such as login and logout are provided via official Laravel package called Sanctum. Sanctum provides token based authentications, especially for mobile applications or APIs.
762
763\subsubsection{Authorization}
764role permissions, extendabilita, spatie library
765\subsubsection{Media storage}
766spatie media library
767
768\subsubsection{\acrshort{API}}
769Every \acrshort{API} call to server is verified by \textbf{app-key} header. This is used to verify known customers and avoid \acrshort{DDoS} attacks for customer's \acrshort{API} (for more security informations, read the chapter Security). The application key can be randomly generated hash, which is placed in \textit{.env} file as a \textbf{APP\_KEY}.
770
771All api routes are stored in \textit{routes/api.php} file and protected by the middleware class called \textbf{ApiChecker}, which checks if the key from the header equals to the key set in enviroment file. If the check pass, request just continues, in else, the \textbf{UnauthorizationException} is thrown with message: \textbf{'Incorrect api-key!'}
772
773\subsubsection{Requests}
774Requests are specific classes that represent object-oriented interaction with current \acrshort{HTTP} requests.
775\subsubsection{Controllers}
776Controllers su triedy, ktore pracuju s datami prijatymi v requeste.
777ake su controllery a ake akcie riesia
778\subsubsection{E-mails}
779ako sa posielaju maily, screeny mailov
780\subsubsection{\acrshort{CMS} \acrshort{UI}}
781Ako frontend cmska bol pouzity template z composer package zvaneho \textbf{Craftable}, ktoreho autorom je firma \textit{Brackets by Triad}. Craftable umoznuje generovanie Vue komponentov na zaklade navrhnuteho databazoveho modelu.
782
783\pagebreak
784\begin{figure}[!htbp]
785 \centering
786 \includegraphics[width=16cm]{img/DP_CMS_login.png}
787 \caption{CMS - login page}
788 \label{CMS - login page}
789\end{figure}
790
791\begin{figure}[!htbp]
792 \centering
793 \includegraphics[width=16cm]{img/DP_CMS_dashboard.png}
794 \caption{CMS - dashboard}
795 \label{CMS - dashboard}
796\end{figure}
797
798\begin{figure}[!htbp]
799 \centering
800 \includegraphics[width=16cm]{img/DP_CMS_profile.png}
801 \caption{CMS - update profile data form}
802 \label{Update profile data form}
803\end{figure}
804
805\begin{figure}[!htbp]
806 \centering
807 \includegraphics[width=16cm]{img/DP_CMS_users_index.png}
808 \caption{CMS - list of users}
809 \label{List of users}
810\end{figure}
811
812\begin{figure}[!htbp]
813 \centering
814 \includegraphics[width=16cm]{img/DP_CMS_users_index.png}
815 \caption{CMS - edit user}
816 \label{CMS - edit user}
817\end{figure}
818
819\begin{figure}[!htbp]
820 \centering
821 \includegraphics[width=16cm]{img/DP_CMS_users_index.png}
822 \caption{CMS - list of measurements}
823 \label{CMS - list of measurements}
824\end{figure}
825
826\begin{figure}[!htbp]
827 \centering
828 \includegraphics[width=16cm]{img/DP_CMS_users_index.png}
829 \caption{CMS - edit measurement}
830 \label{CMS - edit measurement}
831\end{figure}
832
833\begin{figure}[!htbp]
834 \centering
835 \includegraphics[width=16cm]{img/DP_CMS_users_index.png}
836 \caption{CMS - list of avatars}
837 \label{CMS - list of avatars}
838\end{figure}
839
840\begin{figure}[!htbp]
841 \centering
842 \includegraphics[width=16cm]{img/DP_CMS_users_index.png}
843 \caption{CMS - edit avatar}
844 \label{CMS - edit avatar}
845\end{figure}
846
847\begin{figure}[!htbp]
848 \centering
849 \includegraphics[width=16cm]{img/DP_CMS_users_index.png}
850 \caption{CMS - edit translation}
851 \label{CMS - edit translation}
852\end{figure}
853\pagebreak
854
855\subsection{Smartphone application}
856Pri vyvoji akehokolvek software je velmi dolezite zohladnit vsetky aspekty poziadaviek a zvolit spravne technologie. Tento fakt o to viac plati pri vyvoji Smartphone aplikacie, kedy na zaklade poziadaviek klienta, skusenosti vyvojarskeho teamu a projektoveho budgetu musi padnut rozhodnutie, ci bude dana aplikacia vyvijana nativne pre konkretne platformy (iOS / Android) alebo dostacuje vyvoj hybridnej mobilnej aplikacie.
857
858Vyvoj nativnych aplikacii vyzaduje vyssie naklady z hladiska mnozstva prace, taktiez vyvojari musia mat dostatok skusenosti s nativnym vyvojom, no prinasa aj mnoho pozitiv. Hlavnym pozitivom nativne vyvijanych aplikacii je ich vykon, kdezto hybridne aplikacie tieto vysledky nedosahuju. Preto ak poziadavky klienta obsahuju sucasti, ktore mozu byt zavisle na vykone, tak vyvoj nativnej aplikacie je na mieste.
859
860Hybridne aplikacie v porovnani s nativnymi umoznuju vyvojarovi paralelne vyvijat aplikaciu na rozne platformy. Vacsina dostupnych technologii funguje na principe kompilovania "hybridnej verzie" kodu do jeho "nativnej verzie". Prave pri tejto kompilacii dochadza k roznym nedokonalostiam a obfuskovaniu kodu, ktore maju vplyv na vysledny vykon aplikacie. Prax ale castokrat prinasa skusenost, ze pri vacsich aplikaciach, pripadne nasledkom dodatocnych specifikacii klienta je potrebne riesit aj nativny vyvoj do hybridne vyvijanej aplikacie.
861
862V pripade aplikacie Vitruviani boli uvazene vsetky aspekty poziadaviek na funkcionalitu, v ramci projektoveho planovania prace bol urobeny research dostupnych technologii, na zaklade ktoreho sa stal najlepsou volbou vyvoj hybridnej (multiplatformovej) aplikacie. Na zaklade tohoto rozhodnutia bola vybrana technologia Ionic, ktora umoznuje vyvoj Smartphone aplikacii tohoto typu.
863
864\subsubsection{Services}
865Services v Ionicu sluzia na definovanie http requestov smerujucich na API servera. Kedze projekt Ionicu je postaveny na jadre Angularu, rovnako ako aj v angulari, je mozne vygenerovat dany service zavolanim prikazu \textit{"ng generate service \textbf{service\_name}"}, v pripade Ionicu je mozne pouzit command \textit{"ionic generate service \textbf{service\_name}"}.
866
867Mobilna aplikacia Vitruviani obsahuje 7 implementovanych services, z toho ide o 5 page-specific services a 2 pomocne/abstraktne:
868\begin{itemize}
869 \item \textbf{HttpService} - Je navrhnuta pre lepsiu abstrakciu a pohodlnost prace z hladiska developera so zohladnenym aspektom na rozsiritelnost. Do \acrshort{HTTP} requestov pridava hostname servera, api-key a authorization token nevyhnutny pre spravnu token-based autentifikaciu pouzivatela na strane servera. Tuto service je mozne jednoducho injectnut do konstruktora inej service pomocou dependency-injection a easily volat jej metody. Obrazok nizsie popisuje danu service.
870 \item \textbf{NotificationService} - This service nevykonava ziadne priame requesty na server, sluzi len na extrakciu aplikacnej logiky, ktora riesi zobrazovanie roznych toast messages, prezentuje tzv loading-spinner v aplikacii. Taktiez moze byt pouzita prostrednictvom dependency-injection a v ramci aplikacii je mozne kdekolvek pouzivat jej metody, ktore su navrhnute tak, aby prinasali abstrakciu a umoznovali pohodlnu pracu pre developera.
871 \item \textbf{AuthService} - Obstarava operacie tykajuce sa prihlasenia, odhlasenia a registracie. Taktiez obsahuje interface reprezentujuci objekt Usera, ktory sa v akcii pouziva pri deklaracii premennych typu User.
872 \item \textbf{ProfileService} - Ide o page-specific service, obsahuje predovsetkym requesty na odosielanie formularov z ProfilePage, a teda ide hlavne o akciu zmeny profilovych udajov, ci akciu zmeny hesla.
873 \item \textbf{AnalysisService} - Obsahuje metody na requestovanie/odosielanie udajov tykajucich sa \textbf{AnalysisPage}
874 \item \textbf{ScanService} - Obsahuje metody na requestovanie/odosielanie udajov tykajucich sa \textbf{ScanPage}
875 \item \textbf{AvatarService} - Obsahuje metody na requestovanie/odosielanie udajov tykajucich sa \textbf{AvatarPage}
876\end{itemize}
877
878\begin{figure}[!htbp]
879 \centering
880 \includegraphics[width=14cm]{img/DP_ionic_service.png}
881 \caption{HttpService source-code}
882 \label{HttpService source-code}
883\end{figure}
884\pagebreak
885
886For better project structure, all services are separated to project subfolder \texttt{"services/"}.
887
888\subsubsection{Components}
889Vseobecne plati, ze ak v aplikacii existuju sucasti, ktore sa pouzivaju viac krat, pripadne su niektore stranky / komponenty robustne, tak z pohladu softverovej architektury, je pouzitie komponentov viac nez vhodne. Komponenty umoznuju vyclenenie aplikacnej logiky, a teda prinasaju vyhody pre programatora z hladiska prehladnosti projektu, no v neposlednej rade dokazu zlepsit performance aplikacie.
890
891V pripade mobilnej aplikacie vitruviani, ide predovsetkym o komponenty tykajuce sa grafickych zobrazeni (pretoze ich implementacia vyzadovala mnozstvo kodu) a taktiez header aplikacie, ktory sa pouziva na kazdej page. Tieto komponenty je mozne najst v projektovom subdirectory \texttt{"components/"}:
892
893\begin{itemize}
894 \item \textbf{bar-chart} - graficky zobrazuje silne a slabe stranky pouzivatela na zaklade jeho datovej vzorky,
895 \item \textbf{header} - obsahuje header aplikacie, ktory je pouzity na viacerych strankach aplikacie
896 \item \textbf{radar-chart} - radarovy chart, ktory zobrazuje rozmery jednotlivych casti pouzivatela
897 \item \textbf{similarity-chart} - ide o komponent s bar chartom, ktory userovi vyobrazuje vyskyt jeho typu postavy v konkretnych sportoch.
898\end{itemize}
899
900\subsubsection{Pages}
901Stranky v Ionicu reprezentuju "View" layer, ktoru vidi pouzivatel. Rovnako ako komponenty, aj stranky obsahuju samostatny subor s \texttt{.html} template, \texttt{.ts} subor, s definovanymi metodami v jazyku typescript a scoped \texttt{.scss} subor pre stylovanie danej stranky. Taktiez obsahuju auto-generovany \texttt{.spec.ts} file, ktory sluzi na definovanie unit testov. Navigaciu strankami je moze riesit pomocou routing-modules, kde je su nadefinovane vsetky routes pre danu page.
902
903Vitruviani obsahuje v zakladnom app-routing module 4 routes, ktore sluzia pre login, registraciu, startup page a jednu route, ktora spluzi ako parent pre ostatne lazy-loaded routes, definovane v v tabs page.
904
905\noindent V projektovom subfolderi \texttt{"pages/"} su definovane nasledovne pages:
906\begin{itemize}
907 \item \textbf{analysis} - obsahom je analyza tela, prostrednictvom grafickych vyobrazeni,
908 \item \textbf{avatar} - na stranke je moznost vygenerovat si vlastny 3D model a prehliadat ho
909 \item \textbf{comparison} - moznost komparacie jedinca s inymi datovymi vzorkami
910 \item \textbf{login} - stranka s prihlasovacim formularom
911 \item \textbf{profile} - stranka s profilovymi udajmi obsiahnutymi vo formulari na
912 \item \textbf{register} - obsahuje registracny formular pre novych pouzivatelov
913 \item \textbf{scan} - umoznuje nascanovanie postavy pouzivatela
914 \item \textbf{startup} - sluzi ako uvitacia stranka po starte aplikacie, pouzivatel ma moznost prejst do procesu prihlasenia, pripadne do procesu registracie,
915 \item \textbf{tabs} - obsahuje navigacne taby, that allow to lazy-load another pages
916\end{itemize}
917
918\subsubsection{Security}
919Je nevyhnutnostou, aby aplikacia bola zabezpecena ako na strane servera, tak aj na strane klienta. V pripade odmietnutia requestu na strane servera sa nenacitaju nove data, no je potrebne chranit aj predosle nacitane data. K tomu sluzi \textbf{AuthGuard}, ktory chrani vsetky routes po login akcii a preveruje, ci v lokalnom storage existuje platny access token usera a samotny prihlaseny user. Pri neexistujucom alebo neplatnom access tokene je pouzivatel presmerovany na login page aplikacie.
920
921Po uspesnom prihlaseni do Vitruviani sa do lokalneho storage aplikacie ulozi \acrshort{JSON} objekt prihlaseneho pouzivatela a jeho access token. K pristupu do lokalneho storage aplikacie je pouzity native storage plugin v ramci Capacitor runtime, which is used to build a web components to native \acrshort{OS} platforms.
922
923Autentifikacia voci \acrshort{API} servera je definovana v subore \texttt{"environments/environment.ts"}, ktory sluzi na definiciu konfiguracie prostredia pre testovaciu verziu aplikacie. Konfiguracia obsahuje \texttt{host} name servera a \texttt{api\_key}, ktore sluzia k formulovaniu requestov na \acrshort{API}. Server k procesu overenia potrebuje nasledovne headers:
924\begin{itemize}
925 \item \texttt{api-key: <key>} - sluzi na identifikaciu API konkretneho klienta,
926 \item \texttt{Authorization: Bearer <token> } - prostrednictvom access tokenu server detekuje aktualne prihlaseneho pouzivatela.
927\end{itemize}
928
929\subsubsection{Vitruviani UI}
930UI appky, ako sa postupovalo pri navrhu, kompletne screeny aplikacie, odhadujem 4 screeny na 1 stranu pricom tych screenov bude mozno az 15-16 tzn + 4 strany