@@ -34,7 +34,7 @@ def export_annotations(task_id, dataset_id, categories):
3434 db_categories = CategoryModel .objects (id__in = categories , deleted = False ) \
3535 .only (* CategoryModel .COCO_PROPERTIES )
3636 db_images = ImageModel .objects (
37- deleted = False , annotated = True , dataset_id = dataset .id ).only (
37+ deleted = False , dataset_id = dataset .id ).only (
3838 * ImageModel .COCO_PROPERTIES )
3939 db_annotations = AnnotationModel .objects (
4040 deleted = False , category_id__in = categories )
@@ -80,6 +80,10 @@ def export_annotations(task_id, dataset_id, categories):
8080 annotations = db_annotations .filter (image_id = image .get ('id' ))\
8181 .only (* AnnotationModel .COCO_PROPERTIES )
8282 annotations = fix_ids (annotations )
83+
84+ if len (annotations ) == 0 :
85+ break
86+
8387 num_annotations = 0
8488 for annotation in annotations :
8589
@@ -303,4 +307,4 @@ def import_annotations(task_id, dataset_id, coco_json):
303307 task .set_progress (100 , socket = socket )
304308
305309
306- __all__ = ["export_annotations" , "import_annotations" ]
310+ __all__ = ["export_annotations" , "import_annotations" ]
0 commit comments