MCPcopy Create free account
hub / github.com/ICTMCG/FakeSV / __init__

Method __init__

code/utils/dataloader.py:35–59  ·  view source on GitHub ↗
(self, path_vid, datamode='title+ocr')

Source from the content-addressed store, hash-verified

33class 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]

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected