-
Notifications
You must be signed in to change notification settings - Fork 3
/
plot_examples.py
32 lines (31 loc) · 1.06 KB
/
plot_examples.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
import h5py
import numpy as np
data=h5py.File('forplotting.hdf5','r')
img_train=np.asarray(data['img_train'])
img_valid=np.asarray(data['img_valid'])
img_test=np.asarray(data['img_test'])
import matplotlib.pyplot as plt
#img_train=X_train[10]#np.expand_dims(X_train[10],axis=0)
#img_valid=X_valid[10]#np.expand_dims(X_valid[10],axis=0)
#img_test=X_test[10]#np.expand_dims(X_test[10],axis=0)
#f=h5py.File('forplotting.hdf5','w')
#dset_xtrain=f.create_dataset("img_train",data=img_train)
#dset_ytrain=f.create_dataset("img_valid",data=img_valid)
#dset_xvalid=f.create_dataset("img_test",data=img_test)
#f.flush()
#f.close()
print(img_train.shape)
print(img_valid.shape)
print(img_test.shape)
plt.figure(figsize=(10, 10), facecolor='w')
plt.suptitle('Visualization of pre-processed images')
plt.subplot(1, 3, 1)
plt.title('train')
plt.imshow(img_train.transpose(1,2,0))
plt.subplot(1,3,2)
plt.title('valid')
plt.imshow(img_valid.transpose(1,2,0))
plt.subplot(1, 3, 3)
plt.title('test')
plt.imshow(img_test.transpose(1,2,0))
plt.savefig('TrainTestValidateExample.png')