【问题标题】:How to make Prediction with Keras如何使用 Keras 进行预测
【发布时间】:2020-10-30 21:23:32
【问题描述】:

我是 python 和 ML 的新手。目前尝试使用 Keras 尝试导入 decode_predictionspreprocess_input 时出现导入错误。更重要的是,当尝试将get_default_graph 用于inception_model 时,我得到Attribute Error。正在使用的视频教程中似乎一切正常。

import numpy as np
import tensorflow as tf
import keras
from keras.preprocessing.image import img_to_array, load_img
from keras.applications import inception_resnet_v2 as InceptionResNetV2,decode_predictions, preprocess_input
from tensorflow.keras.models import Sequential
from IPython.core.display import display
inception_model.graph= tf.get_default_graph()

【问题讨论】:

  • 你好@Hoc,欢迎来到 SO。请提供inception_model初始化的代码,以使此案例可重现。

标签: python tensorflow keras google-colaboratory


【解决方案1】:

关于导入,使用以下命令:

from keras.applications.inception_resnet_v2 import (decode_predictions,
                                                    preprocess_input,
                                                    InceptionResNetV2)

【讨论】:

    猜你喜欢
    • 2019-06-07
    • 2018-09-24
    • 1970-01-01
    • 2021-09-15
    • 1970-01-01
    • 2017-10-23
    • 2018-05-14
    • 2020-10-29
    • 1970-01-01
    相关资源
    最近更新 更多