前端智能化漫谈 (3) - pix2code推理部分解析
上一节我们将pix2code的流程梳理了一遍,相信大家已经都可以跑起来了。
在谈pix2code的算法改进之前,关于训练和推理过程还有若干细节我们还需要进一步讨论一下。
onehot编码
上次我们讲到create_binary_representation,就是将单词转换成one hot编码。
def create_binary_representation(self):
if sys.version_info >= (3,):
items = self.vocabulary.items()
else:
items = self.vocabulary.iteritems()