Closed
Conversation
darthegg
commented
Mar 18, 2026
| #!/usr/bin/env python3 | ||
| """ | ||
| NavOCR with OCR Text Recognition (PaddleDetection + PaddleOCR) | ||
| Migrated from ultralytics YOLO to PaddleDetection (PPYOLOe) |
Collaborator
Author
There was a problem hiding this comment.
Description does not need specific update log.
| self.declare_parameter('confidence_threshold', 0.5) | ||
| self.declare_parameter('output_dir', os.path.join(navocr_path, 'results/ros_result_ocr')) | ||
| self.declare_parameter('ocr_language', 'en') | ||
| self.declare_parameter('image_publish_rate', 2.0) |
| self.declare_parameter('output_dir', os.path.join(navocr_path, 'results/ros_result_ocr')) | ||
| self.declare_parameter('ocr_language', 'en') | ||
| self.declare_parameter('image_publish_rate', 2.0) | ||
| self.declare_parameter('save_image', False) |
Collaborator
Author
There was a problem hiding this comment.
Flag for save image and benchmark.
Save images as default is too expensive.
| self.get_logger().info(f'Session name: {self.session_name}') | ||
|
|
||
| # Rate limiting for image publishing | ||
| self.last_image_publish_time = self.get_clock().now() |
|
|
||
| has_korean = any('\uac00' <= char <= '\ud7a3' for char in label) | ||
|
|
||
| if has_korean: |
Collaborator
Author
There was a problem hiding this comment.
Not sure if we should add Korean support or not.
Korean support is always welcome, but our following stacks(e.g., TextMap) do not support Korean.
| filename = os.path.join(self.output_dir, f"frame_{self.frame_id:06d}.png") | ||
| cv2.imwrite(filename, annotated_image) | ||
| # Save image periodically if save_image mode is on | ||
| if self.save_image: |
Collaborator
Author
There was a problem hiding this comment.
Flag for expensive operation.
| def _draw_opencv_text(self, image, x1, y1, label_text): | ||
| """Helper function to draw text with OpenCV""" | ||
| font = cv2.FONT_HERSHEY_SIMPLEX | ||
| font_scale = 0.6 |
Collaborator
Author
There was a problem hiding this comment.
Please avoid hard-coding constant.
Use config file is the best, but if it is too much, then at least declare it as a class member_variable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.