Last active
October 5, 2019 16:35
-
-
Save FBosler/509db9476be14e42a1eec979d2cdda4f to your computer and use it in GitHub Desktop.
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 | |
def load_image(img_file, target_size=(224,224)): | |
X = np.zeros((1, *target_size, 3)) | |
X[0, ] = np.asarray(tf.keras.preprocessing.image.load_img( | |
img_file, | |
target_size=target_size) | |
) | |
X = tf.keras.applications.mobilenet.preprocess_input(X) | |
return X | |
import os | |
def ensure_folder_exists(folder): | |
if not os.path.exists(folder): | |
os.makedirs(folder) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment