Created
September 28, 2020 07:53
-
-
Save CleanPegasus/46998355ba3d365c135aad5c418c2d10 to your computer and use it in GitHub Desktop.
Preprocessing the image before predicting
This file contains 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
img = cv2.imread('img.jpg') # reading the image | |
img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) # converting the image to grayscale | |
img = cv2.resize(img, (48, 48)) # resizing the image | |
img = img/255 # normalizing the image | |
img = np.reshape(img, [-1, 48, 48, 1]) # reshaping the image to be suitable for serving |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment