-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
39 lines (24 loc) · 775 Bytes
/
test.py
File metadata and controls
39 lines (24 loc) · 775 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from keras.models import load_model
import cv2
import numpy as np
from skimage import transform
IMG_SIZE = 28
#function to preprocess the image
def preprocess_img(img):
img = transform.resize(img, (IMG_SIZE, IMG_SIZE), mode='constant')
img = np.rollaxis(img, -1)
return img
model = load_model('model_decimal.h5')
import os
for image in os.listdir('Dataset/testing-images/decimal/'):
imgs1 = []
image = cv2.imread(os.path.join('Dataset/testing-images/decimal/',image))
image = preprocess_img(image)
imgs1.append(image)
X1 = np.array(imgs1, dtype='float32')
y_pred = model.predict_classes(X1)
print(y_pred)
# print(model.predict_classes(img))
print(model.predict_proba(X1))
cv2.waitKey(200)
input("enter")