-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdataset.py
More file actions
34 lines (24 loc) · 857 Bytes
/
dataset.py
File metadata and controls
34 lines (24 loc) · 857 Bytes
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
33
34
from pathlib import Path
import os
import itertools
import shutil
import tqdm
def main():
path = '/media/rodrigo/Samsumg/coco_dvs2_train'
dist = '/media/rodrigo/Samsumg/evs_2'
trainpath = Path(path)
fname = [itm for itm in os.scandir(trainpath) if itm.is_file()]
files = [Path(itm).as_posix() for itm in fname if Path(itm).suffix == '.csv']
files = [list(g) for _, g in itertools.groupby(sorted(files), lambda x: x[0:-9])][:30]
imgs = [Path(itm).as_posix() for itm in fname if Path(itm).suffix == '.jpg']
ffiles = []
for f in tqdm.tqdm(files):
for ff in f:
shutil.copy2(ff, dist)
ffiles.append(Path(ff[:-9]).name)
for i in tqdm.tqdm(imgs):
if '_'.join(Path(i).name.split('_')[:3]):
shutil.copy2(i, dist)
print('stop')
if __name__ == '__main__':
main()