@@ -18,21 +18,19 @@ def main(params):
18
18
with h5py .File (os .path .join (params ['fc_output_dir' ], 'feats_fc.h5' )) as file_fc ,\
19
19
h5py .File (os .path .join (params ['att_output_dir' ], 'feats_att.h5' )) as file_att :
20
20
for i , img in enumerate (imgs ):
21
- d_set_fc = file_fc .create_dataset (
22
- str (img ['cocoid' ]), (2048 ,), dtype = "float" )
23
- d_set_att = file_att .create_dataset (
24
- str (img ['cocoid' ]),
25
- (params ['att_size' ], params ['att_size' ], 2048 ), dtype = "float" )
26
-
27
21
npy_fc_path = os .path .join (
28
- params ['fc_input_dir' ][: - 1 ] ,
22
+ params ['fc_input_dir' ],
29
23
str (img ['cocoid' ]) + '.npy' )
30
24
npy_att_path = os .path .join (
31
- params ['att_input_dir' ][: - 1 ] ,
25
+ params ['att_input_dir' ],
32
26
str (img ['cocoid' ]) + '.npz' )
33
27
34
- d_set_fc [...] = np .load (npy_fc_path )
35
- d_set_att [...] = np .load (npy_att_path )['feat' ]
28
+ d_set_fc = file_fc .create_dataset (
29
+ str (img ['cocoid' ]), data = np .load (npy_fc_path ))
30
+ d_set_att = file_att .create_dataset (
31
+ str (img ['cocoid' ]),
32
+ data = np .load (npy_att_path )['feat' ])
33
+
36
34
if i % 1000 == 0 :
37
35
print ('processing %d/%d (%.2f%% done)' % (i , N , i * 100.0 / N ))
38
36
file_fc .close ()
@@ -48,7 +46,6 @@ def main(params):
48
46
parser .add_argument ('--att_output_dir' , default = 'data' , help = 'output directory for att' )
49
47
parser .add_argument ('--fc_input_dir' , default = 'data' , help = 'input directory for numpy fc files' )
50
48
parser .add_argument ('--att_input_dir' , default = 'data' , help = 'input directory for numpy att files' )
51
- parser .add_argument ('--att_size' , default = 14 , type = int , help = '14x14 or 7x7' )
52
49
53
50
args = parser .parse_args ()
54
51
params = vars (args ) # convert to ordinary dict
0 commit comments