36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
from paddleocr import SealTextDetection
|
|
import os
|
|
|
|
def debug_paddle():
|
|
img_path = "seal_cropped.png"
|
|
if not os.path.exists(img_path):
|
|
print(f"Error: {img_path} not found")
|
|
return
|
|
|
|
print(f"Loading SealTextDetection model on {img_path}...")
|
|
try:
|
|
model = SealTextDetection(model_name="PP-OCRv4_server_seal_det")
|
|
output = model.predict(img_path, batch_size=1)
|
|
|
|
print(f"Output type: {type(output)}")
|
|
for i, res in enumerate(output):
|
|
print(f"Result {i} attributes: {dir(res)}")
|
|
res.print()
|
|
# Try to see if it has boxes or polygons
|
|
if hasattr(res, 'boxes'):
|
|
print(f"Boxes found: {len(res.boxes)}")
|
|
if hasattr(res, 'polygons'):
|
|
print(f"Polygons found: {len(res.polygons)}")
|
|
|
|
# Save to see what it does
|
|
res.save_to_img(save_path="./debug_output")
|
|
print("Saved debug image to ./debug_output")
|
|
|
|
except Exception as e:
|
|
print(f"Caught Exception: {e}")
|
|
import traceback
|
|
traceback.print_exc()
|
|
|
|
if __name__ == "__main__":
|
|
debug_paddle()
|