1. 数据处理
首先将json文件(如下),经过一系列处理好保存在trainset.pth文件中
1.1 json文件数据预处理----trainset.pth文件
self.path_trainset = osp.join(self.subdir_processed, 'trainset.pth') #将vqa2.0json文件处理好后存放的地方
def process(self):
dir_ann = osp.join(self.dir_raw, 'annotations')
path_train_ann = osp.join(dir_ann, 'mscoco_train2014_annotations.json')
path_train_ques = osp.join(dir_ann, 'OpenEnded_mscoco_train2014_questions.json')
train_ann = json.load(open(path_train_ann))
train_ques = json.load(open(path_train_ques))
trainset = self.merge_annotations_with_questions(train_ann, train_ques) #合并答案和question文件
trainset = self.add_image_names(trainset) #向文件中添加图像名
trainset['annotations'] = self.add_answer(trainset['annotations']) #向文件中添加答案
trainset['annotations'] = self.tokenize_answers(trainset['annotations']) #对答案进行tokenize处理
trainset['questions'] = self.tokenize_questions(trainset['questions'], self.nlp) #对问题采用nlp进行tokenize处理
trainset['questions'] = self.insert_UNK_token(trainset[

本文介绍了一个视觉问答(VQA)任务中的数据处理流程,包括JSON文件预处理、Faster R-CNN提取图像特征及构建训练数据集的方法。
最低0.47元/天 解锁文章
5062

被折叠的 条评论
为什么被折叠?



