forked from layumi/University1652-Baseline
-
Notifications
You must be signed in to change notification settings - Fork 0
/
prepare_limit_view.py
24 lines (22 loc) · 899 Bytes
/
prepare_limit_view.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
import os
drone_path = './data/train/drone'
sample = [1, 3, 9, 18, 27]
step_list = [54, 18, 6, 3, 2]
for name, step in zip(sample, step_list):
target_path = drone_path + str(name)
if not os.path.isdir(target_path):
os.mkdir(target_path)
selected = range(1,54,step)
for dir_name in os.listdir(drone_path):
folder_name = drone_path + '/' + dir_name + '/'
target_folder_name = target_path + '/' + dir_name + '/'
if not os.path.isdir(folder_name):
continue
if not os.path.isdir(target_folder_name):
os.mkdir(target_folder_name)
for file_name in os.listdir(folder_name):
number = file_name.split('-')
number = number[1]
number = int(number[0:2])
if number%step == 1:
os.system('cp %s %s'%(folder_name + file_name, target_folder_name + file_name ))