dhlab-epfl / dhSegment

Generic framework for historical document processing
https://dhlab-epfl.github.com/dhSegment
GNU General Public License v3.0
370 stars 116 forks source link

error in predict_with_tiles #5

Closed solivr closed 6 years ago

solivr commented 6 years ago
ValueError                                Traceback (most recent call last)
<ipython-input-71-67f6e250ab7e> in <module>()
----> 1 predictions = model.predict_with_tiles(img[None], linear_interpolation=True)

/DocumentSegmentation/doc_seg/loader.py in predict_with_tiles(self, image_tensor, tile_size, min_overlap, linear_interpolation)
     70                     assigned_up_to_x = 0
     71                     for x, output in zip(x_pos, y_outputs):
---> 72                         _merge_x(tmp, assigned_up_to_x, output[k], x)
     73                         assigned_up_to_x = x+tile_size
     74                     _merge_y(result[k], assigned_up_to_y, tmp, y)

/DocumentSegmentation/doc_seg/loader.py in _merge_x(full_output, assigned_up_to, new_input, begin_position)
     47             if overlap_size > 0:
     48                 weights = np.arange(0, overlap_size)/overlap_size
---> 49                 full_output[:, :, begin_position:assigned_up_to] = (1-weights)[:, None]*full_output[:, :, begin_position:assigned_up_to] + \
     50                                                                    weights[:, None]*new_input[:, :, :overlap_size]
     51 

ValueError: operands could not be broadcast together with shapes (128,1) (1,500,128) 

Size of the input image : [1, 4778, 3474, 3]. No error if linear_interpolation=False