简体   繁体   English

re.net50 的模块导入

[英]module imports for resnet50

good afternoon, i am attempted to create an image recongition tool with re.net50.下午好,我正在尝试使用 re.net50 创建一个图像识别工具。 When i try the below code, I get error: AttributeError: module 'tensorflow.python.keras' has no attribute 'applications'当我尝试下面的代码时,出现错误: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欢迎咨询,谢谢

Try to reinstall tensorflow .尝试重新安装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如果这些没有帮助,请尝试安装tf-nightly

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

You my need a different version of TensorFlow, since the attribute applications isn't in your version most likely.您可能需要不同版本的 TensorFlow,因为属性applications很可能不在您的版本中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM