Usage of PaddleOCR for DICOM images #15449
-
Hello, I have been using PaddleOCRv2.9.1 for recognition of text from DICOM images, however when I try to upgrade to PaddleOCRv3.0.0 the code is giving me errors I do not understand. My code involves converting DICOM images into pixel arrays (via the Pydicom package) and then passing those pixel arrays to PaddleOCR. Old versions of PaddleOCR are able to accept pixel arrays as input, however this newest version seems to be having issues. Is there anyone who has been able to pass a pixel array into PaddleOCR? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Hello, may I ask what the specific issue is? I tested it on my end, and the new version does support passing np.array. |
Beta Was this translation helpful? Give feedback.
-
Hello, it seems like there is an issue with the preprocessing of the document. Could you provide the shape of the array or the DCM file? Alternatively, you could try setting the parameter use_doc_unwarping=False in PaddleOCR. |
Beta Was this translation helpful? Give feedback.
Hello, in PPOCRv5, the shape of the np.array must be [H, W, 3]. An array with shape [H, W] will result in an error during the preprocessing normalization stage due to the absence of shape[2]. You can use code img = np.dstack([img]*3) to convert an image from [H, W] to [H, W, 3] before inputting it into the ocr.predict() function.