Questions tagged [vgg-net]

A kind of convolutional neural network consisting of 16 or 19 layers, often used with weights pre-trained on ImageNet dataset. Whereas the the model was originally created for image classification, its convolutional part can be used for a variety of purposes. Use this tag for questions, specific for this CNN architecture.

The name VGG stands for Visual Geometry Group (Oxford University), authors of the original paper.

The model consists of a convolutional part (several convolution and max- or avegare-pooling layers) and several fully-connected layers atop of it. Small (3x3) convolution filters are used.

See visual representation below (taken from this answer):

enter image description here

Model applications

  1. Image classifier (Tensorflow).
  2. Image segmentation (Keras).
  3. Image style transfer (Keras).
471 questions
2
votes
1 answer

Is it possible to get 1st and 5th layer output from pretrained vgg model when predicting?

I need to use VGG pretrained model for feature extraction from an image. Also I need to get the output from the 1st and 5th layer of the VGG pretrained model. Is it really possible to do so? If yes, can anyone provide the working code? Edit: I…
Hamsa
  • 476
  • 5
  • 23
2
votes
1 answer

Randomness in VGG16 prediction

I am using the VGG-16 network available in pytorch out of the box to predict some image index. I found out that for same input file, if i predict multiple time, I get different outcome. This seems counter-intuitive to me. Once the weights are…
Neel
  • 360
  • 1
  • 10
2
votes
0 answers

Keras Model.fit X in a list vs ndarray errors

I am training a VGG16 for my custom image classification (with pretrained Imagenet weight) and transfer learning the last dense layer (since the output is binary classification vs 1000-class for Imagenet). Looking to train using a training set, I…
ysj
  • 65
  • 6
2
votes
1 answer

Keras custom loss from VGG19

I would like to use a custom loss function which uses VGG19 network in Keras. # imports from keras.applications import VGG19 from keras.layers import Input, UpSampling2D, Conv2D, Lambda from keras.models import Model import keras.backend as K I…
GRS
  • 2,807
  • 4
  • 34
  • 72
2
votes
0 answers

The input layer of vgg net is not copied to a new sequential model when making a layer by layer copy of it

I am trying to copy vgg16 layers (except the last layer) into a new Sequential model. I loop through every layer of the vgg16 except the last one and add them to my new model. But when I print the summary of the model I see that the input layer of…
Rane
  • 41
  • 1
  • 5
2
votes
0 answers

VGG16 Tensorflow implementation does not learn on cifar-10

This VGGNet was implemented using Tensorflow framework, from scratch, where all of the layers are defined in the code. The main problem I am facing here is that the training accuracy, not to mention validation accuracy, goes up even though I wait it…
SW Jeong
  • 138
  • 1
  • 11
2
votes
1 answer

Finetuning VGG model with VGGFace weights

I am using a finetuned VGG16 model using the pretrained 'VGGFace' weights to work on Labelled Faces In the Wild (LFW dataset). The problem is that I get a very low accuracy, after training for an epoch (around 0.0037%), i.e., the model isn't…
Amruth Lakkavaram
  • 1,467
  • 1
  • 9
  • 12
2
votes
1 answer

Why I need pre-trained weight in transfer learning

I'm learning transfer learning with some pre-trained models (vgg16, vgg19,…), and I wonder why I need to load pre-trained weight to train my own dataset. I can understand if the classes in my dataset are included in the dataset that the pre-trained…
2
votes
0 answers

Why is the Keras sequential model not compiling?

I am running my code on google colabs but my sequential model is not compiling. I could not create a new Sequential mode from a pre-existing model and compile it. I have called compile function from model but I have no idea why the error pops up. I…
2
votes
1 answer

Input 0 is incompatible with layer flatten_5: expected min_ndim=3, found ndim=2

I am trying to fine-tune VGG16 neural network, here is the code: vgg16_model = VGG16(weights="imagenet", include_top="false", input_shape=(224,224,3)) model = Sequential() model.add(vgg16_model) #add fully connected…
Safa
  • 485
  • 2
  • 5
  • 24
2
votes
1 answer

MNIST and transfer learning with VGG16 in Keras- low validation accuracy

I recently started taking advantage of Keras's flow_from_dataframe() feature for a project, and decided to test it with the MNIST dataset. I have a directory full of the MNIST samples in png format, and a dataframe with the absolute directory for…
MahiMai
  • 175
  • 3
  • 11
2
votes
0 answers

Layer output of Keras pre-trained VGG19 model produces different outputs for same input

I'm extracting intermediate layer outputs from pretrained VGG19 ConvNet for a given image. I expect that if I give the same image twice, I should get the same output. But, I'm not getting the same output. Why is this happening and how to fix…
Nagabhushan S N
  • 6,407
  • 8
  • 44
  • 87
2
votes
1 answer

Forward pass output of a pertained network changes without back propagation

I am using Chainer's pertained model vgg (here named net). Every time I run the following code, I get a different result: img = Image.open("/Users/macintosh/Desktop/Code/Ger.jpg") img = Variable(vgg.prepare(img)) img = img.reshape((1,) +…
2
votes
0 answers

How to resolve Type error - Lime interpret CNN results

I am using keras with Tesorflow backend (using python 2.7) and I built two dense layer on top of pretrained vgg16 model with four classes. And I get a pretty decent results on my validation set. Now I want to use lime to interpret my result. I…
Hamid K
  • 983
  • 1
  • 18
  • 40
2
votes
1 answer

Pytorch saving and loading a VGG16 with knowledge transfer

I am saving a VGG16 with knowledge transfer by using the following statement: torch.save(model.state_dict(), 'checkpoint.pth') and reloading by using the following statement: state_dict =…
Dario Federici
  • 1,228
  • 2
  • 18
  • 40