Pokazywanie postów oznaczonych etykietą Neural Network. Pokaż wszystkie posty
Pokazywanie postów oznaczonych etykietą Neural Network. Pokaż wszystkie posty

piątek, 20 kwietnia 2018

RNN (Recurrent Neural Networks) and LSTM (Long short-term memory)

RNN (Recurrent Neural Networks)

In the below diagram, a chunk of neural network, A, looks at some input xt and outputs a value ht. A loop allows information to be passed from one step of the network to the next.


These loops make recurrent neural networks seem kind of mysterious. However, if you think a bit more, it turns out that they aren’t all that different than a normal neural network. A recurrent neural network can be thought of as multiple copies of the same network, each passing a message to a successor.

This chain-like nature reveals that recurrent neural networks are intimately related to sequences and lists. They’re the natural architecture of neural network to use for such data.


One of the appeals of RNNs is the idea that they might be able to connect previous information to the present task, such as using previous video frames might inform the understanding of the present frame.

All recurrent neural networks have the form of a chain of repeating modules of neural network. In standard RNNs, this repeating module will have a very simple structure, such as a single tanh layer:


In theory, RNNs are absolutely capable of handling such “long-term dependencies.” Sadly, in practice, RNNs don’t seem to be able to learn them.


Limitations of RNNs:
Recurrent Neural Networks work just fine when we are dealing with short-term dependencies.

RNN remembers things for just small durations of time, i.e. if we need the information after a small time it may be reproducible, but once a lot of informations are fed in, this information gets lost somewhere. 

RNN in order to add a new information, it transforms the existing information completely by applying a function. Because of this, the entire information is modified, on the whole, i. e. there is no consideration for ‘important’ information and ‘not so important’ information. 

This issue can be resolved by applying a slightly tweaked version of RNNs – the Long Short-Term Memory Networks. 



LSTM (Long short-term memory)
LSTM is a very special kind of recurrent neural network which works, for many tasks, much much better than the standard version.
In LSTMs remembering information for long periods of time is practically their default behavior.


LSTMs also have this chain like structure, but the repeating module has a different structure. Instead of having a single neural network layer, there are four, interacting in a very special way:

In the above diagram, each line carries an entire vector, from the output of one node to the inputs of others. The pink circles represent pointwise operations, like vector addition, while the yellow boxes are learned neural network layers. Lines merging denote concatenation, while a line forking denote its content being copied and the copies going to different locations. 

A typical LSTM network is comprised of different memory blocks called cells
(the rectangles that we see in the image).  There are two states that are being transferred to the next cell; the cell state and the hidden state. The memory blocks are responsible for remembering things and manipulations to this memory is done through three major mechanisms, called gates.

The key to LSTMs is the cell state, the horizontal line running through the top of the diagram.
The cell state is kind of like a conveyor belt. It runs straight down the entire chain, with only some minor linear interactions.

The LSTM does have the ability to remove or add information to the cell state, carefully regulated by structures called gates. Gates are a way to optionally let information through.
LSTMs make small modifications to the information by multiplications and additions. With LSTMs, the information flows through a mechanism known as cell states. This way, LSTMs can selectively remember or forget things. The information at a particular cell state has three different dependencies.
 



Summary
LSTMs were a big step in what we can accomplish with RNNs.
What I’ve described so far is a pretty normal LSTM. But not all LSTMs are the same as the above. In fact, it seems like almost every paper involving LSTMs uses a slightly different version.

In comparisons with RTRL (Real-Time Recurrent Learning), BPTT (Back-Propagation Through Time), LSTM leads to many more successful runs and learns mouch faster.
LSTM also solves complex, artificial long time lag tasks that have never been solved by previous recurrent network algorithms.

The Long Short-Term Memory recurrent neural network has the promise of learning long sequences of observations.
It seems a perfect match for time series forecasting, and in fact, it may be.

LSTMs are a very promising solution to sequence and time series related problems. However, the one disadvantage that I find about them, is the difficulty in training them. A lot of time and system resources go into training even a simple model. But that is just a hardware constraint!

LSTM’s are really good but still face some issues for some problems so many people developed other methods also after LSTM’s like GRU (Gated Recurrent Units).
For fast GRU info see: https://datascience.stackexchange.com/questions/14581/when-to-use-gru-over-lstm


RCNN:

