Pricey
Pricey

Reputation: 81

Difference in different vgg16 objects

I am going through vgg16 model and saw this:

model = VGG16(weights='imagenet')

and

model = VGG16()
  1. What is the difference between the above two?
  2. Does the second initialization also load weights in the imported vgg16 model?
  3. How can I just import the vgg16 without loading the weights ?

Upvotes: 0

Views: 103

Answers (1)

today
today

Reputation: 33460

There is no difference between these two since according to the documentation the weights argument by default is set to 'imagenet':

keras.applications.vgg16.VGG16(include_top=True, weights='imagenet', input_tensor=None, input_shape=None, pooling=None, classes=1000)

Therefore if you don't set this argument when instantiating the VGG16 class, it would be set to 'imagenet' by default and therefore the ImageNet weights will be loaded.

However, if you like to just load the VGG16 model without any pre-trained weights, you can pass weights=None when instantiating VGG16 class. Read the documentation on VGG16 for more info about the arguments.

Upvotes: 1

Related Questions