@@ -91,7 +91,7 @@ def upload_images(
9191 project : str ,
9292 folder : str ,
9393 extensions : str = constances .DEFAULT_IMAGE_EXTENSIONS ,
94- set_annotation_status : str = constances .AnnotationStatus .NOT_STARTED .value ,
94+ set_annotation_status : str = constances .AnnotationStatus .NOT_STARTED .name ,
9595 exclude_file_patterns = constances .DEFAULT_FILE_EXCLUDE_PATTERNS ,
9696 recursive_subfolders = False ,
9797 image_quality_in_editor = None ,
@@ -129,7 +129,11 @@ def upload_image(image_path: str):
129129 return ProcessedImage (uploaded = False , path = image_path , entity = None )
130130
131131 paths = []
132- for extension in extensions .strip ().split ("," ):
132+
133+ if isinstance (extensions ,str ):
134+ extensions = extensions .strip ().split ("," )
135+
136+ for extension in extensions :
133137 if recursive_subfolders :
134138 paths += list (Path (folder ).rglob (f"*.{ extension .lower ()} " ))
135139 if os .name != "nt" :
@@ -164,7 +168,7 @@ def upload_image(image_path: str):
164168 uploaded_image_entities .append (processed_image .entity )
165169 else :
166170 failed_images .append (processed_image .path )
167- progress_bar .update (1 )
171+ progress_bar .update (1 )
168172
169173 for i in range (0 , len (uploaded_image_entities ), 500 ):
170174 self .controller .upload_images (
@@ -258,30 +262,33 @@ def _upload_annotations(
258262 if not task :
259263 task = "object_detection"
260264
265+ annotations_path = folder
261266 with tempfile .TemporaryDirectory () as temp_dir :
262- import_annotation (
263- input_dir = folder ,
264- output_dir = temp_dir ,
265- dataset_format = format ,
266- dataset_name = data_set_name ,
267- project_type = constances .ProjectType .get_name (
268- project ["project" ].project_type
269- ),
270- task = task ,
271- )
272- classes_path = f"{ temp_dir } /classes/classes.json"
267+ if format != 'SuperAnnotate' :
268+ import_annotation (
269+ input_dir = folder ,
270+ output_dir = temp_dir ,
271+ dataset_format = format ,
272+ dataset_name = data_set_name ,
273+ project_type = constances .ProjectType .get_name (
274+ project ["project" ].project_type
275+ ),
276+ task = task ,
277+ )
278+ annotations_path = temp_dir
279+ classes_path = f"{ folder } /classes/classes.json"
273280 self .controller .create_annotation_classes (
274281 project_name = project_name ,
275282 annotation_classes = json .load (open (classes_path )),
276283 )
277- annotation_paths = get_annotation_paths (temp_dir )
284+ annotation_paths = get_annotation_paths (annotations_path )
278285 chunk_size = 10
279286 with tqdm (total = len (annotation_paths )) as progress_bar :
280287 for i in range (0 , len (annotation_paths ), chunk_size ):
281288 response = self .controller .upload_annotations_from_folder (
282289 project_name = project ["project" ].name ,
283290 folder_name = folder_name ,
284- folder_path = temp_dir ,
291+ folder_path = annotations_path ,
285292 annotation_paths = annotation_paths [
286293 i : i + chunk_size # noqa: E203
287294 ],
0 commit comments