How does the second convolutional layer in tensorflow keras work?Calculating size of output of a Conv layer in CNN modelImplement Character Convolution in KerasKeras Conv2D layer outputs array filled with NaNConvolutional layer output sizeOutput of conv2d in kerasHow to use Padding in conv2d layer of specific sizeConvolutional layer interpolation scaling in keras & tensorflowHow to mimic Caffe's max pooling behavior in Keras/Tensorflow?keras conv2d layers does not include second channel into trainingHow to compute the number of parameters in the second conversional layer?

Is expanding the research of a group into machine learning as a PhD student risky?

Where does the Z80 processor start executing from?

What Brexit proposals are on the table in the indicative votes on the 27th of March 2019?

How can I kill an app using Terminal?

Risk of infection at the gym?

What does the word "Atten" mean?

Is HostGator storing my password in plaintext?

Is there a good way to store credentials outside of a password manager?

Anatomically Correct Strange Women In Ponds Distributing Swords

Do all network devices need to make routing decisions, regardless of communication across networks or within a network?

Detecting if an element is found inside a container

Applicability of Single Responsibility Principle

Is `x >> pure y` equivalent to `liftM (const y) x`

Customer Requests (Sometimes) Drive Me Bonkers!

Purchasing a ticket for someone else in another country?

Hostile work environment after whistle-blowing on coworker and our boss. What do I do?

Is there a problem with hiding "forgot password" until it's needed?

How do I go from 300 unfinished/half written blog posts, to published posts?

How easy is it to start Magic from scratch?

How does it work when somebody invests in my business?

How did Arya survive the stabbing?

Why escape if the_content isnt?

Pole-zeros of a real-valued causal FIR system

Implement the Thanos sorting algorithm



How does the second convolutional layer in tensorflow keras work?


Calculating size of output of a Conv layer in CNN modelImplement Character Convolution in KerasKeras Conv2D layer outputs array filled with NaNConvolutional layer output sizeOutput of conv2d in kerasHow to use Padding in conv2d layer of specific sizeConvolutional layer interpolation scaling in keras & tensorflowHow to mimic Caffe's max pooling behavior in Keras/Tensorflow?keras conv2d layers does not include second channel into trainingHow to compute the number of parameters in the second conversional layer?













0















I have the fllowing model in keras.



model = Sequential()

model.add(Conv2D(4, (3, 3), input_shape=input_shape, name='Conv2D_0', padding = 'same', use_bias=False, activation=None))
model.add(MaxPooling2D(pool_size=(2, 2)))

model.add(Conv2D(8, (3, 3), name='Conv2D_1', padding='same', use_bias=False, activation=None))
model.add(MaxPooling2D(pool_size=(2, 2)))


input_shape is (32, 32). So, for the first layer, if I have a an image of size (32, 32), I get 4 images of size (32, 32). So the input image is convoluted with 4 diffrent kernels. After the pooling layer, I get 4 images of size (16, 16).



The second convolutional layer gives me 8 images of size (16, 16). This layer has

4*8 kernels. The kernels have the size (3, 3, 4, 8). But I don't get, how the 8 output images are computed.



I thought for example for the first image I can do sth like:
H_i : i-th output image of the first Pooling layer
Ker_i : i-th kernel. (:, :, i, 0)



So the first output image of the second convolutional layer could be:
conv(H_0, ker_0) + conv(H_1, ker_1) + conv(H_2, ker_2) + conv(H_3, ker_3)



But this seems to be wrong.



Can anyone explaine me, how the second conv-layer computes the output images?
Thank you for your help.










share|improve this question






















  • the same way as in first layer. number of filters becomes number of channels in the output. take a look cs231n.github.io/convolutional-networks

    – Sharky
    Mar 21 at 16:13











  • This layer has 4*8 kernels. - How do you define kernel?

    – Vlad
    Mar 21 at 16:49











  • I mean convolutional kernel (en.wikipedia.org/wiki/Kernel_(image_processing)).

    – 5yn4x
    Mar 21 at 19:36












  • "the same way as in first layer. number of filters becomes number of channels in the output. take a look" But this time I have 4 input images. How are the filters applied on these 4 images.

    – 5yn4x
    Mar 21 at 19:37












  • I found the answer. The filter kernels are flipped!

    – 5yn4x
    Mar 22 at 15:49
















