-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcount_avg_std.py
More file actions
31 lines (28 loc) · 836 Bytes
/
count_avg_std.py
File metadata and controls
31 lines (28 loc) · 836 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
import tensorflow as tf
import nerveseg_input
import skimage
import skimage.io
import numpy as np
FLAGS = tf.app.flags.FLAGS
def main(argv=None):
train_dict = nerveseg_input.read_labeled_image_dir(FLAGS.image_dir)
zero_count = 0
one_count = 0
n = 0
imgs = []
total = len(train_dict.keys())
for name, (image_filename, _) in train_dict.iteritems():
img = skimage.io.imread(image_filename)
imgs.append(img)
if n % 100 == 0:
print('Done: {0}/{1} images'.format(n, total))
if n % 1000 == 0:
mean = np.mean(imgs)
std = np.std(imgs)
print("Mean: {}, Std: {}".format(mean, std))
n += 1
mean = np.mean(imgs)
std = np.std(imgs)
print("Mean: {}, Std: {}".format(mean, std))
if __name__ == '__main__':
tf.app.run()