kentsommer / keras-inceptionV4

Keras Implementation of Google's Inception-V4 Architecture (includes Keras compatible pre-trained weights)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Branching Properly

eyildiz-ugoe opened this issue · comments

Hi,

It's probably not the correct place to pose this question, but I'd like to modify the InceptionV4 model you provided (default) in a way to meet the requirements of a project I am working on. Since you've written the InceptionV4 code you can tell me perhaps how to branch off.

What I want to achieve is the following:

In order to get a feature map of 71x71x384, branch off before the last pooling layer within the stem and append one 'Inception-A' block.

Thereafter, successively branch off after the "Inception-A' blocks for a 35x35x384 feature map, after the 'Inception-B' blocks for a 17x17x384 feature map and after the 'Inception-C' blocks for a 9x9x1536 map.

Also extend the network with two more parts: first a 'Reduction-B' followed by two 'Inception-C- blocks to output a 5x5x1024 map. Second, one 'Reduction-B' and one 'Inception-C' to produce 3x3x1024 map.

This text itself is not really understandable as I am looking at the InceptionV4 graph and can't seem to understand how to branch off exactly as it is written. I've "branched off" within the stem before the last pooling layer (as it is said in the text):

branch_0 = conv2d_bn(net, 192, 3, 3, strides=(2, 2), padding='valid')
branch_a =  block_inception_a(net)
branch_1 = MaxPooling2D((3, 3), strides=(2, 2), padding='valid')(net)

net = concatenate([branch_0, branch_1 , branch_a], axis=channel_axis)

but got an error:

ValueError: A Concatenatelayer requires inputs with matching shapes except for the concat axis. Got inputs shapes: [(None, 35, 35, 192), (None, 35, 35, 192), (None, 71, 71, 384)]
which clearly means I did not branch off properly. What does "branch off for a AxBxC feature map" mean in this context? To add another conv2d_bn function with the A,B,C parameters?

Am I misunderstanding the text or is there something wrong with the branching strategy of the text? Could you give me some insights if possible? (Gonna close the issue afterwards as this is not a bug or anything to worth an issue).

Thanks in advance.

Closing this out after a long hiatus from Github.

You have probably moved on from this work but in the spirit of making sure I give some sort of answer, it has been a very long time since I have looked at these models/code and unfortunately I don't know what might have been causing the issues you were seeing.

Happy to chat if you happen to still be working on this (feel free to reopen or create a new issue).