Repository navigation
ultralytics-inference 0.0.58 Add scene text OCR with YOLO26-Text and PaddleOCR - #631
Conversation
…ch Python pixel for pixel Signed-off-by: Onuralp SEZER <onuralp@ultralytics.com>
Signed-off-by: Onuralp SEZER <onuralp@ultralytics.com>
…y default like Ultralytics Signed-off-by: Onuralp SEZER <onuralp@ultralytics.com>
…ltralytics Signed-off-by: Onuralp SEZER <onuralp@ultralytics.com>
…tics scale_coords Signed-off-by: Onuralp SEZER <onuralp@ultralytics.com>
…zer and predict --ocr Signed-off-by: Onuralp SEZER <onuralp@ultralytics.com>
Signed-off-by: Onuralp SEZER <onuralp@ultralytics.com>
…d reading order Signed-off-by: Onuralp SEZER <onuralp@ultralytics.com>
…ck like Ultralytics Signed-off-by: Onuralp SEZER <onuralp@ultralytics.com>
Signed-off-by: Onuralp SEZER <onuralp@ultralytics.com>
…tics recognizer callable Signed-off-by: Onuralp SEZER <onuralp@ultralytics.com>
|
👋 Hello @onuralpszr, thank you for submitting a
For more guidance, please refer to our Contributing Guide. Don't hesitate to leave a comment if you have any questions. Thank you for contributing to Ultralytics! 🚀 |
UltralyticsAssistant
left a comment
There was a problem hiding this comment.
🔍 PR Review
Made with ❤️ by Ultralytics Actions
Reviewed the OCR CLI, companion-session device selection, annotation, and segmentation-mask changes. Found one device-selection mismatch for native OpenVINO; the remaining reviewed paths showed no other concrete issue.
💬 Posted 1 inline comment
- 💡 MEDIUM
src/model.rs:1485Withopenvino-nativeand an Intel GPU, the detector's provider is"OpenVINO", so it misses the"OpenVINOExecutionProvider"arm and both companion OCR sessions fall through to CPU. This contradicts the documented claim that recognition runs on the detector's device and can significantly slow OCR on video or many detections. Handle the native OpenVINO backend for companion models, or make the CPU fallback explicit in the API/docs.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Signed-off-by: Onuralp SEZER <onuralp@ultralytics.com>
Signed-off-by: Onuralp SEZER <onuralp@ultralytics.com>
…rs too Signed-off-by: Onuralp SEZER <onuralp@ultralytics.com>
UltralyticsAssistant
left a comment
There was a problem hiding this comment.
🔍 PR Review 2
Made with ❤️ by Ultralytics Actions
Since review 1, the native OpenVINO CPU fallback is now documented, resolving the earlier finding. The OCR changes otherwise look sound; the segmentation path still has a regression that drops detections whose masks are empty.
💬 Posted 1 inline comment
- 💡 MEDIUM
src/postprocessing.rs:1034If a post-NMS detection has no positive mask logits inside its nondegenerate box,applyreturnsNoneand this filter drops the detection; the laterselect_rowsthen removes its box, class, and confidence too. This makes segmentation results lose valid detections based solely on an empty mask. Keep the detection and emit its corresponding all-zero mask instead.
Signed-off-by: Onuralp SEZER <onuralp@ultralytics.com>
ultralytics-inference 0.0.58 Add scene text OCR with YOLO26-Text and PaddleOCR
Signed-off-by: Onuralp SEZER <onuralp@ultralytics.com>
…Rect like Ultralytics Signed-off-by: Onuralp SEZER <onuralp@ultralytics.com>
Signed-off-by: Onuralp SEZER <onuralp@ultralytics.com>
Signed-off-by: Onuralp SEZER <onuralp@ultralytics.com>
UltralyticsAssistant
left a comment
There was a problem hiding this comment.
🔍 PR Review 3
Made with ❤️ by Ultralytics Actions
Since review 2, the native OpenVINO CPU fallback is documented, addressing review 1; the empty-mask behavior was explained as intentional and is not repeated. I reviewed the current OCR API, companion-model loading, CLI integration, downloads, annotation, and documentation, and found no new actionable defects. LGTM.
Signed-off-by: Onuralp SEZER <onuralp@ultralytics.com>
Signed-off-by: Onuralp SEZER <onuralp@ultralytics.com>
UltralyticsAssistant
left a comment
There was a problem hiding this comment.
🔍 PR Review 4
Made with ❤️ by Ultralytics Actions
Since review 3, the earlier OpenVINO fallback remains documented and the empty-mask behavior remains settled. This pass found one new device-selection issue: TensorRT-only builds fall back to CPU for OCR companion sessions.
💬 Posted 1 inline comment
- 💡 MEDIUM
src/model.rs:1470With a build that enablestensorrtbut notcuda—these are independent features inCargo.toml—--device tensorrt:0 --ocrselectsTensorRTExecutionProviderfor the detector, but this arm is compiled out. The companion sessions then register no accelerator and run on CPU, contrary to the CUDA docs and potentially slowing video or images with many detections. Make the required CUDA provider available for TensorRT companion sessions, or explicitly require and document both features.
📋 Skipped 2 files (lock files, generated, images, etc.)
Cargo.lockweb/package-lock.json
…rRT builds Signed-off-by: Onuralp SEZER <onuralp@ultralytics.com>
UltralyticsAssistant
left a comment
There was a problem hiding this comment.
🔍 PR Review 5
Made with ❤️ by Ultralytics Actions
Since review 4, making tensorrt imply cuda addresses the companion-session device-selection finding. This pass found one remaining OCR rendering mismatch: confidence-only mode is ignored. The other reviewed OCR and CLI paths showed no additional actionable issues.
💬 Posted 1 inline comment
- 📝 LOW
src/annotate.rs:825When--show-labels=false --show-conf=true, OCR renders no label because this arm discards confidence too. The existing detection annotator shows confidence alone for the same option combination, and the PR says--show-confapplies to OCR. Render the confidence when labels are hidden, matchingdraw_detection.
📋 Skipped 2 files (lock files, generated, images, etc.)
Cargo.lockweb/package-lock.json
UltralyticsAssistant
left a comment
There was a problem hiding this comment.
🔍 PR Review 6
Made with ❤️ by Ultralytics Actions
Since review 5, the TensorRT feature change addresses the prior device-selection issue, but the OCR confidence-only rendering finding remains open. This pass found no additional actionable issues.
💬 Posted 1 inline comment
- 📝 LOW
src/annotate.rs:825Since review 5 this confidence-only case remains unchanged: withshow_labels=falseandshow_conf=true, OCR draws no label because this arm discards confidence too. The detection annotator renders confidence for the same option combination. Render the confidence here when labels are hidden so--show-confworks as documented.
📋 Skipped 2 files (lock files, generated, images, etc.)
Cargo.lockweb/package-lock.json
UltralyticsAssistant
left a comment
There was a problem hiding this comment.
🔍 PR Review 7
Made with ❤️ by Ultralytics Actions
Since review 6, the TensorRT companion-device issue is addressed, and the confidence-only rendering behavior is settled as intentional. This pass found a new OCR crop-width rounding panic; otherwise, no additional actionable issues.
💬 Posted 1 inline comment
- 💡 MEDIUM
src/ocr.rs:279For crops wider than the minimum recognizer ratio,paddedtruncates whileresizedrounds up. For example, a 101×15 crop produces widths(324, 323), sotensorallocates only 323 columns and then slices 324, panicking during OCR on common non-integral aspect ratios. Roundpaddedup as well so it is never smaller thanresized.
📋 Skipped 2 files (lock files, generated, images, etc.)
Cargo.lockweb/package-lock.json
UltralyticsAssistant
left a comment
There was a problem hiding this comment.
🔍 PR Review 8
Made with ❤️ by Ultralytics Actions
Since review 7, the crop-width concern is settled by the existing cap and the author’s explanation; the earlier TensorRT device-selection issue is addressed, and the OCR label behavior is settled as intentional. I found no remaining open findings or new actionable defects in the OCR, CLI, model-loading, annotation, download, or documentation changes. LGTM.
📋 Skipped 2 files (lock files, generated, images, etc.)
Cargo.lockweb/package-lock.json
UltralyticsAssistant
left a comment
There was a problem hiding this comment.
🔍 PR Review 8
Made with ❤️ by Ultralytics Actions
Since review 7, the TensorRT feature change is addressed, the confidence-only rendering behavior is settled as intentional, and the crop-width concern was answered by the resize cap. I reviewed the OCR, CLI, model loading, downloads, and annotation changes; the new finding is avoidable per-session thread-pool overhead when OCR uses default thread settings.
💬 Posted 1 inline comment
- 💡 MEDIUM
src/model.rs:1492With the defaultnum_threads=0,intra_threadsresolves to every available core.TextRecognizer::newcreates two companion sessions in addition to the detector, so CPU OCR (especially long-running video) can leave three independent per-session thread pools, with idle workers consuming CPU and resources. Use a shared pool or cap the companion sessions separately. (onnxruntime.ai)
📋 Skipped 2 files (lock files, generated, images, etc.)
Cargo.lockweb/package-lock.json
UltralyticsAssistant
left a comment
There was a problem hiding this comment.
🔍 PR Review 10
Made with ❤️ by Ultralytics Actions
Since review 9, the per-session thread-pool concern is settled by the author’s measurements; no earlier finding remains open. I rechecked the OCR processing, companion-model loading, CLI integration, annotation, and downloads. No new actionable regressions found. LGTM.
📋 Skipped 2 files (lock files, generated, images, etc.)
Cargo.lockweb/package-lock.json
|
🎉 PR #631 has been merged—thank you, @onuralpszr, for adding native scene-text OCR to the Rust API and
A fitting thought for bringing text detection and recognition together in one OCR workflow. |
TextRecognizerandpredict --ocrto read text with YOLO26-Text and PaddleOCR, like Pythonsolutions.OCR--line-width,--show-labelsand--show-conf🛠️ PR Summary
Made with ❤️ by Ultralytics Actions
🌟 Summary
Version 0.0.58 adds native scene-text OCR using YOLO26-Text for text detection and PaddleOCR for recognition, exposed through both a Rust API and
predict --ocr.📊 Key Changes
TextRecognizerto read detections from boxes, oriented boxes, or segmentation masks; custom recognition functions are also supported. Results include recognized text, confidence, detection confidence, and polygon, and are returned in reading order.--ocr, which defaults toyolo26n-text.onnxwhen no model is specified; the YOLO26-Text and PaddleOCR model names are included in model auto-download handling.--line-width,--show-labels, and--show-confapplied.tensorrtfeature includecuda; bumped the Rust crate, web crate, and npm package versions to 0.0.58.🎯 Purpose & Impact
📋 Skipped 2 files (lock files, generated, images, etc.)
Cargo.lockweb/package-lock.json