numBatchElements = len(batch.imgs)
// put tensors to be evaluated into list
evalList = []
if self.decoderType == DecoderType.WordBeamSearch:
evalList.append(self.wbsInput)
else:
evalList.append(self.decoder)
if self.dump or calcProbability:
evalList.append(self.ctcIn3dTBC)
// dict containing all tensor fed into the model
feedDict = {self.inputImgs: batch.imgs, self.seqLen: [Model.maxTextLen] * numBatchElements,
self.is_train: False}
// evaluate model
evalRes = self.sess.run(evalList, feedDict)
// TF decoders: decoding already done in TF graph
if self.decoderType != DecoderType.WordBeamSearch:
decoded = evalRes[0]
// word beam search decoder: decoding is done in C++ function compute()
else:
decoded = self.decoder.compute(evalRes[0])
// map labels (numbers) to character string
texts = self.decoderOutputToText(decoded, numBatchElements)