Denzelmon
Denzelmon

Reputation: 107

How flatten layer unroll input images?

How flatten layer unroll input images? For example, input - 7x7 images with depth 512. How exactly flatten layers unroll input data to vector?

Upvotes: 0

Views: 963

Answers (1)

D.Laupheimer
D.Laupheimer

Reputation: 1074

I guess in this case one cannot give an answer that is generally valid. The flattening depends on the implementation. It's up to you (or your used library) how the flattening is performed.

For example, you could flatten an 7x7 image (one channel) by taking every row, transforming it into a column vector and stacking all column vectors on each other (for the following section named as 'channel vector').

Imagine you have n channels (e.g. n = 512): You could perform the above mentioned flattening for every feature map (i.e. channel) which leads to n 'channel vectors'. You could process them separately in parallel or you could stack all channel vectors on each other gaining a vector containing all activities of all feature maps.

The flattening step is needed so that you can make use of fully connected layers after some convolutional layers. Fully connected layers don't have a local limitation like convolutional layers (which only observe some local part of an image by using convolutional filters). This means you can combine all the found local features of the previous convolutional layers.

Upvotes: 1

Related Questions