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.

vgg-net
Filter by
Sorted by
Tagged with
45 votes
5 answers
76k views

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 ...
Eric's user avatar
  • 561
27 votes
4 answers
72k views

The added layer must be an instance of class Layer. Found: <tensorflow.python.keras.engine.input_layer.InputLayer>

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 ...
Rstynbl's user avatar
  • 555
27 votes
5 answers
43k views

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 ...
Mrinal Jain's user avatar
14 votes
2 answers
3k views

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 ...
Rohan Saxena's user avatar
  • 3,243
13 votes
3 answers
15k views

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....
user3731622's user avatar
  • 4,920
12 votes
4 answers
18k views

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....
Jürgen K.'s user avatar
  • 3,467
11 votes
5 answers
27k views

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 = ...
Nikhil Dupally's user avatar
11 votes
1 answer
6k views

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? ...
Daniel Möller's user avatar
10 votes
4 answers
23k views

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 ...
dashenswen's user avatar
9 votes
2 answers
4k views

How do filters run across an RGB image, in first layer of a CNN?

I was looking at this printout of layers. I realized, this shows input / output, but nothing about how the RGB channels are dealt with. If you look at block1_conv1, it says "Conv2D". But if ...
Monica Heddneck's user avatar
8 votes
3 answers
17k views

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: ...
devforfu's user avatar
  • 1,592
8 votes
2 answers
21k views

Input 0 is incompatible with layer functional_3: expected shape=(None, 224, 224, 3), found shape=(None, 240, 240, 3)

I am new to VGG19 and image processing in python. I am trying to test my trained VGG19 model for predicting an image. I am getting this error:- ValueError: Input 0 is incompatible with layer ...
user avatar
7 votes
1 answer
11k views

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 ...
Midas.Inc's user avatar
  • 1,810
7 votes
2 answers
13k views

How can I add new layers on pre-trained model with PyTorch? (Keras example given)

I am working with Keras and trying to analyze the effects on accuracy that models which are built with some layers with meaningful weights, and some layers with random initializations. Keras: I load ...
Selin Gök's user avatar
7 votes
2 answers
5k views

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 = ...
William Falcon's user avatar
7 votes
2 answers
3k views

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 ...
Sibi's user avatar
  • 2,361
6 votes
1 answer
6k views

How to preprocess training set for VGG16 fine tuning in Keras?

I have fine tuned the Keras VGG16 model, but I'm unsure about the preprocessing during the training phase. I create a train generator as follow: train_datagen = ImageDataGenerator(rescale=1./255) ...
maccN's user avatar
  • 199
6 votes
3 answers
4k views

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 ...
Iwn's user avatar
  • 65
5 votes
1 answer
24k views

Nginx: Client request body is buffered to a temporary file

I've deployed a ML Model on AWS. It's an image classifier. When I provide the following images to the ML Model via a form in Flask, it works in certain cases but doesn't work in other cases. The link ...
Resham Sundar's user avatar
5 votes
2 answers
6k views

what is output dimension of the inception and vgg16

I have used two image net trained models i.e. VGG16 and inception using following lines in python using Keras API; where x is the input image and batch size is for simplicity =1. VGGbase_model = ...
Nhqazi's user avatar
  • 758
5 votes
1 answer
10k views

How to use the vgg-net when I load vgg16_weights.h5?

I use the VGG-16 Net by keras. This is the detail my problem is how to use this net to fine-tuning, and must I use the image size which is 224*224 for this net? And I must use 1000 classes when I use ...
sky's user avatar
  • 103
5 votes
2 answers
12k views

Does keras have a pretrained AlexNet like VGG19?

If I want to use pretrained VGG19 network, I can simply do from keras.applications.vgg19 import VGG19 VGG19(weights='imagenet') Is there a similar implementation for AlexNet in keras or any other ...
Nagabhushan S N's user avatar
5 votes
4 answers
16k views

ValueError: The input must have 3 channels; got `input_shape=(200, 200, 1)`

