-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrainval_split.py
32 lines (25 loc) · 1.13 KB
/
trainval_split.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 sys
split_dir = '../../data/ImageSets'
base_path = '../../data/KITTI/'
with open(os.path.join(split_dir, 'val.txt'), 'r') as f:
lines = f.readlines()
for line in lines:
train_path = os.path.join(base_path, 'training')
val_path = os.path.join(base_path, 'validation')
command = 'mv {} {}'.format(os.path.join(train_path, 'calib', '{}.txt'.format(line[:-1])), \
os.path.join(val_path, 'calib', '{}.txt'.format(line[:-1])))
print(command)
os.system(command)
command = 'mv {} {}'.format(os.path.join(train_path, 'image_2', '{}.png'.format(line[:-1])), \
os.path.join(val_path, 'image_2', '{}.png'.format(line[:-1])))
print(command)
os.system(command)
command = 'mv {} {}'.format(os.path.join(train_path, 'label_2', '{}.txt'.format(line[:-1])), \
os.path.join(val_path, 'label_2', '{}.txt'.format(line[:-1])))
print(command)
os.system(command)
command = 'mv {} {}'.format(os.path.join(train_path, 'velodyne', '{}.bin'.format(line[:-1])), \
os.path.join(val_path, 'velodyne', '{}.bin'.format(line[:-1])))
print(command)
os.system(command)