Open Wangyelan opened 6 months ago
Why the result of the detection is same to the image of the original image even I choose the image from the project?
And the ocr can't work,what's wrong with them?
I can't reproduce this issue (detection and OCR work fine for me on this same image). Do you see any log error messages?
No error,but some warning. D:\Anaconda\Lib\site-packages\surya\detection.py:92: RuntimeWarning: invalid value encountered in cast heat_img = Image.fromarray((heatmap 255).astype(np.uint8)) D:\Anaconda\Lib\site-packages\surya\detection.py:93: RuntimeWarning: invalid value encountered in cast aff_img = Image.fromarray((affinity_map 255).astype(np.uint8)) D:\Anaconda\Lib\site-packages\surya\postprocessing\affinity.py:28: RuntimeWarning: invalid value encountered in cast scaled_sobel = np.uint8(255 * abs_sobelx / np.max(abs_sobelx))
I get the same warning. Have anyone solved this problem?
No error,but some warning. D:\Anaconda\Lib\site-packages\surya\detection.py:92: RuntimeWarning: invalid value encountered in cast heat_img = Image.fromarray((heatmap 255).astype(np.uint8)) D:\Anaconda\Lib\site-packages\surya\detection.py:93: RuntimeWarning: invalid value encountered in cast aff_img = Image.fromarray((affinity_map 255).astype(np.uint8)) D:\Anaconda\Lib\site-packages\surya\postprocessing\affinity.py:28: RuntimeWarning: invalid value encountered in cast scaled_sobel = np.uint8(255 * abs_sobelx / np.max(abs_sobelx))
Was anybody able to solve this problem @Wangyelan @SachukS @VikParuchuri . I am encountering the same warnings. When I run the provided example code:
from PIL import Image
from surya.ocr import run_ocr
from surya.model.detection.model import load_model as load_det_model, load_processor as load_det_processor
from surya.model.recognition.model import load_model as load_rec_model
from surya.model.recognition.processor import load_processor as load_rec_processor
image = Image.open(IMAGE)
langs = ["en"] # Replace with your languages - optional but recommended
det_processor, det_model = load_det_processor(), load_det_model()
rec_model, rec_processor = load_rec_model(), load_rec_processor()
predictions = run_ocr([image], [langs], det_model, det_processor, rec_model, rec_processor)
I receive the same warnings as OP but the code runs perfectly fine. No errors occur.
The response I receive is empty though: [OCRResult(text_lines=[], languages=['en'], image_bbox=[0.0, 0.0, 2048.0, 1627.0])]
Any help would be great because I would really enjoy spinning up the GUI on my local machine and giving it a try. Thanks in advanced!