-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.py
More file actions
27 lines (17 loc) · 657 Bytes
/
test.py
File metadata and controls
27 lines (17 loc) · 657 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
from keras.models import load_model
from keras.preprocessing.image import ImageDataGenerator
import numpy as np
model = load_model('last_model.h5')
# dimensions of our images.
img_width, img_height = 250, 250
test_data_dir = 'test_images'
test_datagen = ImageDataGenerator(rescale=1. / 255)
test_generator = test_datagen.flow_from_directory(
test_data_dir,
target_size=(img_width, img_height))
from PIL import ImageFile
ImageFile.LOAD_TRUNCATED_IMAGES = True
#scoreSeg = model.evaluate_generator(test_generator,100)
#print("Accuracy = ",scoreSeg[1])
predict = model.predict_generator(test_generator)
np.save('prediction.npy', predict)