Last active
May 18, 2020 12:58
-
-
Save hzitoun/af4c0b22f0a8a3c6b3934ed7cdbc90a9 to your computer and use it in GitHub Desktop.
Code for my medium story Serve a Deep Learning Image Classification Model Written in TensorFlow 2 as a REST API and Dockerize it! (with GPU support)
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
def read_image(image_path, image_size): | |
""" read an image using opencv """ | |
image = cv2.imread(image_path) #BGR | |
# convert to RGB | |
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) | |
# resize using cubic interpolation, a way to deal with missing data (upsize or downsize) | |
image = cv2.resize(image, image_size, cv2.INTER_CUBIC) | |
return image |
Author
hzitoun
commented
May 17, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment