-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_model.py
More file actions
39 lines (30 loc) · 804 Bytes
/
test_model.py
File metadata and controls
39 lines (30 loc) · 804 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
"""
Test the model prediction
"""
import matplotlib.pyplot as plt
import numpy as np
from model import NextImagePredictor
def test_model_prediction(
model: NextImagePredictor,
X_test: np.ndarray,
n: int
) -> None:
"""
Generate the image from the model prediction
Args:
- model: NextImagePredictor
- X_test: np.ndarray
- n: int
"""
test_images = X_test[n : n+5]
generated_image = model.predict(test_images)
plt.figure(figsize=(14, 4))
for i in range(4):
plt.subplot(1, 5, i + 1)
plt.imshow(test_images[0, i].reshape((28, 28)), cmap='gray')
plt.axis('off')
plt.subplot(1, 5, 5)
plt.title('Generated Image')
plt.imshow(generated_image[0], cmap='gray')
plt.axis('off')
plt.show()