Skip to content

Commit 541409f

Browse files
committed
edit output logits
1 parent fbe4a17 commit 541409f

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

evaler.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import time
1414
import numpy as np
1515
import tensorflow as tf
16-
import h5py
16+
1717

1818
class EvalManager(object):
1919
def __init__(self):
@@ -183,13 +183,15 @@ def log_step_message(self, step, accuracy, step_time, is_train=False):
183183
)
184184
)
185185

186+
186187
def check_data_path(path):
187188
if os.path.isfile(os.path.join(path, 'data.hy')) \
188189
and os.path.isfile(os.path.join(path, 'id.txt')):
189190
return True
190191
else:
191192
return False
192193

194+
193195
def main():
194196
import argparse
195197
parser = argparse.ArgumentParser()
@@ -204,7 +206,7 @@ def main():
204206
path = os.path.join('./datasets', config.dataset_path)
205207

206208
if check_data_path(path):
207-
import sort_of_clevr as dataset
209+
import sort_of_clevr as dataset
208210
else:
209211
raise ValueError(path)
210212

model_baseline.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,9 @@ def C(img, q, scope='Classifier'):
9999
print('{} {}'.format(scope.name, fc_3))
100100
return fc_3
101101

102-
self.all_preds = C(self.img, self.q, scope='Classifier')
103-
self.loss, self.accuracy = build_loss(self.all_preds, self.a)
102+
logits = C(self.img, self.q, scope='Classifier')
103+
self.all_preds = tf.nn.softmax(logits)
104+
self.loss, self.accuracy = build_loss(logits, self.a)
104105

105106
# Add summaries
106107
def draw_iqa(img, q, target_a, pred_a):

model_rn.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,9 @@ def f_phi(g, scope='f_phi'):
146146
return fc_3
147147

148148
g = CONV(self.img, self.q, scope='CONV')
149-
self.all_preds = f_phi(g, scope='f_phi')
150-
self.loss, self.accuracy = build_loss(self.all_preds, self.a)
149+
logits = f_phi(g, scope='f_phi')
150+
self.all_preds = tf.nn.softmax(logits)
151+
self.loss, self.accuracy = build_loss(logits, self.a)
151152

152153
# Add summaries
153154
def draw_iqa(img, q, target_a, pred_a):

0 commit comments

Comments
 (0)