@@ -30,7 +30,8 @@ def read_compressed_msgpack(path, decompressor=None):
3030
3131def select_good_meshes (info_dict , data_dir ):
3232 # select only good meshes
33- raw_meshes_dir = os .path .join (data_dir ,'raw_meshes' )
33+ if data_dir :
34+ raw_meshes_dir = os .path .join (data_dir ,'raw_meshes' )
3435 selected_meshes = []
3536 attribution = []
3637 selection = {
@@ -63,7 +64,8 @@ def select_good_meshes(info_dict, data_dir):
6364 break ;
6465 if selected and info ['License' ] in licenses :
6566 attribution .append ('"{}"({}) by {} is licensed under {}' .format (info ['title' ].strip (), info ['Thing ID' ], info ['author' ], info ['License' ]))
66- selected_meshes .append (glob (os .path .join (raw_meshes_dir ,key + '.*' ))[0 ])
67+ if data_dir :
68+ selected_meshes .append (glob (os .path .join (raw_meshes_dir ,key + '.*' ))[0 ])
6769
6870 return selected_meshes , attribution
6971
@@ -105,11 +107,14 @@ def create_data(mesh_paths, output_path):
105107def main ():
106108 parser = argparse .ArgumentParser (description = "Create data files for training" ,
107109 formatter_class = argparse .ArgumentDefaultsHelpFormatter )
108- parser .add_argument ("--data_dir" , type = str , required = True , help = "The path to the Thingi10k dataset root." )
110+ parser .add_argument ("--data_dir" , type = str , default = None , help = "The path to the Thingi10k dataset root." )
109111 parser .add_argument ("--output_dir" , type = str , default = os .path .join (os .path .dirname (__file__ ), 't10k' ), help = "The path to the output dir" )
110112 parser .add_argument ("--attribution_file_only" , action = "store_true" , help = "Create only the attribution file" )
111113
112114 args = parser .parse_args ()
115+ if not args .attribution_file_only and not args .data_dir :
116+ print ("Please specify the path to the Thingi10K root with '--data-dir'" )
117+ return
113118
114119 info_dict = read_compressed_msgpack (os .path .join (os .path .dirname (__file__ ),'thingi10k_info.msgpack.zst' ))
115120
0 commit comments