Created
October 31, 2018 06:56
-
-
Save Mainvooid/2f925b27e9cb9fa8bed5da3067c67293 to your computer and use it in GitHub Desktop.
xception test #TensorFlow #Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import tensorflow as tf | |
| model=tf.keras.applications.xception.Xception(include_top=True, | |
| weights='imagenet', | |
| input_tensor=None, | |
| input_shape=None, | |
| pooling=None, | |
| classes=1000) | |
| image_path="../test_data/bee.jpg" | |
| image = tf.keras.preprocessing.image.load_img(image_path, target_size=(299, 299)) | |
| x = tf.keras.preprocessing.image.img_to_array(image) | |
| x = np.expand_dims(x, axis=0) | |
| x = tf.keras.applications.xception.preprocess_input(x) | |
| preds = model.predict(x) | |
| print('Predicted:', tf.keras.applications.xception.decode_predictions(preds, top=3)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment