-
Notifications
You must be signed in to change notification settings - Fork 7.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PaddleOCR throwing fscanf failed #12138
Comments
First, it is recommended to verify that the PaddlePaddle framework is successfully installed. import paddle
paddle.utils.run_check()
# PaddlePaddle is installed successfully! Then, please provide the smallest reproducible demo. |
Please provide the most basic operating environment so that we can reproduce this error locally and make the necessary modifications? OS: If you only provide error information without providing context, we cannot solve it here! Because we don't know in what environment this error was reported. |
I have uninstalled paddlepaddleocr. |
@SWHL |
@subhankardori you are right, I mistakenly thought it was an error log |
OS: Ubuntu 22.04.1 LTS from paddleocr import PaddleOCR
import os
import numpy as np
import glob
from time import time
# Setup model
ocr_model = PaddleOCR(lang='en', use_angle_cls=True, use_gpu=True)
# Source and destination directories
src_dir = 'abc'
dst_dir = 'xyz'
# Ensure destination directory exists
os.makedirs(dst_dir, exist_ok=True)
# Get list of image files in the source directory
image_paths = glob.glob(os.path.join(src_dir, '*'))
for img_path in image_paths:
# Running the OCR method on the model
t1=time()
result = ocr_model.ocr(img_path)
t2=time()
print("PaddleOCR time:",(t2-t1))
# Extracting detected components
boxes = [res[0] for res in result[0]] # The bounding boxes
texts = [res[1][0] for res in result[0]] # The recognized texts
scores = [res[1][1] for res in result[0]] # The confidence scores
print(boxes, texts, scores)
# # Import the image
# img = cv2.imread(img_path)
# ann=img.copy()
# # Reorder the color channels
# img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
# # Draw annotations on the image using OpenCV
# for box, text, score in zip(boxes, texts, scores):
# # Draw the bounding box
# box = np.array(box).astype(int)
# cv2.polylines(ann, [box], isClosed=True, color=(0, 255, 0), thickness=2)
# # Combine text with confidence score
# label = f'{text} ({score:.2f})'
# # Draw the text and confidence score
# cv2.putText(ann, label, (box[0][0], box[0][1] - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (255, 0, 0), 2)
# # Get the filename from the image path
# filename = os.path.basename(img_path)
# # Save the annotated image to the destination directory
# cv2.imwrite(os.path.join(dst_dir, filename), ann) But one key here is that, this is only occuring inside docker container, not when I am doing a ppocr inference on the local machine |
That's weird, and this is beyond my ability range. |
here are some things I tried to suppress it, but didnt work, may act as pointer
OR
didnt work to suppress this C++ warning |
Just uninstall paddleocr, it's really bad to use. |
@MonolithFoundation We are trying to make it more easier to use. |
@MonolithFoundation chill man, patience is the key, we will collaboratively sort it out |
@subhankardori |
W0517 10:10:58.219796 252 default_variables.cpp:95] Fail to fscanf: Success [0]
By any chance, does it have some relevance with Core Dumped , asking because when I was using the latest version of paddlepaddle-gpu, I was constantly hitting this error inside the docker:
so the mysterious part is that when I was running a simple code for paddleocr, it was running hassle-free, but when I was testing and end-to-end operation (in whcih that snippet of paddleocr code was a part),
W0517 10:10:58.219796 252 default_variables.cpp:95] Fail to fscanf: Success [0]
this is the warning log I am getting. Anything concerning about this log?The text was updated successfully, but these errors were encountered: