kris524 commited on
Commit
5866141
·
verified ·
1 Parent(s): d5f32c7

Create utils.py

Browse files
Files changed (1) hide show
  1. utils.py +10 -0
utils.py ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ import cv2
2
+ import numpy as np
3
+
4
+ def preprocess_image(image):
5
+ image = np.array(image)
6
+ image = cv2.cvtColor(image, cv2.COLOR_RGB2GRAY)
7
+ image = cv2.resize(image, (224, 224))
8
+ image = image / 255.0
9
+ image = image.reshape(1, 224, 224, 1)
10
+ return image