LSTM:

GRU:

Another:

środa, 11 kwietnia 2018

Capsule Neural Network - short introduction

CNN Network disadvantages
CNNs work by accumulating sets of features at each layer. It starts of by finding edges, then shapes, then actual objects.
Layers that are deeper (closer to the input) will learn to detect simple features such as edges and color gradients, whereas higher layers will combine simple features into more complex features.

Finally, dense layers at the top of the network will combine very high level features and produce classification predictions.An important thing to understand is that higher-level features combine lower-level features as a weighted sum: activations of a preceding layer are multiplied by the following layer neuron’s weights and added, before being passed to activation nonlinearity.



CNN disadvantage
Upon training CNN with the data set of images having orientation similar to Image_TrainingDataSetType, it learns the features like ‘left eye’, ‘right eye’, ‘nose’, and so on.


When Image_TrainingDataSetType is fed to this CNN for classification, it detects the learned features in the given input. Hence, it will correctly classify it as ‘Panda’.


When Image_Deformed is fed to this CNN for classification, it detects the learned features in the given input. Hence, it will incorrectly classify it as ‘Panda’.


When Image_RotatedPanda is fed to this CNN for classification, it will fail to detect the learned features in the given input. Hence, it will incorrectly classify it as ‘Not Panda’.

 

Workaround to fix this CNN classifier to classify Image_RotatedPanda correctly is to add similar images (images of similar orientation, size, ..) in training data set and labeling them as ‘panda’. This will result in CNN learning features of more orientations of nose and eyes.
This requires more data in various poses.

The limitation of CNN is that its neurons are activated based on the chances of detecting specific feature. Neurons do not consider the properties of a feature, such as orientation, size, velocity, color and so on. Hence, it was not trained on relationships between features.

Determining the special relationship between nose and eyes in CNN requires precise location of those features in the input image. The features (nose, left eye, right eye) location information is lost at (Max)Pooling layer of CNN.



Polling Layer advantage /disadvantage
Polling Layer has the advantage of making the next layers less expensive in computing power, but also to make the network less dependent on the original positions of the features in the image.
 
Pooling support positional invariance otherwise CNNs would fit only for images or data which are very close to the training set, but this allows the model to be ONLY invariant to the small change in images.


Invariant means that no matter if the order and position of the detected characters change, the output will always be the same. 
This invariance also leads to triggering false positive.

The CNN can trigger the right image to match with the left image:
 
This was never the intention of pooling layer. What the pooling was supposed to do is to introduce positional, orientational, proportional invariances. But the method we use to get this uses is very crude. CNNs lose plenty of information in the pooling layers.
It is therefore assumed that the exact positions of the characteristics are not necessarily important to consider whether an object is present in the image or not.

if (2 eyes && 1 nose && 1 mouth) 
{
  It's a face!
} 
for CNN the "face" on right is a correct face

Polling Layer loses the precise spatial relationships between higher-level parts such as a nose and a mouth. The precise spatial relationships are needed for identity recognition.

They cannot extrapolate their understanding of geometric relationships to radically new viewpoints. 

In addition to being easily fooled by images with features in the wrong place a CNN is also easily confused when viewing an image in a different orientation.
CNNs cannot handle rotation at all - if they are trained on objects in one orientation, they will have trouble when the orientation is changed.

CNNs perform exceptionally great when they are classifying images which are very close to the data set. If the images have rotation, tilt or any other different orientation then CNNs have poor performance. Of course this problem can be solved by adding different variations of the same image during training.

What we needed was not invariance but equivariance. See discussion about  Invariance vs. Equivariance

Equivariance makes a CNN understand the rotation or proportion change and adapt itself accordingly so that the spatial positioning inside an image is not lost. 

That’s what leads us to this new architecture basic on human brain.



Brain Capsule Network
Human brain has two separate pathways, a “what” pathway and a “where” pathway (see the “two-streams hypothesis”).
Neurons in the “what” pathway respond to a particular type of stimulus regardless of where it is in the visual field. Neurons in the “where” pathway are responsible for encoding where things are. As a side note, it is hypothesized that the “where” pathway has a lower resolution then the “what” pathway.

The important thing to recognize here about the “what” pathway is that it doesn’t know where objects are without the “where” pathway telling it. If a person’s “where” pathway is damaged, they can tell if an object is present, but can’t keep track of where it is in the visual field and where it is in relation to other objects. This leads to simultanagnosia, a rare neurological condition where patients can only perceive one object at a time.

Human brain have modules called “capsules”. These capsules are particularly good at handling different types of visual stimulus and encoding things like pose (position, size, orientation), deformation, velocity, albedo, hue, texture etc.
The brain must have a mechanism for “routing” low level visual information to what it believes is the best capsule for handling it.
About routing will be later. Now let's focus how a capsule network is build.
This leads us to the recent advancement of Capsule Networks.


 
Capsule Neural Network - introdution
Capsule networks (CapsNets) are a hot new neural net architecture that may well have a profound impact on deep learning, in particular for computer vision.

The introduction of Capsule Networks gives us the ability to take full advantage of spatial relationship, so we can start to see things more like:
 
if (2 adjacent eyes && nose under eyes && mouth under nose) {
  It's a face!
}

CNNs require extra components to automatically identify which object a part belongs to (e.g., this leg belongs to this sheep). CapsNets give you the hierarchy of parts for free.
 
This new architecture also achieves significantly better accuracy on the following data set. This data set was carefully designed to be a pure shape recognition task that shows the ability to recognize the objects even from different points of view. It beat out the state-of-the-art CNN, reducing the number of errors by 45%.


The reconstructions show that CapsNet is able to segment the image into the two original digits. Since this segmentation is not at pixel level authors observe that the model is able to deal correctly with the overlaps:


How CapsNet works
With CapsNets, detailed pose information (such as precise object position, rotation, thickness, skew, size, and so on) is preserved throughout the network, rather than lost and later recovered.
Small changes to the inputs result in small changes to the outputs—information is preserved. This is called "equivariance."



 How CapsNet is build
CapsNet is composed of capsules rather than neurons.




Let analize this schema for face (eyes, nouse, mouth):


  • Let u1, u2, u3 be the output vectors coming from capsules of the layer below.
    These vectors then are multiplied by corresponding weight matrices W (learned during training) that encode important spatial and other relationships between lower level features (eyes, mouth and nose) and higher level feature (face). 
  • We get the predicted position of the higher level feature, where the face should be according to the detected position of the eyes:

    Wij is a weight matrix (learned during training) between each ui. This Wij parameters models a “part-whole” relationship between the lower and higher level entities.

    example:


     
    If these 3 predictions of lower level features point at the same position and state of the face, then it must be a face there.
  • Then we compute a weighted sum sj with weights cij, coupling coefficient trained by dynamic routing (discussed next):
    cij: which feature 'j' does feature 'i'  think it is a part of.
  • We apply a squashing function to scale the vector between 0 and unit
    length:
    It shrinks small vectors to zero and long vectors to unit vectors.
    Therefore the likelihood of each capsule is bounded between 0 and 1.



---------------------
A capsule is a small group of neurons that learns to detect a particular object within a given region of the image.

Like the neurons, we might have multiple levels of capsules. Then outputs of the last level of capsules could be the input to the current level.

Let us assume now we have two output vectors from the last level v1 and v2 (as input to next capsule), then we do some computation in the capsule, and generate our output v :


 
In CapsNet you would add more layers inside a single layer. Or in other words nest a neural layer inside another. As a result, CapsNets can use the same simple and consistent architecture across different vision tasks. So in a regular neural network you add capsule layers.

This is example of CapsNet architecture.

Encoder:
Encoder takes as a input image with size 28x28x1 and learns to encode it into a 16-dimensional vector of instantiation parameters for 10 classes. The output of the network during prediction is a 10-dimensional vectors of lengths of DigitCaps’ outputs.

https://cdn-images-1.medium.com/max/800/1*P1y-bAF1Wv9-EtdQcsErhA.png

Decoder:
Decoder takes a 16-dimensional vector from the correct DigitCap and learns to decode it into an image of a digit.
Decoder is used as a regularizer, it takes the output of the correct DigitCap as input and learns to recreate an 28 by 28 pixels image.
Decoder forces capsules to learn features that are useful for reconstructing the original image.

Fully connected Layer:
FC1: Input: 16x10 .Output: 512. Number of parameters: 82432.
FC2: Input: 512. Output: 1024. Number of parameters: 525312.
FC3: Input: 1024. Output: 784 (gives back a 28x28 decoded image). Number of parameters: 803600.
Total number of parameters in the network: 8238608.
 
Each output of the lower level gets weighted and directed into each neuron of the fully connected layer as input. For first layer there are 16x10 inputs that are all directed to each of the 512 neurons of this layer. Therefore, there are (16x10 + 1)x512 trainable parameters.

Articles about this CapsNet architecture:

Convolutional layer
Take input image with size 28x28x1.
Extract some extremely basic features from the input image, like edges or curvesby using of 256 filter with size 9x9x1.
Outpuy is a 256 features maps with size 20x20:

After convolution layer we have main capsule layer called Primary Capsule Layer.



Primary capsules layer
Each primary capsules receives a small region of the image as input (called its receptive field), and it tries to detect the presence and pose of a particular pattern, for example a rectangle.

Starts off as a normal convolution layer but our filter have size 9x9x256.
Now we are looking for slightly more complex shapes from the edges we found earlier. 

We move filter with stride=2 so the output will have size 6x6 but instead of 256 layer we will have 32 decks with 8 cards per each deck. We can call this deck a “capsule layer” so we have 36 “capsules”.






That means each capsule has an array(card) of 8 values. This array we can call a “vector”.


These “capsules” are our new pixel.
With a single pixel, we could only store the confidence of whether or not we found an edge in that spot. The higher the number, the higher the confidence.
With a capsule we can store 8 values (as a vecttor) per location! That gives us the opportunity to store more information (position, size, orientation, deformation, velocity, albedo, hue, texture, and so on).

In reality it’s not really feasible (or at least easy) to visualize the vectors like above, because these vectors are 8 dimensional.
Like a traditional 2D or 3D vector, this vector has an angle and a length. The length describes the probability, and the angle describes the instantiation parameters.


Since we have all this extra information in a capsule, the idea is that we should be able to recreate the image from them.
With a capsule network, we have something called a “reconstruction.” A reconstruction takes the vector we created and tries to recreate the original input image, given only this vector. We then grade the model based on how close the reconstruction matches the original image.



Squashing
After we have our capsules, we are going to perform another non-linearity function on it (like ReLU), but this time the equation is a bit more involved. The function scales the values of the vector so that only the length of the vector changes, not the angle. This way we can make the vector between 0 and 1 so it’s an actual probability.


This is what lengths of the capsule vectors look like after squashing. At this point it’s almost impossible to guess what each capsule is looking for.




Routing by Agreement
The next step is to decide what information to send to the next level.
In traditional networks, we would probably do something like “max pooling.”
However, with capsule networks we are going to do something called routing by agreement.

Each capsule tries to predict the next layer’s activations based on itself:
With routing by agreement, we only pass on the useful information and throw away the data that would just add noise to the results. This gives us a much smarter selection than just choosing the largest number, like in max pooling.


https://hep-ai.org/slides/2017-12-12.pdf

DigitCaps Layer - prediction
The capsule’s predictions for each class are made by multiplying it’s vector by a matrix of weights for each class that we are trying to predict.
Our prediction is a 16 degree vector (this size it’s an arbitrary choice):

 
Remember, from our example, that we have 32 capsule layers (grouped in 8 layers), and each capsule layer has 36 capsules (6x6).
 
That means we have a total of 1152 capsules. You will end up with a list of 11520 predictions (a total of 1152(predictions)*10(classes) = 11520 weight matrices Wij).

Each prediction is a matrix multiplication between the capsule vector and this weight matrix:


After agreement, we end up with ten 16 dimensional vectors, one vector for each class. This matrix is our final prediction.




Capsules encode probability of detection of a feature as the length of their output vector. And the state of the detected feature is encoded as the direction in which that vector points to (“instantiation parameters”). So when detected feature moves around the image or its state somehow changes, the probability still stays the same (length of vector does not change), but its orientation changes.

It outputs a vector whose length represents the estimated probability that the object is present, and whose orientation encodes the object's pose parameters.

If the object is changed slightly then the capsule will output a vector of the same length, but oriented slightly differently. Thus, capsules are equivariant.



--------------------------------------------
Dynamic Routing Between Capsules
In the "Routing Capsule Layer" we use an algorithm called "Routing by Agreement". In this example, the shape of the combination of a rectangle and a triangle will be either a house or a boat.
For the shape of the boat, a strong arrow is drawn in the Routing Capsule Layer and the recognition priority of the image becomes high:


