'AttributeError: module 'keras.applications' has no attribute 'VGG16'

I'm trying to run code that is supposed to identify different types of image categories. The code is of VGG16 and I have the following error. Of course I tried to install and import directories (keras etc...)and the error still exists. Would appreciate help. Thanks.

This is the line of code that is marked

vgg16 = applications.VGG16(include_top=False, weights='data3/')

And that's the error

AttributeError: module 'keras.applications' has no attribute 'VGG16'



Solution 1:[1]

It should be applications.vgg16.VGG16(...).

Solution 2:[2]

I solved same issue with from tensorflow.keras import applications instead of from keras import applications

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 user1635327
Solution 2 ant0nk