pbcquoc / vietocr

Transformer OCR
Apache License 2.0
605 stars 206 forks source link

predict text with batch images #32

Closed hiendoan95 closed 3 years ago

hiendoan95 commented 3 years ago

I'm using Tesseract to detect texts and extract text regions. Those images have the different sizes.

How could I use the transformerOCR as the batch predicter for those images?

pbcquoc commented 3 years ago

Hi e, Hiện tại model chỉ support cho từng ảnh, em có thể gọi nhiều lần để dự đoán cho nhiều ảnh.

hiendoan95 commented 3 years ago

Hi anh Quốc, Theo em thấy trong code của hàm translate dùng để predict text có cho phép detect với batch image. Em đã thử dùng resize để các ảnh có cùng độ cao và dùng padding để độ dài ảnh bằng nhau.

Tốc độ predict theo batch nhanh hơn predict từng ảnh (predict trên CPU với 20 ảnh nhanh hơn 20s). Tuy nhiên độ chính xác kém hơn (có thể do mô hình em train chưa được tốt).

pbcquoc commented 3 years ago

Mô hình a train theo batch nhưng không có padding. Nên e thêm padding vào có thể gây ra sai nhiều hơn.

anhanhtdh01 commented 3 years ago

I'm using Tesseract to detect texts and extract text regions. Those images have the different sizes.

How could I use the transformerOCR as the batch predicter for those images?

Hi anh Quốc, Theo em thấy trong code của hàm translate dùng để predict text có cho phép detect với batch image. Em đã thử dùng resize để các ảnh có cùng độ cao và dùng padding để độ dài ảnh bằng nhau.

Tốc độ predict theo batch nhanh hơn predict từng ảnh (predict trên CPU với 20 ảnh nhanh hơn 20s). Tuy nhiên độ chính xác kém hơn (có thể do mô hình em train chưa được tốt).

cho mình hỏi là predict với batch image kiểu gì ạ ??? Mình cảm ơn !