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

How to correctly use an intermediate layer of a vgg model

What I did is: from keras.applications.vgg16 import VGG16 from keras.layers import * from keras.models import Model import numpy as np vgg_model = VGG16(weights='imagenet', include_top=False, input_shape = (224,224, 3)) block5_conv3 =…
willz
  • 105
  • 2
  • 10
2
votes
2 answers

Tensorflow object detection API: Custom VGG 16 model

I am in the process of creating a Custom VGG model as a feature extractor of Faster RCNN model in Tensorflow object detection API. As mentioned on in the document…
ReInvent_IO
  • 477
  • 3
  • 13
2
votes
1 answer

Apply ZCA whitening to VGG in keras

I am using the VGG here to train my data: # 分類するクラス classes = ['chino', 'cocoa', 'chiya', 'rize', 'syaro'] nb_classes = len(classes) img_width, img_height = 150, 150 # トレーニング用とバリデーション用の画像格納先 train_data_dir = 'dataset/train' validation_data_dir =…
2
votes
2 answers

Why VGG-16 takes input size 512 * 7 * 7?

According to https://github.com/pytorch/vision/blob/master/torchvision/models/vgg.py I don`t understand why VGG models take 512 * 7 * 7 input_size of fully-connected layer. Last convolution layer is nn.Conv2d(512, 512, kernel_size=3,…
Nazzzz
  • 55
  • 2
  • 7
2
votes
1 answer

Finetuning VGG-16 Slow training in Keras

I'm trying to finetune the two last layers of a VGG model with LFW dataset , I've changed the softmax layer dimensions by removing the original one and adding my softmax layer with 19 outputs in my case since there are 19 classes that I'm trying to…
Eric
  • 1,108
  • 3
  • 11
  • 25
2
votes
3 answers

regarding the image scaling operations for running vgg model

While reading the Tensorflow implmentation of VGG model, I noticed that author performs some scaling operation for the input RGB images, such as following. I have two questions: what does VGG_MEAN mean and how to get that setup? Secondly, why we…
user288609
  • 12,465
  • 26
  • 85
  • 127
2
votes
1 answer

Fine-tune VGG or AlexNet for non-square inputs

VGG and AlexNet, amongst others, require a fixed image input of square dimensions (H == W). How can one fine-tune or otherwise perform net surgery such that non-square inputs can be provided? For your reference, I'm using Caffe and intend to…
2
votes
1 answer

fine-tuning with VGG on caffe

I'm replicating the steps in http://caffe.berkeleyvision.org/gathered/examples/finetune_flickr_style.html I want to change the network to VGG model which is obtained…
ytrewq
  • 3,670
  • 9
  • 42
  • 71
1
vote
1 answer

Reduce vector dimension 4096 -> less than 2000 for Postgres

I am using Postgresql with pgvector for searching similarity between images. The vector should have up to 2000 dimensions, so that Postgres/pgvector can index it. I am creating a vector of the image with Python and VGG16/VGG19. As a result, I get a…
Pio92
  • 11
  • 1
1
vote
1 answer

How to resize MNIST images without running out of RAM?

I'm trying to preprocess my data to resize the training set images to 224 * 224 with 3 channels to use it as input to VGG 16 model and I'm running out of RAM. How do I resolve this? new_size = (224,224) new_x_train = [] for image in x_train: image…
niha
  • 11
  • 1
1
vote
1 answer

VGG16 Custom Activation Function used in ResNet function

Here's my code: import os os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2" import tensorflow as tf from tensorflow import keras from keras import layers from keras.datasets import cifar10 from sklearn.model_selection import train_test_split import numpy as…
1
vote
0 answers

Neural Network: For Binary Classification use 1 or 2 output neurons with VGG19

I have two groups of images (concrete cracks and uncracked concrete) so they are binary classification, I am making classification for them by using vgg19. when I used (1) neuron for the output layer and using softmax I got accuracy 0.5 and fixed…
yasmin
  • 11
  • 1
1
vote
0 answers

How can I use grad cam on transfer learning model?

`from tensorflow.keras.preprocessing.image import ImageDataGenerator from tensorflow.keras import optimizers from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dropout, Flatten, Dense from tensorflow.keras.models…
1
vote
1 answer

Generating Intermediate layer output of Vgg16

How can i generate intermediate layer output(third and forth MaxPool layer output) of VGG 16 in pytorch model. pretrained_model = models.vgg16(pretrained=True)
Nwe
  • 11
  • 2
1
vote
1 answer

Pytorch VGG16 throwing a matrix multiplication RuntimeError during inference

I'm trying to extract VGG16 features of images as part of a project. However, at the time of extracting the features, I am met with an RuntimeError: mat1 and mat2 shapes cannot be multiplied (512x49 and 25088x4096). The error is triggered at line 69…
Ferdinando Randisi
  • 4,068
  • 6
  • 32
  • 43