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).
388 questions
43
votes
5 answers

How to calculate the number of parameters of convolutional neural networks?

I can't give the correct number of parameters of AlexNet or VGG Net. For example, to calculate the number of parameters of a conv3-256 layer of VGG Net, the answer is 0.59M = (3*3)*(256*256), that is (kernel size) * (product of both number of…
Eric
  • 541
  • 1
  • 5
  • 7
24
votes
3 answers

The added layer must be an instance of class Layer. Found:

I am new to machine learning. I was following this tutorial on fine-tuning VGG16 models. The model loaded fine with this code: vgg_model = tensorflow.keras.applications.vgg16.VGG16() but gets this ERROR: TypeError: The added layer must be an…
Rstynbl
  • 455
  • 1
  • 5
  • 8
13
votes
2 answers

Integrating Keras model into TensorFlow

I am trying to use a pre-trained Keras model within TensorFlow code, as described in this Keras blog post under section II: Using Keras models with TensorFlow. I want to use the pre-trained VGG16 network available in Keras to extract convolutional…
Rohan Saxena
  • 2,465
  • 2
  • 10
  • 32
12
votes
3 answers

Keras VGG16 preprocess_input modes

I'm using the Keras VGG16 model. I've seen it there is a preprocess_input method to use in conjunction with the VGG16 model. This method appears to call the preprocess_input method in imagenet_utils.py which (depending on the case) calls…
user3731622
  • 3,753
  • 2
  • 31
  • 64
11
votes
1 answer

What is the expected input range for working with Keras VGG models?

I'm trying to use a pretrained VGG 16 from keras. But I'm really unsure about what the input range should be. Quick answer, which of these color orders? RGB BGR And which range? 0 to 255? balanced from about -125 to about +130? 0 to 1? -1…
Daniel Möller
  • 74,597
  • 15
  • 158
  • 180
10
votes
4 answers

Getting a list of all known classes of vgg-16 in keras

I use the pre-trained VGG-16 model from Keras. My working source code so far is like this: from keras.applications.vgg16 import VGG16 from keras.preprocessing.image import load_img from keras.preprocessing.image import img_to_array from…
Jürgen K.
  • 2,889
  • 4
  • 24
  • 52
10
votes
3 answers

Keras - All layer names should be unique

I combine two VGG net in keras together to make classification task. When I run the program, it shows an error: RuntimeError: The name "predictions" is used 2 times in the model. All layer names should be unique. I was confused because I only use…
dashenswen
  • 440
  • 1
  • 4
  • 14
9
votes
4 answers

Which loss function and metrics to use for multi-label classification with very high ratio of negatives to positives?

I am training a multi-label classification model for detecting attributes of clothes. I am using transfer learning in Keras, retraining the last few layers of the vgg-19 model. The total number of attributes is 1000 and about 99% of them are 0s.…
8
votes
3 answers

Keras VGG16 fine tuning

There is an example of VGG16 fine-tuning on keras blog, but I can't reproduce it. More precisely, here is code used to init VGG16 without top layer and to freeze all blocks except the topmost: WEIGHTS_PATH_NO_TOP =…
devforfu
  • 1,270
  • 1
  • 11
  • 33
7
votes
2 answers

Keras VGG extract features

I have loaded a pre-trained VGG face CNN and have run it successfully. I want to extract the hyper-column average from layers 3 and 8. I was following the section about extracting hyper-columns from here. However, since the get_output function was…
Sibi
  • 1,631
  • 2
  • 18
  • 34
6
votes
4 answers

TypeError: Tensor is unhashable. Instead, use tensor.ref() as the key. in Keras Surgeon

I'm using Kerassurgeon module for pruning.I encountered this error while i'm working with VGG-16 in google colab.It works fine for other models.Can someone help me fix this. ---> 17 model_new = surgeon.operate()
18 return…
Nikhil Munna
  • 113
  • 1
  • 6
6
votes
1 answer

Implement perceptual loss with pretrained VGG using keras

I am relatively new to DL and Keras. I am trying to implement perceptual loss using the pretrained VGG16 in Keras but have some troubles. I already found that question but I am still struggling :/ A short explanation of what my network should do: I…
Midas.Inc
  • 1,440
  • 2
  • 9
  • 25
6
votes
1 answer

VGG, perceptual loss in keras

I'm wondering if it's possible to add a custom model to a loss function in keras. For example: def model_loss(y_true, y_pred): inp = Input(shape=(128, 128, 1)) x = Dense(2)(inp) x = Flatten()(x) model = Model(inputs=[inp],…
William Falcon
  • 9,426
  • 11
  • 59
  • 106
6
votes
3 answers

VGG Face Descriptor in python with caffe

I want implement VGG Face Descriptor in python. But I keep getting an error: TypeError: can only concatenate list (not "numpy.ndarray") to list My code: import numpy as np import cv2 import caffe img = cv2.imread("ak.png") img = cv2.cvtColor(img,…
Iwn
  • 65
  • 1
  • 10
5
votes
1 answer

Strategy to put and get large images in VGG neural networks

I'm using a transfert-style based deep learning approach that use VGG (neural network). The latter works well with images of small size (512x512pixels), however it provides distorted results when input images are large (size > 1500px). The author of…
jeanluc
  • 51
  • 3
1
2 3
25 26