-
Notifications
You must be signed in to change notification settings - Fork 3
/
means.py
64 lines (44 loc) · 1.51 KB
/
means.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import tensorflow as tf
import read_cityscapes_tf_records as reader
import train_helper
import time
import os
import eval_helper
import numpy as np
import helper
import sys
tf.app.flags.DEFINE_string('config_path', "config/cityscapes.py", """Path to experiment config.""")
FLAGS = tf.app.flags.FLAGS
helper.import_module('config', FLAGS.config_path)
print(FLAGS.__dict__['__flags'].keys())
def main(argv=None):
train_data, train_labels, train_names, train_weights = reader.inputs(shuffle=True,
num_epochs=1,
dataset_partition='train')
sess = tf.Session()
sess.run(tf.initialize_local_variables())
coord = tf.train.Coordinator()
threads = tf.train.start_queue_runners(sess=sess, coord=coord)
for i in range(1):
print(i)
labels, weights = sess.run([train_labels, train_weights])
l255 = labels[0, labels[0] == 255]
suma=0
for j in range(19):
print('Label {}'.format(j))
lj=labels[0,labels[0]==j]
wj=weights[0,labels[0]==j]
iznos=len(lj)/(len(labels[0]))
print(iznos)
if len(wj)>0:
print('tezina',wj[0])
d=wj[0]*iznos
else:
d=0
suma+=d
print(suma)
coord.request_stop()
coord.join(threads)
sess.close()
if __name__ == '__main__':
tf.app.run()