(self, path_vid, datamode='title+ocr')
| 33 | class SVFENDDataset(Dataset): |
| 34 | |
| 35 | def __init__(self, path_vid, datamode='title+ocr'): |
| 36 | |
| 37 | with open('./data/dict_vid_audioconvfea.pkl', "rb") as fr: |
| 38 | self.dict_vid_convfea = pickle.load(fr) |
| 39 | |
| 40 | self.data_complete = pd.read_json('./data/data.json',orient='records',dtype=False,lines=True) |
| 41 | self.data_complete = self.data_complete[self.data_complete['label']!=2] # label: 0-real, 1-fake, 2-debunk |
| 42 | |
| 43 | self.framefeapath='./data/ptvgg19_frames/' |
| 44 | self.c3dfeapath='./data/c3d/' |
| 45 | |
| 46 | self.vid = [] |
| 47 | |
| 48 | with open('./data/vids/'+path_vid, "r") as fr: |
| 49 | for line in fr.readlines(): |
| 50 | self.vid.append(line.strip()) |
| 51 | self.data = self.data_complete[self.data_complete.video_id.isin(self.vid)] |
| 52 | self.data['video_id'] = self.data['video_id'].astype('category') |
| 53 | self.data['video_id'].cat.set_categories(self.vid, inplace=True) |
| 54 | self.data.sort_values('video_id', ascending=True, inplace=True) |
| 55 | self.data.reset_index(inplace=True) |
| 56 | |
| 57 | self.tokenizer = BertTokenizer.from_pretrained('bert-base-chinese') |
| 58 | |
| 59 | self.datamode = datamode |
| 60 | |
| 61 | def __len__(self): |
| 62 | return self.data.shape[0] |
nothing calls this directly
no outgoing calls
no test coverage detected