def setupValidate(self):
batch_size = self.cfgParams.batch_size
givens_val = {self.x[0]: self.val_data_x[self.index * batch_size:(self.index + 1) * batch_size]}
for i in range(1, self.poseNet.cfgParams.numInputs):
givens_val[self.x[i]] = getattr(self, 'val_data_x'+str(i))[self.index * batch_size:(self.index + 1) * batch_size]
givens_val[self.y] = self.val_data_y[self.index * batch_size:(self.index + 1) * batch_size]
givens_val_cost = {self.x[0]: self.val_data_x[self.index * batch_size:(self.index + 1) * batch_size]}
for i in range(1, self.poseNet.cfgParams.numInputs):
givens_val_cost[self.x[i]] = getattr(self, 'val_data_x'+str(i))[self.index * batch_size:(self.index + 1) * batch_size]
givens_val_cost[self.y] = self.val_data_y[self.index * batch_size:(self.index + 1) * batch_size]
print("compiling validation_cost() ... ")
self.validation_cost = theano.function(inputs=[self.index],
outputs=self.cost,
givens=givens_val_cost)
print("done.")
print("compiling validation_error() ... ")
self.validation_error = theano.function(inputs=[self.index],
outputs=self.errors,
givens=givens_val)
print("done.")
# debug and so
print("compiling compute_val_descr() ... ")
givens_val_descr = {self.x[0]: self.val_data_x[self.index * batch_size:(self.index + 1) * batch_size]}
for i in range(1, self.poseNet.cfgParams.numInputs):
givens_val_descr[self.x[i]] = getattr(self, 'val_data_x'+str(i))[self.index * batch_size:(self.index + 1) * batch_size]
self.compute_val_descr = theano.function(inputs=[self.index],
outputs=self.poseNet.output,
givens=givens_val_descr)
print("done.")
评论列表
文章目录