Importing Googlenet into convolutional autoencoder

3 views (last 30 days)
Hi all,
I wanted to initialize a convolutional autoencoder for a starfish image data set that I'm using with Googlenet's weights pre-classification step. So I made a convolutional autoencoder with layers that mimicked those of Googlenet for the first 57 layers, and initialized the weights and biases of the convolutional layers with Googlenet's weights and biases, e.g. CNN(6).Weights = net.Layers(6).Weights. I ended up with two errors. The first concerned depthConcatenationLayers; when I wrote depthConcatenationLayer(4), for instance, Matlab didn't know which layers to concatenate, and neither (from Googlenet's description) did I. The second concerned weight initializations of layers 14, 18, 23, and a bunch of other layers: I would get an error in training, saying that "Error using builtin. Array inputs must share the same number of channels." Help with either of these errors would be fantastic. Or, if you can suggest a better way of transporting Googlenet's weights into a new architecture than what I'm doing, that would also be much appreciated. (deepNetworkDesigner isn't recognized.)

Answers (2)

Zenin Easa Panthakkalakath
depthConcatenationLayer(4) means that you can concatenate 4 layers to that point. If you look into the flow diagram mentioned here, right under 'Introduction', you should be able to see a few places where there are four lines pointing towards one layer. You need to use the 'connectLayers' function to point all of these to the same 'depthConcatenationLayer'. You have to specify which all layers you want to concatenate to that point. Have a look at the documentation so that you can have a better understanding:
Your second concern probably has to deal with the weights not being imported properly. The number of channels and weights assigned should be consistent.
By the way, MATLAB has a pre-trained implementation of GoogLeNet that you can use. You can find it here:

Bassem BEN CHEIKH on 14 Apr 2020
Can you share your code for initializing the convolutional autoencoder?




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by