-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpreview_predictions.py
42 lines (29 loc) · 1.25 KB
/
preview_predictions.py
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
40
41
42
import readsample as rs
import numpy as np
import display
def preview_reconstructed(name):
x_test_input_unchanged = rs.read_images_from_pkl('validation_input.pkl')
imgs = rs.read_images_from_pkl(name)
n = 5
np_images = []
for i in range(0, n):
img_array = imgs[i]
center = (int(np.floor(img_array.shape[0] / 2.)), int(np.floor(img_array.shape[1] / 2.)))
target = img_array[center[0] - 16:center[0] + 16, center[1] - 16:center[1] + 16, :]
np_images.append(target)
display.show_reconstructed_images(x_test_input_unchanged, np_images, True)
def preview_middle(name):
x_test_input_unchanged = rs.read_images_from_pkl('validation_input.pkl')
reshaped_decoded_imgs = rs.read_images_from_pkl(name)
display.show_reconstructed_images(x_test_input_unchanged, reshaped_decoded_imgs, True)
def preview_predictions(name):
imgs = rs.read_images_from_pkl(name)
display.show_images(imgs, 5, True)
def main():
# preview_middle('autoencoder_decoded.pkl')
# preview_predictions('gan_decoded.pkl')
# preview_predictions('convolution_decoded.pkl')
preview_predictions('./tmp/gen_pre_train_decoded.pkl')
# preview_full('./tmp/gen_pre_train_decoded.pkl')
if __name__ == "__main__":
main()