@@ -480,7 +480,7 @@ def generate(
480480 )
481481 data .cat (crop_data )
482482
483- if len (self .crop_boxes ) > 1 :
483+ if len (self .crop_boxes ) > 1 and len ( data [ "crop_boxes" ]) > 0 :
484484 # Prefer masks from smaller crops
485485 scores = 1 / box_area (data ["crop_boxes" ])
486486 scores = scores .to (data ["boxes" ].device )
@@ -788,7 +788,7 @@ def initialize(
788788 n_tiles = tiling .numberOfBlocks
789789
790790 mask_data = []
791- for tile_id in range (n_tiles ):
791+ for tile_id in tqdm ( range (n_tiles ), total = n_tiles , desc = "Compute masks for tile" , disable = not verbose ):
792792 # get the bounding box for this tile and crop the image data
793793 tile = tiling .getBlockWithHalo (tile_id , list (halo )).outerBlock
794794 tile_bb = tuple (slice (beg , end ) for beg , end in zip (tile .begin , tile .end ))
@@ -816,9 +816,7 @@ def initialize(
816816
817817 # the crop box is always the full local tile
818818 tiles = [tiling .getBlockWithHalo (tile_id , list (halo )).outerBlock for tile_id in range (n_tiles )]
819- self ._crop_boxes = [
820- [0 , 0 , tile .end [1 ] - tile .begin [1 ], tile .end [0 ] - tile .begin [0 ]] for tile in tiles
821- ]
819+ self ._crop_boxes = [[tile .begin [1 ], tile .begin [0 ], tile .end [1 ], tile .end [0 ]] for tile in tiles ]
822820
823821
824822class TiledEmbeddingMaskGenerator (EmbeddingMaskGenerator ):
0 commit comments