ZFTurbo / ZF_UNET_224_Pretrained_Model

Modification of convolutional neural net "UNET" for image segmentation in Keras framework
GNU General Public License v3.0
214 stars 64 forks source link

Want to get feature values for any arbitrary layer after training..... #7

Open zBabar opened 6 years ago

zBabar commented 6 years ago

Hi...

I have a a bundle of images (without labels) and I want to fit this model as pre-trained model on that dataset. Later on I want to extract feature values from any arbitrary layer in model. How m suppose to do it? Can I use this model as we normally use pretrained model VGG or inception etc. ? Or predict features using model.predict?

ZFTurbo commented 6 years ago

1) I don't think current pretrained weights is ok to get features from layers. It's because generator of images for training was pretty simple. These weights must be used mostly for faster training process on other datasets. But anyway you can try. The most suitable layer for features I guess the last layer with probabilities of the same size as input image. So model.predict() will make you the features. 2) To get data from arbitary layer you can use the following construction:

model = ZF_UNET_224()
model_part = Model(model.input, model.get_layer('<name of required layer>').output)
zBabar commented 6 years ago

Thanx