forked from shreyash002/3D-model-reconstruction
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate_dataset.py
37 lines (32 loc) · 1.13 KB
/
create_dataset.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
33
34
35
36
37
import sys
import glob
import os
import shutil
if __name__=="__main__":
limit = 400
source_directory = sys.argv[1]
if source_directory[-1]!="/":
source_directory+="/"
destination_directory = sys.argv[2]
if destination_directory[-1]!="/":
destination_directory+="/"
class_list = ["02691156", "02958343", "03001627", "04090263", "03636649", "04401088", "04530566", "02828884"]
counter = 0
for folder in glob.glob(source_directory+"*/"):
if os.path.dirname(folder)[-8:] not in class_list:
continue
num_folder = 0
if not os.path.isdir(folder):
continue
for subdir in glob.glob(folder+"*/"):
if not os.path.isdir(subdir):
continue
savepath = destination_directory+str(counter)+"/"
# os.mkdir(savepath)
# os.mkdir(savepath+"images")
shutil.copytree(subdir+"img_choy2016", savepath+"images/")
shutil.copy(subdir+"model.binvox", savepath)
counter += 1
num_folder += 1
if num_folder == limit:
break