0















I have the fllowing model in keras.



model = Sequential()

model.add(Conv2D(4, (3, 3), input_shape=input_shape, name='Conv2D_0', padding = 'same', use_bias=False, activation=None))
model.add(MaxPooling2D(pool_size=(2, 2)))

model.add(Conv2D(8, (3, 3), name='Conv2D_1', padding='same', use_bias=False, activation=None))
model.add(MaxPooling2D(pool_size=(2, 2)))


input_shape is (32, 32). So, for the first layer, if I have a an image of size (32, 32), I get 4 images of size (32, 32). So the input image is convoluted with 4 diffrent kernels. After the pooling layer, I get 4 images of size (16, 16).



The second convolutional layer gives me 8 images of size (16, 16). This layer has

4*8 kernels. The kernels have the size (3, 3, 4, 8). But I don't get, how the 8 output images are computed.



I thought for example for the first image I can do sth like:
H_i : i-th output image of the first Pooling layer
Ker_i : i-th kernel. (:, :, i, 0)



So the first output image of the second convolutional layer could be:
conv(H_0, ker_0) + conv(H_1, ker_1) + conv(H_2, ker_2) + conv(H_3, ker_3)



But this seems to be wrong.



Can anyone explaine me, how the second conv-layer computes the output images?
Thank you for your help.










share|improve this question






















  • the same way as in first layer. number of filters becomes number of channels in the output. take a look cs231n.github.io/convolutional-networks

    – Sharky
    Mar 21 at 16:13











  • This layer has 4*8 kernels. - How do you define kernel?

    – Vlad
    Mar 21 at 16:49











  • I mean convolutional kernel (en.wikipedia.org/wiki/Kernel_(image_processing)).

    – 5yn4x
    Mar 21 at 19:36












  • "the same way as in first layer. number of filters becomes number of channels in the output. take a look" But this time I have 4 input images. How are the filters applied on these 4 images.

    – 5yn4x
    Mar 21 at 19:37












  • I found the answer. The filter kernels are flipped!

    – 5yn4x
    Mar 22 at 15:49














0












0








0








I have the fllowing model in keras.



model = Sequential()

model.add(Conv2D(4, (3, 3), input_shape=input_shape, name='Conv2D_0', padding = 'same', use_bias=False, activation=None))
model.add(MaxPooling2D(pool_size=(2, 2)))

model.add(Conv2D(8, (3, 3), name='Conv2D_1', padding='same', use_bias=False, activation=None))
model.add(MaxPooling2D(pool_size=(2, 2)))


input_shape is (32, 32). So, for the first layer, if I have a an image of size (32, 32), I get 4 images of size (32, 32). So the input image is convoluted with 4 diffrent kernels. After the pooling layer, I get 4 images of size (16, 16).



The second convolutional layer gives me 8 images of size (16, 16). This layer has

4*8 kernels. The kernels have the size (3, 3, 4, 8). But I don't get, how the 8 output images are computed.



I thought for example for the first image I can do sth like:
H_i : i-th output image of the first Pooling layer
Ker_i : i-th kernel. (:, :, i, 0)



So the first output image of the second convolutional layer could be:
conv(H_0, ker_0) + conv(H_1, ker_1) + conv(H_2, ker_2) + conv(H_3, ker_3)



But this seems to be wrong.



Can anyone explaine me, how the second conv-layer computes the output images?
Thank you for your help.










share|improve this question














I have the fllowing model in keras.



model = Sequential()

model.add(Conv2D(4, (3, 3), input_shape=input_shape, name='Conv2D_0', padding = 'same', use_bias=False, activation=None))
model.add(MaxPooling2D(pool_size=(2, 2)))

model.add(Conv2D(8, (3, 3), name='Conv2D_1', padding='same', use_bias=False, activation=None))
model.add(MaxPooling2D(pool_size=(2, 2)))


