1616logger = logging .getLogger ("superannotate-python-sdk" )
1717
1818
19- def _load_files (path_to_imgs , ptype ):
19+ def _load_files (path_to_imgs , task , ptype ):
2020 suffix = None
2121 if ptype == "Pixel" :
2222 suffix = '___pixel.json'
@@ -27,16 +27,21 @@ def _load_files(path_to_imgs, ptype):
2727 orig_images = [str (x ).replace (suffix , '' ) for x in orig_images ]
2828 all_files = None
2929
30- if ptype == 'Pixel' :
30+ if task == 'keypoint_detection' :
31+ all_files = np .array ([[fname , fname + suffix ] for fname in orig_images ])
32+ elif ptype == 'Pixel' :
3133 all_files = np .array (
3234 [
33- ( str ( fname ), str ( fname ) + suffix , str ( fname ) + '___save.png' )
35+ [ fname , fname + suffix , fname + '___save.png' ]
3436 for fname in orig_images
3537 ]
3638 )
3739 elif ptype == 'Vector' :
3840 all_files = np .array (
39- [(str (fname ), str (fname ) + suffix ) for fname in orig_images ]
41+ [
42+ [fname , fname + suffix , fname + '___fuse.png' ]
43+ for fname in orig_images
44+ ]
4045 )
4146
4247 return all_files
@@ -47,7 +52,8 @@ def _move_files(data_set, src):
4752 if data_set is not None :
4853 for tup in data_set :
4954 for i in tup :
50- shutil .copy (i , train_path / Path (i ).name )
55+ if Path (i ).exists ():
56+ shutil .copy (i , train_path / Path (i ).name )
5157 else :
5258 logger .warning ("Images doesn't exist" )
5359
@@ -78,7 +84,7 @@ def export_from_sa(args):
7884 except Exception as e :
7985 _create_classes_mapper (args .input_dir , args .output_dir )
8086
81- data_set = _load_files (args .input_dir , args .project_type )
87+ data_set = _load_files (args .input_dir , args .task , args . project_type )
8288 _move_files (data_set , args .output_dir )
8389
8490 args .__dict__ .update (
0 commit comments