Update generate_flower_list.py
-import scipy.io
-import numpy as np
-import os
-import sys
-
-""".mat files data format
+"""
+.mat files data format
imagelabel.mat
jpg_name 1 2 3 ...
label 32 12 66 ...
@@ -15,10 +11,15 @@ label 4 ...
"""
Usage:
python generate_flower_list.py prefix_folder mode
-
python generate_flower_list.py jpg train > train_list.txt
python generate_flower_list.py jpg valid > val_list.txt
"""
+
+import scipy.io
+import numpy as np
+import os
+import sys
+
data_path = sys.argv[1]
imagelabels_path = './imagelabels.mat'
setid_path = './setid.mat'
@@ -33,5 +34,5 @@ d['valid'] = np.array(setid['valid'][0])
d['test'] = np.array(setid['tstid'][0])
for id in d[sys.argv[2]]:
- message = str(data_path)+"/image_"+str(id).zfill(5)+".jpg "+str(labels[id-1])
+ message = str(data_path) + "/image_" + str(id).zfill(5) + ".jpg " + str(labels[id - 1] - 1)
print(message)
