-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdata_selection.py
34 lines (25 loc) · 909 Bytes
/
data_selection.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import os
import numpy as np
folder_path = '/home/mauricio/rmi_final_project/FCN.tensorflow/logs/'
folder = os.listdir(folder_path+'dataset/')
files = np.array([], dtype='int32')
#SegmentationClass
#JPEGImages
for file_name in folder:
file_current_path = folder_path+'dataset/'+file_name
if file_name[-5] == "_":
file_new_path = folder_path+'SegmentationClass/'+file_name[:-5]+'.png'
else:
file_new_path = folder_path+'JPEGImages/'+file_name
# print file_current_path
# print file_new_path
# print " "
os.rename(file_current_path, file_new_path)
# for file in x:
# num = int(file[:-4])
# files = np.append(files, num)
# data = sorted(np.random.choice(files, 200, replace=False))
# for num in data:
# image_name = "%06d" % (num,) + '.png'
# current_path = '/home/mauricio/rmi_final_project/dataset/'+image_name
# new_path = '/home/mauricio/rmi_final_project/dataset_200_3/'+image_name