'module imports for resnet50

good afternoon, i am attempted to create an image recongition tool with resnet50. When i try the below code, I get error : AttributeError: module 'tensorflow.python.keras' has no attribute 'applications'

model = keras.applications.resnet50.ResNet50(weights="imagenet")

the imports I currently have are:

import os
import numpy as np
import pandas as pd 
import matplotlib.pyplot as plt
import seaborn as sns
import tensorflow
from tensorflow.python import keras
from keras.preprocessing.image import ImageDataGenerator
from keras.models import Sequential, Model
from keras.layers import (
    Dense, Conv2D, MaxPool2D, Dropout, Flatten, 
    BatchNormalization, GlobalAveragePooling2D
)

from keras.applications.densenet import DenseNet121
from keras import backend as K

from sklearn.metrics import confusion_matrix, classification_report

advice welcome, thank you



Solution 1:[1]

Try to reinstall tensorflow. There might be an issue with recent versions.

pip uninstall tensorflow
pip install tensorflow==1.15.2

If these didn't help, try to install tf-nightly

https://pypi.org/project/tf-nightly/

Solution 2:[2]

You my need a different version of TensorFlow, since the attribute applications isn't in your version most likely.

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 Mustafa U?ur Bask?n
Solution 2 acharb