@@ -411,6 +411,13 @@ def _lazy_image(item):
411
411
412
412
@classmethod
413
413
def _merge_items (cls , existing_item , current_item , path = None ):
414
+ return existing_item .wrap (path = path ,
415
+ image = cls ._merge_images (existing_item , current_item ),
416
+ annotations = cls ._merge_anno (
417
+ existing_item .annotations , current_item .annotations ))
418
+
419
+ @staticmethod
420
+ def _merge_images (existing_item , current_item ):
414
421
image = None
415
422
if existing_item .has_image and current_item .has_image :
416
423
if existing_item .image .has_data :
@@ -433,9 +440,7 @@ def _merge_items(cls, existing_item, current_item, path=None):
433
440
else :
434
441
image = current_item .image
435
442
436
- return existing_item .wrap (path = path ,
437
- image = image , annotations = cls ._merge_anno (
438
- existing_item .annotations , current_item .annotations ))
443
+ return image
439
444
440
445
@staticmethod
441
446
def _merge_anno (a , b ):
@@ -527,15 +532,11 @@ def __init__(self, project):
527
532
if own_source is not None :
528
533
log .debug ("Loading own dataset..." )
529
534
for item in own_source :
530
- if not item .has_image :
531
- existing_item = subsets [item .subset ].items .get (item .id )
532
- if existing_item is not None :
533
- image = None
534
- if existing_item .has_image :
535
- # TODO: think of image comparison
536
- image = self ._lazy_image (existing_item )
537
- item = item .wrap (path = None ,
538
- annotations = item .annotations , image = image )
535
+ existing_item = subsets [item .subset ].items .get (item .id )
536
+ if existing_item is not None :
537
+ item = item .wrap (path = None ,
538
+ image = self ._merge_images (existing_item , item ),
539
+ annotations = item .annotations )
539
540
540
541
subsets [item .subset ].items [item .id ] = item
541
542
0 commit comments