input_shape is (32, 32). So, for the first layer, if I have a an image of size (32, 32), I get 4 images of size (32, 32). So the input image is convoluted with 4 diffrent kernels. After the pooling layer, I get 4 images of size (16, 16).



The second convolutional layer gives me 8 images of size (16, 16). This layer has

4*8 kernels. The kernels have the size (3, 3, 4, 8). But I don't get, how the 8 output images are computed.



I thought for example for the first image I can do sth like:
H_i : i-th output image of the first Pooling layer
Ker_i : i-th kernel. (:, :, i, 0)



So the first output image of the second convolutional layer could be:
conv(H_0, ker_0) + conv(H_1, ker_1) + conv(H_2, ker_2) + conv(H_3, ker_3)



But this seems to be wrong.



Can anyone explaine me, how the second conv-layer computes the output images?
Thank you for your help.







python tensorflow keras






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 21 at 15:54









5yn4x5yn4x

62




62












  • the same way as in first layer. number of filters becomes number of channels in the output. take a look cs231n.github.io/convolutional-networks

    – Sharky
    Mar 21 at 16:13











  • This layer has 4*8 kernels. - How do you define kernel?

    – Vlad
    Mar 21 at 16:49











  • I mean convolutional kernel (en.wikipedia.org/wiki/Kernel_(image_processing)).

    – 5yn4x
    Mar 21 at 19:36












  • "the same way as in first layer. number of filters becomes number of channels in the output. take a look" But this time I have 4 input images. How are the filters applied on these 4 images.

    – 5yn4x
    Mar 21 at 19:37












  • I found the answer. The filter kernels are flipped!

    – 5yn4x
    Mar 22 at 15:49


















  • the same way as in first layer. number of filters becomes number of channels in the output. take a look cs231n.github.io/convolutional-networks

    – Sharky
    Mar 21 at 16:13











  • This layer has 4*8 kernels. - How do you define kernel?

    – Vlad
    Mar 21 at 16:49











  • I mean convolutional kernel (en.wikipedia.org/wiki/Kernel_(image_processing)).

    – 5yn4x
    Mar 21 at 19:36












  • "the same way as in first layer. number of filters becomes number of channels in the output. take a look" But this time I have 4 input images. How are the filters applied on these 4 images.

    – 5yn4x
    Mar 21 at 19:37












  • I found the answer. The filter kernels are flipped!

    – 5yn4x
    Mar 22 at 15:49

















the same way as in first layer. number of filters becomes number of channels in the output. take a look cs231n.github.io/convolutional-networks

– Sharky
Mar 21 at 16:13





the same way as in first layer. number of filters becomes number of channels in the output. take a look cs231n.github.io/convolutional-networks

– Sharky
Mar 21 at 16:13













This layer has 4*8 kernels. - How do you define kernel?

– Vlad
Mar 21 at 16:49





This layer has 4*8 kernels. - How do you define kernel?

– Vlad
Mar 21 at 16:49













I mean convolutional kernel (en.wikipedia.org/wiki/Kernel_(image_processing)).

– 5yn4x
Mar 21 at 19:36






I mean convolutional kernel (en.wikipedia.org/wiki/Kernel_(image_processing)).

– 5yn4x
Mar 21 at 19:36














"the same way as in first layer. number of filters becomes number of channels in the output. take a look" But this time I have 4 input images. How are the filters applied on these 4 images.

– 5yn4x
Mar 21 at 19:37






"the same way as in first layer. number of filters becomes number of channels in the output. take a look" But this time I have 4 input images. How are the filters applied on these 4 images.

– 5yn4x
Mar 21 at 19:37














I found the answer. The filter kernels are flipped!

– 5yn4x
Mar 22 at 15:49






I found the answer. The filter kernels are flipped!

– 5yn4x
Mar 22 at 15:49













0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55284425%2fhow-does-the-second-convolutional-layer-in-tensorflow-keras-work%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55284425%2fhow-does-the-second-convolutional-layer-in-tensorflow-keras-work%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript