CRAFT-Reimplementation icon indicating copy to clipboard operation
CRAFT-Reimplementation copied to clipboard

Dimensions of character boxes out of bounds on multiple epochs

Open vasusharma7 opened this issue 4 years ago • 1 comments

Found a small bug: On traversing through same image in multiple epochs and hence doing random_scaling every time, the coordinates in the previous epch get mutliplied by the scale factor every time, thus the dimensions of the character boxes overshoots the image dimension and hence no bounding boxes or region or affinity boxes made for that epoch.

Reason : The list indexing and slicing done in load_image_gt_and_confidencemask function in Synth80k class doesn't make a deep copy of the charbox coordinates and hence the same coordinates get modified.

Solution : using deepcopy for making list copy at line

_charbox = copy.deepcopy(self.charbox[index]).transpose((2, 1, 0))

https://github.com/backtime92/CRAFT-Reimplementation/blob/fbaa63aebd61c2b290752102cdef4758891b1fb7/data/dataset.py#L39

Although I found it working on master branch: https://github.com/backtime92/CRAFT-Reimplementation/blob/d24fd6895fa7153506f1114afc3ced99f07f889a/data_loader.py#L406

As a result in say 10th epoch, all we have is this image as output with no character boxes: ballet_106_0

After fixing with deepcopy, then it produces this after 10 epochs and random scaling : ballet_106_0

@backtime92 . Pardon me for tagging here but if this is not fixed already(excuse me if that is already fixed), this can certainly increase accuracy since if this is not done, then in the later epochs, all that the network is seeing is a plain image with no input character regions.

vasusharma7 avatar Jan 27 '22 11:01 vasusharma7

@vasusharma7 I am facing the same issue but while fine tuning icdar15 trained model on my own data. I tried the deepcopy on words but that doesn't fix the issue. suggestions are welcomed

MrAsifKhan avatar Dec 03 '22 23:12 MrAsifKhan