I am trying to use Transfer learning with VGG16. I am using Keras. But I got error on vgg = vgg16.VGG16(include_top=False, weights='imagenet', input_shape=(IMG_SIZE, IMG_SIZE, 1)) Any help what is ...
Hitesh Somani's user avatar
5 votes
1 answer
2k views

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 ...
jeanluc's user avatar
  • 67
5 votes
0 answers
6k views

Is it possible in Keras to have an input_shape of width and height 32x32?

I am using Python with Keras and Tensorflow as backend and I want to use input images as small as possible for my model. The VGG19 application says that it allows input shapes as low as 32 for width ...
Catalin Stoean's user avatar
4 votes
2 answers
10k views

How to use 1-channel images as inputs to a VGG model

I first used 3-channel images as input to a VGG16 model with NO problem: input_images = Input(shape=(img_width, img_height, 3), name='image_input') vgg_out = base_model(input_images) # Here ...
willz's user avatar
  • 105
4 votes
2 answers
5k views

Caffe shape mismatch error using pretrained VGG-16 model

I am using PyCaffe to implement a neural network inspired by the VGG 16 layer network. I want to use the pre-trained model available from their GitHub page. Generally this works by matching layer ...
marcman's user avatar
  • 3,313
4 votes
1 answer
3k views

How Can I Increase My CNN Model's Accuracy

I built a cnn model that classifies facial moods as happy , sad, energetic and neutral faces. I used Vgg16 pre-trained model and freezed all layers. After 50 epoch of training my model's test accuracy ...
Bugra Ulusoy's user avatar
4 votes
1 answer
1k views

Keras VGGnet Pretrained Model Variable Sized Input

I want to extract features of a 368x368 sized image with VGG pretrained model. According to documentation VGGnet accepts 224x224 sized images. Is there a way to give variable sized input to Keras VGG? ...
mkocabas's user avatar
  • 733
4 votes
1 answer
1k views

How to force Keras VGG16 model show and include detailed layers when being used in new customized models