Capsules at one level make predictions, via transformation matrices, for higher-level capsules. When multiple predictions agree, a higher level capsule becomes active. This process is described as dynamic routing, which I will talk about in more detail now.
 Much like feature maps in regular CNNs, each capsule is responsible for finding some specific object/shape in the image.

The length of each capsule vector represents the probability of the entity being present at the specific location in the image and the angle of the capsule vectors encodes other properties of the objects such as the rotation angle, skew, thickness, size, etc.



In bottom example two capsules scan the image for rectangles (black vectors) and triangle (blue vectors) shapes.  There are 50 capsules and the capsule in the place where the object actually exists increases. This capsule is called "The basic layer of the capsule".



The orientation of triangular and rectangular objects is represented by two vectors, each in a capsule. In other words, rectangles and triangles exist in the position of this large arrow, and by arranging the figures in the same direction, it becomes like a boat.

 
Much like a regular neural network, a CapsNet is organized in multiple layers.
The capsules in the lowest layer are called primary capsules and capsules in higher layers called routing capsules:
two-layer CapsNet

In addition, paying attention to the relationship between the rectangle and the triangular capsules, the top layer also includes a "Routing Capsule Layer" that connects multiple capsules and detects complex objects. In this example, let's consider an above example of recognizing "boat" and "house" images that are a combination of a triangle and a rectangle.

Recent paper introduces an iterative routing-by-agreement mechanism according to which a lower-level capsule prefers to send its output to higher level capsules whose activity vectors have a big scalar product with the prediction coming from the lower-level capsule. This dynamic routing
mechanism ensures that the output of the capsule gets sent to an appropriate parent in the layer above.

Dynamic routing can be viewed as a parallel attention mechanism that allows each capsule at one level to attend to some active capsules at the level below and to ignore others.









Summary
CapsNet is a brilliant idea, certainly, but we will have to wait for Benchmarks more consistent than MNIST to really make an idea. I am thinking of Imagenet among others.

Despite all their qualities, CapsNets are still far from perfect. Firstly, for now they don't perform as well as CNNs on larger images such as CIFAR10 or ImageNet. Moreover, they are computationally intensive, and they cannot detect two objects of the same type when they are too close to each other (this is called the "crowding problem," and it has been shown that humans have it, too). But the key ideas are extremely promising, and it seems likely that they just need a few tweaks to reach their full potential.



Sources codes:

Papers:

Video:


Articles:

Inne:


Ready:


To check new way:

Harmonic network:


czwartek, 22 marca 2018

CNN - Fully Connected Layer (FC) -> warstwa w pełni połączona

Położenie warstwy w strukturze CNN
Fully Connected Layer (FC Layers) tzw. warstwa gęsta (ang. dense layer), wchodzi w skład tzw. warstwy klasyfikującej.

Jest to najcześciej przedostatnia warstwa w sieci CNN (Convolutional Neural Networks).
Za nią może być np. warstwa softmax.




