forked from ss4328/h5_manager_scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathh5visualizer.py
More file actions
executable file
·60 lines (39 loc) · 1.21 KB
/
h5visualizer.py
File metadata and controls
executable file
·60 lines (39 loc) · 1.21 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 24 22:49:14 2020
@author: shivanshsuhane
"""
# modules we need
import numpy as np
import matplotlib.pyplot as plt
import h5py
import sys, getopt
def visualize(full_file_path):
# Load h5py file
example_dt = h5py.File(full_file_path,'r')
# see what is inside that h5 file
print(example_dt.keys())
images = example_dt['images']
print(images.shape)
plt.subplots(3,4,figsize = (20,20))
for i in range(12):
img_np = images[i]
plt.subplot(3,4,1+i)
plt.imshow(img_np)
plt.show()
def get_params():
if len(sys.argv) > 2:
print('You have specified too many arguments')
sys.exit()
if len(sys.argv) < 2:
print('You need to specify the input dir path and output file path to be listed')
sys.exit()
h5FileName = sys.argv[1]
fullPath = "/Users/shivanshsuhane/Desktop/code/ml_gitRepo/side_projects/hot-dog-not-hot-dog/Assignment/" + h5FileName
print ('Full file path is: ', fullPath)
return fullPath
if __name__ == "__main__":
h5FileName = get_params()
visualize(h5FileName)
print ('Completed.')