Summary: How to force keras.applications.VGG16 layers, rather than the vgg model, to show and be included as layers in the new customized models. Details: I was building customized models (denoted as ...
Joey Fueng's user avatar
4 votes
1 answer
795 views

Correct way to compute VGG features for Perceptual loss

While computing VGG Perceptual loss, although I have not seen, I feel it is alright to wrap the computation of VGG features for the GT image inside torch.no_grad(). So basically I feel the following ...
Mohit Lamba's user avatar
  • 1,304
4 votes
1 answer
2k views

Validation accuracy (val_acc) does not change over the epochs

Value of val_acc does not change over the epochs. Summary: I'm using a pre-trained (ImageNet) VGG16 from Keras; from keras.applications import VGG16 conv_base = VGG16(weights='imagenet', ...
FCLM's user avatar
  • 95
4 votes
3 answers
4k views

How can I I initialize the weights in slim.conv2d() with the value of existing model

I use slim.conv2d to set up VGG-net with slim.arg_scope([slim.conv2d, slim.max_pool2d], padding='SAME'): conv1_1 = slim.conv2d(img, 64, [3, 3], scope='conv1') conv1_2 = slim.conv2d(conv1_1, ...
Frank Mouzrt's user avatar
4 votes
1 answer
216 views

Saving Custom TableNet Model (VGG19 based) for table extraction - Azure Databricks

I have a model based on TableNet and VGG19, the data (Marmoot) for training and the saving path is mapped to a datalake storage (using Azure). I'm trying to save it in the following ways and get the ...
Lidor Eliyahu Shelef's user avatar
4 votes
0 answers
12k views

What does "Process finished with exit code -1073740791 (0xC0000409)" mean

I am trying to run a VGG python code via PyCharm. When I run the code, I am getting: Process finished with exit code -1073740791 (0xC0000409) and I do not know what to do because it should show the ...
Josh's user avatar
  • 95
4 votes
1 answer
58 views

Error restoring weights into a VGG-16 network

I'm using Python 3.7.7 and Tensorflow 2.1.0. I want to create a VGG16 autoencoder network, load a weights file to it, and then get its encoder and its decoder. The functions to get the VGG16 ...
VansFannel's user avatar
  • 45.4k
4 votes
0 answers
192 views

Tracing the region of an Image that contributes to a location in the CNN feature map [closed]

I(x, y, no of channels) is the image, and Fi(x, y, no of filters ) is the feature map at some layer 'i'. Given the architecture of a Convolutional Neural Network like VGGNet and a feature map after a ...
manoj surya k's user avatar
3 votes
2 answers
1k views

Why we use Unsqueeze() function while image processing?

I was trying to work on a guided project and it was related to image processing. While working on the image processing the instructor used Unsqueeze(0) function for setting up the bed size. I would ...
Rachit S Garg's user avatar
3 votes
2 answers
1k views

What do I do to improve my Keras CNN VGG16 model

I'm working in a project that has 700 images for 2 classes (1400 total). I'm using VGG16 but i'm new with this model and I don't know what could I do to improve this model.. This is my model: ...
user avatar
3 votes
1 answer
1k views

FailedPreconditionError: Attempting to use uninitialized value Adam/lr

I was on the process of training a VGG16 fine-tuned model.After the first epoch,the program stopped and gave this error: Below is the code I used for the model: # create a copy of a mobilenet model ...
Rstynbl's user avatar
  • 555
3 votes
1 answer
2k views

A proper way to adjust input size of CNN (e.g. VGG)

I want to train VGG on 128x128-sized images. I don't want to rescale them to 224x224 to save GPU-memory and training time. What would be the proper way to do so?
Oliver Wilken's user avatar
3 votes
2 answers
798 views

Keras: using VGG16 to detect specific, non-generic item?

I'm learning about using neural networks and object detection, using Python and Keras. My goal is to detect something very specific in an image, let's say a very specific brand / type of car ...
danv's user avatar
  • 31
3 votes
1 answer
2k views

How to use pre-trained features from VGG-16 as input to GlobalAveragePooling2D() layer in Keras

Is it possible to use pre-trained model features from VGG-16 and pass to GlobalAveragePooling2D() layer of other model in Keras? Sample code for storing offline features of VGG-16 network: model = ...
MUNEER AHMAD's user avatar
3 votes
1 answer
3k views

How can I get rid of stuck accuracy and loss values in deep learning?

I'm dealing with deep learning and medical image classification with it. I use brain MRI data and convert them into jpg. Then VGG16 is used for training. When I check the loss, accuracy, validation ...
umitkilic's user avatar
  • 337
3 votes
1 answer
993 views

How to add a Lambda layer as an input layer to an existing model in Keras?

I have a task to add a image preprocessing layer to a Keras model, so after I loaded a Keras model, I want to add a new input layer for this model. I found I can use Lambda layer to preprocess the ...
wellido's user avatar
  • 45
3 votes
1 answer
789 views

Issue with transfer learning with Tensorflow and Keras

I've been trying to recreate the work done in this blog post. The writeup is very comprehensive and code is shared via a collab. What I'm trying to do is extract layers from the pretrained VGG19 ...
Austin A's user avatar
  • 3,080
3 votes
1 answer
3k views

What are conv3, conv4, conv5 outputs of VGG16?

Some research papers mention that they used outputs of conv3, conv4, conv5 outputs of a VGG16 network trained on Imagenet If I display the names of the layers of VGG16 like so: base_model = tf.keras....
user avatar
3 votes
1 answer
2k views

OpenCV Python Image Preprocessing for VGG16 Model

I would like to correctly pre-process images to input them into the VGG16 model In their original paper the authors write: During training, the input to our ConvNets is a fixed-size 224 × 224 ...
henry's user avatar
  • 905
3 votes
1 answer
79 views

Convolutional layers convolve the wrong way around(Pytorch)?

I have been trying to visualize the outputs of a VGG-16 network. But the output seems to be just wrong. As you know the convolution doesn't translate the semantic segment of the picture. like for the ...
legendsneverdie11010's user avatar
3 votes
1 answer
1k views

1x1 convolution as classification layer in Pytorch

I am trying to classify image patches into 10 different categories using a neural network. My idea (borrowed from this article is to use the first 5 layers of a pretrained VGG network and apply a 1x1 ...
Ricard Borràs's user avatar

1
2 3 4 5
10