Jakie jest jej zadania
Warstwy konwolucyjna, ReLU i pooling mogą służyć do wykrycia złożonych wzorców, a do wsparcia ostatecznej klasyfikacji obiektu stosuje się tzw. warstwę gęstą (ang. dense layer lub fully connected layer.
Warstwa ostatecznie identyfikuje do jakiej klasy należy obiekt wejściowy.
Zwraca prawdopodobieństwo, że obiekt na zdjęciu jest określonego rodzaju.


Najnowsze projekty ConvNet jednak pokazały, że można je skonstruować sieć CNN bez warstw FC Layer. Najnowsze modele takie jak GoogleNet i ResNet, pokazują, że warstwę FC Layer można zastąpić Global Average Pooling Layer (GAP Layer), która ma o wiele mniej parametrów i większą dokładność klasyfikacji. 
Dlatego coraz więcej modeli preferuje odrzucanie FC Layer na rzecz lepszej wydajności.


Budowa warstwy
W FC Layer każdy neuron jest połączony z każdym neuronem z poprzedniej warstwy, a każde połączenie ma swoją własną wagę.



 
Ważną rzeczą w Fully Connected Layer są właśnie wagi połączeń. Są one tym, czego nauczyła się sieć.  
Kiedy trenujesz sieć, ciągle dostosowujesz te wagi w górę i w dół, aż sieć zrobi to, co chcesz.  
Kiedy ludzie mówią o "wyuczonych parametrach" sieci neuronowej, mówią o tych wagach.

Suma iloczynu danych wejściowych i wag w każdym węźle wyjściowym określa prawdopodobne przypisanie do klasy wynikowej.

Rozpatrzy taki przykład sieci:


Fully Connected Layer to spłaszczona jednowymiarowa tablica poprzedniej warstwy wynikowej (może to być zarówna wartwa konwolucyjna, pooling jak i inna fully connected layer), w tym przypadku warstwy polling.






Fully Connected Layer (FC) vs Convolutional layers (CONV)
Warstwy konwolucyjne (CONV) pomagają wyodrębnić pewne cechy z obrazu, podczas gdy Fully Connected Layer (FC) może generalizować te cechy na przestrzeń wyjściową (ponieważ nie ma struktury wag, takiej jak CN). W ten sposób przechodzisz od warstwy najmniej elastycznej do najbardziej elastycznej.

Warto zauważyć, że jedyną różnicą między warstwami FC i CONV jest to, że neurony w warstwie CONV są połączone tylko z lokalnym regionem w danych wejściowych i że wiele neuronów w woluminie CONV mają wspólne parametry. 



Postać funkcjonalna obu warstw jest identyczna. Możliwa jest zatem konwersja pomiędzy warstwami FC i CONV.

FC to warstwa bardzo pamięciożerna ze względu na przechowywanie informacji o każdym neuronie i jego wagach i wszystkich połączeniach. Kompresja ma tu kluczowe znaczenie dla zmniejszenia pamięci i kosztów obliczeniowych sieci neuronowych.
W porównaniu z warstwą konwolucyjną, gdzie każdy neuron przechowywał informację tylko o połączeniach z sąsiednim neuronem z poprzedniej warstwy. 

Zasadniczo FC Layer ma największą liczbę wag. Ta warstwa może zatem wymagać czasu na trening w porównaniu do innych warstw. 


Fully Connected Layers a uczenie
Wyobraź sobie teraz, że chcesz zbudować własny model, aby rozpoznać słodkie koty.
Jeśli zaczynasz od zera, musisz podać dużą liczbę przykładów ćwiczeń, aby model uczył się rozpoznawać, co jest kotem w pierwszej kolejności. Możesz zamiast tego wziąć istniejący, dobrze działający model z już wyuczonymi ciężarami np. ImageNet.

Ideą jest to, że oryginalny model nauczył się rozpoznawać ogólne cechy w warstwach CNN i można je ponownie wykorzystać (rozpoznaje koty i inne obiekty). Górna warstwa działa poza generalizacją i skupia się na konkretnych elementach, które znajdują się w zestawie treningowym.

Usuń zatem wierzchnią warstwę (Fully Connected Layer), która wyuczyła się klasyfikowania obiektów do etykiet. Nie interesują Cię przecież wszystkie etykiety, których nauczył się oryginalny model, tylko same koty. Poprzez trening na naszych obiektach (słodkich kotkach) nauczysz sieć rozpoznawać detale słodkich kotków poprzez stworzenie swojej specyficznej dla twoich potrzeb, warstwy Fully Connected Layer.


Multiple Fully Connected Layers
Istnieją pewne architektury CNN, które wykorzystują wiele w pełni połączonych warstw na końcu sieci. Poniższy przykład - ma dwie w pełni połączone warstwy, a na końcu warstwę softmax.



SOFTMAX
Celem wypracowania decyzji klasyfikacyjnej, wyjściowa warstwa typu Fully Connected Layer jest poddawana działaniu aktywacji za pomocą funkcji, którą formalnie utożsamia się z istnieniem oddzielnej warstwy o nazwie Softmax.

Funkcja typu softmax oblicza dla każdego neuronu z ostatniej warstwy typu FullConnected prawdopodobieństwo  przynależności  obrazu  wejściowego do określonej kategorii.



Materiały
http://andrew.gibiansky.com/blog/machine-learning/convolutional-neural-networks/
https://www.safaribooksonline.com/library/view/deep-learning/9781491924570/ch04.html
https://leonardoaraujosantos.gitbooks.io/artificial-inteligence/content/fc_layer.html