(self, batch, pred, is_output_polygon=False)
return boxes_batch, scores_batch
batch: (image, polygons, ignore_tags
        batch: a dict produced by dataloaders.
            image: tensor of shape (N, C, H, W).
            polygons: tensor of shape (N, K, 4, 2), the polygons of objective regions.
            ignore_tags: tensor of shape (N, K), indicates whether a region is ignorable or not.
            shape: the original shape of images.
            filename: the original filenames of images.
        pred:
            binary: text region segmentation map, with shape (N, H, W)
            thresh: [if exists] thresh hold prediction with shape (N, H, W)
            thresh_binary: [if exists] binarized with threshhold, (N, H, W)
batch: (image, polygons, ignore_tags
        batch: a dict produced by dataloaders.
            image: tensor of shape (N, C, H, W).
            polygons: tensor of shape (N, K, 4, 2), the polygons of objective regions.
            ignore_tags: tensor of shape (N, K), indicates whether a region is ignorable or not.
            shape: the original shape of images.
            filename: the original filenames of images.
        pred:
            binary: text region segmentation map, with shape (N, H, W)
            thresh: [if exists] thresh hold prediction with shape (N, H, W)
            thresh_binary: [if exists] binarized with threshhold, (N, H, W)
batch : ( image polygons ignore_tags batch : a dict produced by dataloaders . image : tensor of shape ( N C H W ) . polygons : tensor of shape ( N K 4 2 ) the polygons of objective regions . ignore_tags : tensor of shape ( N K ) indicates whether a region is ignorable or not . shape : the original shape of images . filename : the original filenames of images . pred : binary : text region segmentation map with shape ( N H W ) thresh : [ if exists ] thresh hold prediction with shape ( N H W ) thresh_binary : [ if exists ] binarized with threshhold ( N H W )
def __call__(self, batch, pred, is_output_polygon=False):
        '''
        batch: (image, polygons, ignore_tags
        batch: a dict produced by dataloaders.
            image: tensor of shape (N, C, H, W).
            polygons: tensor of shape (N, K, 4, 2), the polygons of objective regions.
            ignore_tags: tensor of shape (N, K), indicates whether a region is ignorable or not.
            shape: the original shape of images.
            filename: the original filenames of images.
        pred:
            binary: text region segmentation map, with shape (N, H, W)
            thresh: [if exists] thresh hold prediction with shape (N, H, W)
            thresh_binary: [if exists] binarized with threshhold, (N, H, W)
        '''
        pred = pred[:, 0, :, :]
        segmentation = self.binarize(pred)
        boxes_batch = []
        scores_batch = []
        for batch_index in range(pred.size(0)):
            height, width = batch['shape'][batch_index]
            if is_output_polygon:
                boxes, scores = self.polygons_from_bitmap(pred[batch_index], segmentation[batch_index], width, height)
            else:
                boxes, scores = self.boxes_from_bitmap(pred[batch_index], segmentation[batch_index], width, height)
            boxes_batch.append(boxes)
            scores_batch.append(scores)
        return boxes_batch, scores_batch
def __call__ ( self , batch , pred , is_output_polygon = False ) : pred = pred [ : , 0 , : , : ] segmentation = self . binarize ( pred ) boxes_batch = [ ] scores_batch = [ ] for batch_index in range ( pred . size ( 0 ) ) : height , width = batch [ 'shape' ] [ batch_index ] if is_output_polygon : boxes , scores = self . polygons_from_bitmap ( pred [ batch_index ] , segmentation [ batch_index ] , width , height ) else : boxes , scores = self . boxes_from_bitmap ( pred [ batch_index ] , segmentation [ batch_index ] , width , height ) boxes_batch . append ( boxes ) scores_batch . append ( scores ) return boxes_batch , scores_batch