1.模型结构
模型以BERT系列和ResNet系列为基础,分别处理文本和图像输入。文本处理模块基于预训练的BERT系列模型进行文本特征提取,并通过一个全连接层进行进一步的特征变换。图像处理模块采用预训练的ResNet系列模型,提取图像特征,并进行特征变换。多模态融合模块利用交叉多头注意力机制(CMA)将文本和图像特征进行融合,并通过全连接层进行分类。
2.对比模型
(1)图文特征直接进行拼接:TICat
text_feature = self.text_model(texts, texts_mask)
img_feature = self.img_model(imgs)
prob_vec = self.classifier(torch.cat([text_feature, img_feature], dim=1))
pred_labels = torch.argmax(prob_vec, dim=1)
(2)图文特征进行加和:TIAdd
text_feature = self.text_model(texts, texts_mask)
img_feature = self.img_model(imgs)
text_prob_vec = self.text_classifier(text_feature)
img_prob_vec = self.img_classifier(img_feature)
prob_vec = torch.softmax((text_prob_vec + img_prob_vec), dim=1)
pred_labels = torch.argmax(prob_vec, dim=1)
3.数据集介绍
数据集链接: