-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVisualize_TFRecord.py
More file actions
41 lines (31 loc) · 929 Bytes
/
Visualize_TFRecord.py
File metadata and controls
41 lines (31 loc) · 929 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
40
41
import tensorflow as tf
import matplotlib.pyplot as plt
import os
from config import *
import dataLoader
conf1 = config(args)
conf_tf = tf.ConfigProto()
conf_tf.gpu_options.per_process_gpu_memory_fraction = 0.8
os.environ['TF_CPP_MIN_LOG_LEVEL']='3'
os.environ['CUDA_DEVICE_ORDER']='PCI_BUS_ID'
os.environ['CUDA_VISIBLE_DEVICES'] = conf1.GPU
plt.rcParams['image.interpolation']='nearest'
print(tf.__version__)
dataLoader=dataLoader.dataLoader()
X, Y = dataLoader.load_tfrecord()
'''For Tensorflow Version 1.x'''
with tf.Session(config=conf_tf) as sess:
img, label = sess.run([X, Y])
print('img shape:', img.shape)
print('label shape:', label.shape)
plt.figure()
for j in range(16):
plt.subplot(4,4,j+1)
plt.imshow(img[j])
plt.axis('off')
plt.figure()
for j in range(16):
plt.subplot(4,4,j+1)
plt.imshow(label[j])
plt.axis('off')
plt.show()