简体   繁体   中英

How to make Prediction with Keras

I am new to python and ML. Currently trying to use Keras I get import error when trying to import decode_predictions and preprocess_input . More so when trying to use get_default_graph for inception_model I get Attribute Error . Everything seems to be working in the video tutorial am using.

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()

Regarding the import, use the following command:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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