@@ -34,7 +34,7 @@ def export_annotations(task_id, dataset_id, categories):
34
34
db_categories = CategoryModel .objects (id__in = categories , deleted = False ) \
35
35
.only (* CategoryModel .COCO_PROPERTIES )
36
36
db_images = ImageModel .objects (
37
- deleted = False , annotated = True , dataset_id = dataset .id ).only (
37
+ deleted = False , dataset_id = dataset .id ).only (
38
38
* ImageModel .COCO_PROPERTIES )
39
39
db_annotations = AnnotationModel .objects (
40
40
deleted = False , category_id__in = categories )
@@ -80,6 +80,10 @@ def export_annotations(task_id, dataset_id, categories):
80
80
annotations = db_annotations .filter (image_id = image .get ('id' ))\
81
81
.only (* AnnotationModel .COCO_PROPERTIES )
82
82
annotations = fix_ids (annotations )
83
+
84
+ if len (annotations ) == 0 :
85
+ break
86
+
83
87
num_annotations = 0
84
88
for annotation in annotations :
85
89
@@ -303,4 +307,4 @@ def import_annotations(task_id, dataset_id, coco_json):
303
307
task .set_progress (100 , socket = socket )
304
308
305
309
306
- __all__ = ["export_annotations" , "import_annotations" ]
310
+ __all__ = ["export_annotations" , "import_annotations" ]
0 commit comments