{"id":24146,"library":"onnxtr","title":"OnnxTR","description":"Onnx Text Recognition (OnnxTR) is an Onnx-wrapped version of docTR that provides high-performance OCR on documents. It supports text detection, recognition, and end-to-end OCR pipelines using pre-trained models exported to ONNX. Current version 0.8.1 requires Python >=3.10 and <4. Release cadence is irregular.","status":"active","version":"0.8.1","language":"python","source_language":"en","source_url":"https://github.com/Mindee/onnxtr","tags":["OCR","text-recognition","onnx","document-processing","deep-learning"],"install":[{"cmd":"pip install onnxtr","lang":"bash","label":"pip install"}],"dependencies":[],"imports":[{"note":"Main class for OCR.","symbol":"OCRPredictor","correct":"from onnxtr import OCRPredictor"},{"note":"Document class comes from docTR, not onnxtr.","wrong":"from onnxtr import Document","symbol":"Document","correct":"from doctr.io import Document"}],"quickstart":{"code":"from onnxtr import OCRPredictor\nfrom doctr.io import DocumentFile\n\n# Initialize predictor with detection + recognition models\npredictor = OCRPredictor(\n    det_arch='db_resnet50',\n    reco_arch='crnn_vgg16_bn',\n    pretrained=True\n)\n\n# Load a document image\ndoc = DocumentFile.from_images(\"path/to/image.jpg\")\n\n# Perform OCR\nresult = predictor(doc)\nprint(result.render())\n","lang":"python","description":"Basic usage of onnxtr to perform OCR on an image and print the recognized text."},"warnings":[{"fix":"Upgrade Python to 3.10 or later; or use onnxtr<0.8.0 (not recommended).","message":"onnxtr 0.8.0+ requires Python >=3.10; Python 3.9 is not supported.","severity":"breaking","affected_versions":">=0.8.0"},{"fix":"Use DocumentFile.from_images() or ensure image is converted to RGB: cv2.cvtColor(img, cv2.COLOR_BGR2RGB).","message":"Input images must be RGB, not BGR (openCV default). onnxtr reads images as RGB by default via docTR's DocumentFile, but using openCV directly and then converting may cause color issues.","severity":"gotcha","affected_versions":"all"},{"fix":"Use docTR's onnx_export utilities. See docTR documentation.","message":"The standalone OnnxTR model export tools are deprecated; use docTR's native ONNX export instead.","severity":"deprecated","affected_versions":">=0.7.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Install docTR: pip install python-doctr","cause":"onnxtr depends on docTR at runtime, which is not automatically installed.","error":"ModuleNotFoundError: No module named 'doctr'"},{"fix":"Check file path; use absolute path or verify file exists.","cause":"Image path not found or image not loaded correctly.","error":"AttributeError: 'NoneType' object has no attribute 'shape'"},{"fix":"Ensure image is uint8 and values in [0,255]. If using tensor, use .to(torch.uint8) or convert properly.","cause":"Image not in expected dtype (uint8 vs float). Usually when converting from PIL or NumPy array incorrectly.","error":"RuntimeError: Input type (unsigned char) and bias type (float) should be the same"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}