tamil_ocr
tamil_ocr copied to clipboard
No speed advantage when using batches.
I did some tests when using both detection+recognition with a set of 30 images and I've seen that there is no speed improvements when using batches. So I checked the code and if I got it right in your implementation, https://github.com/gnana70/tamil_ocr/blob/71a91db47ba76c2c6b4612e68276da5077edc47a/ocr_tamil/ocr.py#L527-L536 you split the batch into single images and then pass each image to craft, get the BB and pass those to ParSeq.
I'm not an expert in Parseq, but if it already can deal with batches of BB why not simply take all the BB from the all batch and pass those as a single input to parseq?
To recap my suggestion why don't you do something like the following:
bbs=[]
for image in batch:
bb_preds=craft(image)
bbs.appens(bb_preds)
texts=parseq_read_batch(bbs)
This should be faster as you call parseq only once per batch and not per image, albeit with a larger memory cost but that can be dealt by the batches size parameter.
Obviously even better would be to do something like:
bbs=craft_batch(batch)
texts=parseq_batch(bbs)