def predictPL(self):
B = self.flags.batch_size
W,H,C = self.flags.width, self.flags.height, self.flags.color
inputs = tf.placeholder(dtype=tf.float32,shape=[None,H,W,C])
#with open(self.flags.pred_path,'w') as f:
# pass
self._build(inputs,resize=False)
counter = 0
with tf.Session() as sess:
self.sess = sess
sess.run(tf.global_variables_initializer())
sess.run(tf.local_variables_initializer())
for imgs,imgnames in self.DATA.test_generator():
pred = sess.run(self.logit,feed_dict={inputs:imgs})
np.save("%s/%d.npy"%(self.flags.pred_path,counter),{"pred":pred,"name":imgnames})
counter+=len(imgs)
if counter/B%10 ==0:
print_mem_time("%d images predicted"%counter)
# train with placeholders
评论列表
文章目录