Commit f1569a4d authored by Amir MOHAMMADI's avatar Amir MOHAMMADI

Adopt to the new database

parent cf2caa3f
Pipeline #14256 failed with stages
in 8 minutes and 9 seconds
......@@ -66,42 +66,7 @@ def checkfiles(args):
return 0
def convert_filelist_pad(path, outfolder, append, test, group):
outfolder = os.path.join(outfolder, group)
realpath = os.path.join(outfolder, 'for_real.lst')
attackpath = os.path.join(outfolder, 'for_attack.lst')
create_directories_safe(os.path.dirname(realpath))
conv = {'1': 'real', '2': 'print1', '3': 'print2',
'4': 'video_replay1', '5': 'video_replay2'}
with open(path) as f, \
open(realpath, 'w') as rf, \
open(attackpath, 'w') as af:
for line in f:
if test:
isreal = True
if line[0] == '+':
isreal = True
elif line[0] == '-':
isreal = False
elif not test:
print('ignoring line: ' + line)
continue
if test:
filename = line.strip()
client_id = 'test'
else:
_, filename = line.strip().split(',')
_, _, client_id, attack_type = filename.split('_')
attack_type = conv[attack_type]
filename = append + os.sep + filename
if isreal:
rf.write('{} {}\n'.format(filename, client_id))
else:
af.write('{} {} {}\n'.format(
filename, client_id, attack_type))
def convert_filelist_dap(path, outfolder, append, test, group):
def convert_filelist(path, outfolder, prepend, group):
if group == 'world':
outpath = os.path.join(outfolder, 'norm', 'train_world.lst')
else:
......@@ -110,28 +75,22 @@ def convert_filelist_dap(path, outfolder, append, test, group):
with open(os.path.join(outfolder, group, 'for_models.lst'), 'w') as f:
pass
create_directories_safe(os.path.dirname(outpath))
conv = {'1': 'real', '2': 'print1', '3': 'print2',
'4': 'video_replay1', '5': 'video_replay2'}
conv = {'1': 'real', '2': 'print/1', '3': 'print/2',
'4': 'video_replay/1', '5': 'video_replay/2'}
with open(path) as f, \
open(outpath, 'w') as wf:
for line in f:
if test:
isreal = True
if line[0] == '+':
isreal = True
elif line[0] == '-':
isreal = False
elif not test:
else:
print('ignoring line: ' + line)
continue
if test:
filename = line.strip()
client_id = 'test'
else:
_, filename = line.strip().split(',')
_, _, client_id, attack_type = filename.split('_')
attack_type = conv[attack_type]
filename = os.path.join(append, filename)
_, filename = line.strip().split(',')
_, _, client_id, attack_type = filename.split('_')
attack_type = conv[attack_type]
filename = os.path.join(prepend, filename)
if not isreal:
client_id = 'attack/{}/{}'.format(attack_type, client_id)
......@@ -148,18 +107,10 @@ def create(args):
output_dir = args.output_dir
groups2 = ['world', 'dev', 'eval']
convert_filelist = convert_filelist_dap
for grp1, grp2 in zip(['Train', 'Dev', 'Test'],
groups2):
if grp1 == 'Test':
part = 'OULU_NPU_Part_2'
append = 'OULU_NPU_Part_2/Files_2'
test = True
else:
part = 'OULU_NPU_Part_1'
append = 'OULU_NPU_Part_1/Files_1'
test = False
prepend = grp1 + '_files'
for protocol in ('Protocol_1', 'Protocol_2', 'Protocol_3',
'Protocol_4'):
......@@ -171,9 +122,9 @@ def create(args):
textfile = '{}_{}.txt'.format(grp1, i)
new_protocol = '{}_{}'.format(protocol, i)
convert_filelist(
os.path.join(root_dir, part, protocol, textfile),
os.path.join(root_dir, 'Protocols', protocol, textfile),
os.path.join(output_dir, new_protocol),
append, test, grp2)
prepend, grp2)
if protocol in ('Protocol_1', 'Protocol_2'):
break
......
OULU_NPU_Part_2/Files_2/02C48 model model test
OULU_NPU_Part_2/Files_2/03418 model model test
OULU_NPU_Part_2/Files_2/03BE8 model model test
OULU_NPU_Part_2/Files_2/02C49 model model test
OULU_NPU_Part_2/Files_2/03419 model model test
OULU_NPU_Part_2/Files_2/03BE9 model model test
OULU_NPU_Part_2/Files_2/02C4A model model test
OULU_NPU_Part_2/Files_2/0341A model model test
OULU_NPU_Part_2/Files_2/03BEA model model test
OULU_NPU_Part_2/Files_2/02C4B model model test
OULU_NPU_Part_2/Files_2/0341B model model test
OULU_NPU_Part_2/Files_2/03BEB model model test
OULU_NPU_Part_2/Files_2/02C4C model model test
OULU_NPU_Part_2/Files_2/0341C model model test
OULU_NPU_Part_2/Files_2/03BEC model model test
OULU_NPU_Part_2/Files_2/02C4D model model test
OULU_NPU_Part_2/Files_2/0341D model model test
OULU_NPU_Part_2/Files_2/03BED model model test
OULU_NPU_Part_2/Files_2/02C4E model model test
OULU_NPU_Part_2/Files_2/0341E model model test
OULU_NPU_Part_2/Files_2/03BEE model model test
OULU_NPU_Part_2/Files_2/02C4F model model test
OULU_NPU_Part_2/Files_2/0341F model model test
OULU_NPU_Part_2/Files_2/03BEF model model test
OULU_NPU_Part_2/Files_2/02C50 model model test
OULU_NPU_Part_2/Files_2/03420 model model test
OULU_NPU_Part_2/Files_2/03BF0 model model test
OULU_NPU_Part_2/Files_2/02C51 model model test
OULU_NPU_Part_2/Files_2/03421 model model test
OULU_NPU_Part_2/Files_2/03BF1 model model test
OULU_NPU_Part_2/Files_2/02C52 model model test
OULU_NPU_Part_2/Files_2/03422 model model test
OULU_NPU_Part_2/Files_2/03BF2 model model test
OULU_NPU_Part_2/Files_2/02C53 model model test
OULU_NPU_Part_2/Files_2/03423 model model test
OULU_NPU_Part_2/Files_2/03BF3 model model test
OULU_NPU_Part_2/Files_2/02C54 model model test
OULU_NPU_Part_2/Files_2/03424 model model test
OULU_NPU_Part_2/Files_2/03BF4 model model test
OULU_NPU_Part_2/Files_2/02C55 model model test
OULU_NPU_Part_2/Files_2/03425 model model test
OULU_NPU_Part_2/Files_2/03BF5 model model test
OULU_NPU_Part_2/Files_2/02C56 model model test
OULU_NPU_Part_2/Files_2/03426 model model test
OULU_NPU_Part_2/Files_2/03BF6 model model test
OULU_NPU_Part_2/Files_2/02C57 model model test
OULU_NPU_Part_2/Files_2/03427 model model test
OULU_NPU_Part_2/Files_2/03BF7 model model test
OULU_NPU_Part_2/Files_2/02C58 model model test
OULU_NPU_Part_2/Files_2/03428 model model test
OULU_NPU_Part_2/Files_2/03BF8 model model test
OULU_NPU_Part_2/Files_2/02C59 model model test
OULU_NPU_Part_2/Files_2/03429 model model test
OULU_NPU_Part_2/Files_2/03BF9 model model test
OULU_NPU_Part_2/Files_2/02C5A model model test
OULU_NPU_Part_2/Files_2/0342A model model test
OULU_NPU_Part_2/Files_2/03BFA model model test
OULU_NPU_Part_2/Files_2/02C5B model model test
OULU_NPU_Part_2/Files_2/0342B model model test
OULU_NPU_Part_2/Files_2/03BFB model model test
Test_files/1_3_36_1 model model 36
Test_files/1_3_36_3 model model attack/print/2/36
Test_files/1_3_36_5 model model attack/video_replay/2/36
Test_files/1_3_37_1 model model 37
Test_files/1_3_37_3 model model attack/print/2/37
Test_files/1_3_37_5 model model attack/video_replay/2/37
Test_files/1_3_38_1 model model 38
Test_files/1_3_38_3 model model attack/print/2/38
Test_files/1_3_38_5 model model attack/video_replay/2/38
Test_files/1_3_39_1 model model 39
Test_files/1_3_39_3 model model attack/print/2/39
Test_files/1_3_39_5 model model attack/video_replay/2/39
Test_files/1_3_40_1 model model 40
Test_files/1_3_40_3 model model attack/print/2/40
Test_files/1_3_40_5 model model attack/video_replay/2/40
Test_files/1_3_41_1 model model 41
Test_files/1_3_41_3 model model attack/print/2/41
Test_files/1_3_41_5 model model attack/video_replay/2/41
Test_files/1_3_42_1 model model 42
Test_files/1_3_42_3 model model attack/print/2/42
Test_files/1_3_42_5 model model attack/video_replay/2/42
Test_files/1_3_43_1 model model 43
Test_files/1_3_43_3 model model attack/print/2/43
Test_files/1_3_43_5 model model attack/video_replay/2/43
Test_files/1_3_44_1 model model 44
Test_files/1_3_44_3 model model attack/print/2/44
Test_files/1_3_44_5 model model attack/video_replay/2/44
Test_files/1_3_45_1 model model 45
Test_files/1_3_45_3 model model attack/print/2/45
Test_files/1_3_45_5 model model attack/video_replay/2/45
Test_files/1_3_46_1 model model 46
Test_files/1_3_46_3 model model attack/print/2/46
Test_files/1_3_46_5 model model attack/video_replay/2/46
Test_files/1_3_47_1 model model 47
Test_files/1_3_47_3 model model attack/print/2/47
Test_files/1_3_47_5 model model attack/video_replay/2/47
Test_files/1_3_48_1 model model 48
Test_files/1_3_48_3 model model attack/print/2/48
Test_files/1_3_48_5 model model attack/video_replay/2/48
Test_files/1_3_49_1 model model 49
Test_files/1_3_49_3 model model attack/print/2/49
Test_files/1_3_49_5 model model attack/video_replay/2/49
Test_files/1_3_50_1 model model 50
Test_files/1_3_50_3 model model attack/print/2/50
Test_files/1_3_50_5 model model attack/video_replay/2/50
Test_files/1_3_51_1 model model 51
Test_files/1_3_51_3 model model attack/print/2/51
Test_files/1_3_51_5 model model attack/video_replay/2/51
Test_files/1_3_52_1 model model 52
Test_files/1_3_52_3 model model attack/print/2/52
Test_files/1_3_52_5 model model attack/video_replay/2/52
Test_files/1_3_53_1 model model 53
Test_files/1_3_53_3 model model attack/print/2/53
Test_files/1_3_53_5 model model attack/video_replay/2/53
Test_files/1_3_54_1 model model 54
Test_files/1_3_54_3 model model attack/print/2/54
Test_files/1_3_54_5 model model attack/video_replay/2/54
Test_files/1_3_55_1 model model 55
Test_files/1_3_55_3 model model attack/print/2/55
Test_files/1_3_55_5 model model attack/video_replay/2/55
OULU_NPU_Part_2/Files_2/05358 model model test
OULU_NPU_Part_2/Files_2/05B28 model model test
OULU_NPU_Part_2/Files_2/062F8 model model test
OULU_NPU_Part_2/Files_2/05359 model model test
OULU_NPU_Part_2/Files_2/05B29 model model test
OULU_NPU_Part_2/Files_2/062F9 model model test
OULU_NPU_Part_2/Files_2/0535A model model test
OULU_NPU_Part_2/Files_2/05B2A model model test
OULU_NPU_Part_2/Files_2/062FA model model test
OULU_NPU_Part_2/Files_2/0535B model model test
OULU_NPU_Part_2/Files_2/05B2B model model test
OULU_NPU_Part_2/Files_2/062FB model model test
OULU_NPU_Part_2/Files_2/0535C model model test
OULU_NPU_Part_2/Files_2/05B2C model model test
OULU_NPU_Part_2/Files_2/062FC model model test
OULU_NPU_Part_2/Files_2/0535D model model test
OULU_NPU_Part_2/Files_2/05B2D model model test
OULU_NPU_Part_2/Files_2/062FD model model test
OULU_NPU_Part_2/Files_2/0535E model model test
OULU_NPU_Part_2/Files_2/05B2E model model test
OULU_NPU_Part_2/Files_2/062FE model model test
OULU_NPU_Part_2/Files_2/0535F model model test
OULU_NPU_Part_2/Files_2/05B2F model model test
OULU_NPU_Part_2/Files_2/062FF model model test
OULU_NPU_Part_2/Files_2/05360 model model test
OULU_NPU_Part_2/Files_2/05B30 model model test
OULU_NPU_Part_2/Files_2/06300 model model test
OULU_NPU_Part_2/Files_2/05361 model model test
OULU_NPU_Part_2/Files_2/05B31 model model test
OULU_NPU_Part_2/Files_2/06301 model model test
OULU_NPU_Part_2/Files_2/05362 model model test
OULU_NPU_Part_2/Files_2/05B32 model model test
OULU_NPU_Part_2/Files_2/06302 model model test
OULU_NPU_Part_2/Files_2/05363 model model test
OULU_NPU_Part_2/Files_2/05B33 model model test
OULU_NPU_Part_2/Files_2/06303 model model test
OULU_NPU_Part_2/Files_2/05364 model model test
OULU_NPU_Part_2/Files_2/05B34 model model test
OULU_NPU_Part_2/Files_2/06304 model model test
OULU_NPU_Part_2/Files_2/05365 model model test
OULU_NPU_Part_2/Files_2/05B35 model model test
OULU_NPU_Part_2/Files_2/06305 model model test
OULU_NPU_Part_2/Files_2/05366 model model test
OULU_NPU_Part_2/Files_2/05B36 model model test
OULU_NPU_Part_2/Files_2/06306 model model test
OULU_NPU_Part_2/Files_2/05367 model model test
OULU_NPU_Part_2/Files_2/05B37 model model test
OULU_NPU_Part_2/Files_2/06307 model model test
OULU_NPU_Part_2/Files_2/05368 model model test
OULU_NPU_Part_2/Files_2/05B38 model model test
OULU_NPU_Part_2/Files_2/06308 model model test
OULU_NPU_Part_2/Files_2/05369 model model test
OULU_NPU_Part_2/Files_2/05B39 model model test
OULU_NPU_Part_2/Files_2/06309 model model test
OULU_NPU_Part_2/Files_2/0536A model model test
OULU_NPU_Part_2/Files_2/05B3A model model test
OULU_NPU_Part_2/Files_2/0630A model model test
OULU_NPU_Part_2/Files_2/0536B model model test
OULU_NPU_Part_2/Files_2/05B3B model model test
OULU_NPU_Part_2/Files_2/0630B model model test
Test_files/2_3_36_1 model model 36
Test_files/2_3_36_3 model model attack/print/2/36
Test_files/2_3_36_5 model model attack/video_replay/2/36
Test_files/2_3_37_1 model model 37
Test_files/2_3_37_3 model model attack/print/2/37
Test_files/2_3_37_5 model model attack/video_replay/2/37
Test_files/2_3_38_1 model model 38
Test_files/2_3_38_3 model model attack/print/2/38
Test_files/2_3_38_5 model model attack/video_replay/2/38
Test_files/2_3_39_1 model model 39
Test_files/2_3_39_3 model model attack/print/2/39
Test_files/2_3_39_5 model model attack/video_replay/2/39
Test_files/2_3_40_1 model model 40
Test_files/2_3_40_3 model model attack/print/2/40
Test_files/2_3_40_5 model model attack/video_replay/2/40
Test_files/2_3_41_1 model model 41
Test_files/2_3_41_3 model model attack/print/2/41
Test_files/2_3_41_5 model model attack/video_replay/2/41
Test_files/2_3_42_1 model model 42
Test_files/2_3_42_3 model model attack/print/2/42
Test_files/2_3_42_5 model model attack/video_replay/2/42
Test_files/2_3_43_1 model model 43
Test_files/2_3_43_3 model model attack/print/2/43
Test_files/2_3_43_5 model model attack/video_replay/2/43
Test_files/2_3_44_1 model model 44
Test_files/2_3_44_3 model model attack/print/2/44
Test_files/2_3_44_5 model model attack/video_replay/2/44
Test_files/2_3_45_1 model model 45
Test_files/2_3_45_3 model model attack/print/2/45
Test_files/2_3_45_5 model model attack/video_replay/2/45
Test_files/2_3_46_1 model model 46
Test_files/2_3_46_3 model model attack/print/2/46
Test_files/2_3_46_5 model model attack/video_replay/2/46
Test_files/2_3_47_1 model model 47
Test_files/2_3_47_3 model model attack/print/2/47
Test_files/2_3_47_5 model model attack/video_replay/2/47
Test_files/2_3_48_1 model model 48
Test_files/2_3_48_3 model model attack/print/2/48
Test_files/2_3_48_5 model model attack/video_replay/2/48
Test_files/2_3_49_1 model model 49
Test_files/2_3_49_3 model model attack/print/2/49
Test_files/2_3_49_5 model model attack/video_replay/2/49
Test_files/2_3_50_1 model model 50
Test_files/2_3_50_3 model model attack/print/2/50
Test_files/2_3_50_5 model model attack/video_replay/2/50
Test_files/2_3_51_1 model model 51
Test_files/2_3_51_3 model model attack/print/2/51
Test_files/2_3_51_5 model model attack/video_replay/2/51
Test_files/2_3_52_1 model model 52
Test_files/2_3_52_3 model model attack/print/2/52
Test_files/2_3_52_5 model model attack/video_replay/2/52
Test_files/2_3_53_1 model model 53
Test_files/2_3_53_3 model model attack/print/2/53
Test_files/2_3_53_5 model model attack/video_replay/2/53
Test_files/2_3_54_1 model model 54
Test_files/2_3_54_3 model model attack/print/2/54
Test_files/2_3_54_5 model model attack/video_replay/2/54
Test_files/2_3_55_1 model model 55
Test_files/2_3_55_3 model model attack/print/2/55
Test_files/2_3_55_5 model model attack/video_replay/2/55
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment