call predict function #175
-
Hi, is there any way to call the predict function on Image to Text (OCR) model with the image object and not its address? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
Hi @kghezelbash, |
Beta Was this translation helpful? Give feedback.
-
I have written this code:
and the output is : [{'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}, {'text': ''}] but when I save the image and pass the address it reads the image fine, I cant find my mistake. |
Beta Was this translation helpful? Give feedback.
-
@kghezelbash, If you want to pass in a numpy array image, you have to pass it inside a list: from hezar.models import Model
# OCR with CRNN
model = Model.load("hezarai/crnn-fa-printed-96-long")
image = cv2.imread("/content/drive/MyDrive/id_data_ocr_section/06872c53fb2cbb613f0652e6f798995c9b73e62ffea593edb681860109571f81.jpeg")
texts = model.predict([image[780:870, 550:850]])
print(texts) |
Beta Was this translation helpful? Give feedback.
-
Thank you =)))))) |
Beta Was this translation helpful? Give feedback.
@kghezelbash, If you want to pass in a numpy array image, you have to pass it inside a list: