-
Notifications
You must be signed in to change notification settings - Fork 244
Expose more annotation params for Roboflow processors #251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThe PR adds configurable annotation styling (text scale, text padding, box thickness, text position) to Roboflow cloud and local detection processors, propagates these settings to the shared Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (3)
plugins/roboflow/vision_agents/plugins/roboflow/utils.py (1)
18-20: Docstring lacks Args section for new parameters.The docstring doesn't document the newly added parameters (
text_scale,text_padding,box_thickness,text_position). As per coding guidelines, docstrings should follow Google style guide, which requires documenting function arguments.""" Draw bounding boxes and labels on frame. + + Args: + image: The input image as a numpy array. + detections: Supervision Detections object containing detection results. + classes: Mapping of class IDs to class names. + dim_factor: Factor to dim the background (0-1.0). None for no dimming. + text_scale: Scale of the annotation text. Default 0.75. + text_padding: Padding around annotation text. Default 1. + box_thickness: Thickness of bounding box lines. Default 2. + text_position: Position of text labels relative to boxes. + + Returns: + Annotated image as a numpy array. """plugins/roboflow/vision_agents/plugins/roboflow/roboflow_local_processor.py (1)
264-265: Avoid broadexcept Exceptionper coding guidelines.This catches all exceptions indiscriminately. Consider catching specific exceptions that can occur during inference (e.g.,
RuntimeError, or exceptions from the model library).Based on coding guidelines: "Never write
except Exception as e- use specific exception handling."plugins/roboflow/vision_agents/plugins/roboflow/roboflow_cloud_processor.py (1)
238-239: Avoid broadexcept Exceptionper coding guidelines.Same concern as the local processor—this catches all exceptions. Consider catching the specific exceptions that
infer_asyncand related operations can raise.Based on coding guidelines: "Never write
except Exception as e- use specific exception handling."
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (3)
plugins/roboflow/vision_agents/plugins/roboflow/roboflow_cloud_processor.py(4 hunks)plugins/roboflow/vision_agents/plugins/roboflow/roboflow_local_processor.py(4 hunks)plugins/roboflow/vision_agents/plugins/roboflow/utils.py(2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.py
📄 CodeRabbit inference engine (.cursor/rules/python.mdc)
**/*.py: Never adjust sys.path in Python code
Never writeexcept Exception as e- use specific exception handling
Avoid using getattr, hasattr, delattr and setattr; prefer normal attribute access in Python
Docstrings should follow the Google style guide for docstrings
Files:
plugins/roboflow/vision_agents/plugins/roboflow/roboflow_cloud_processor.pyplugins/roboflow/vision_agents/plugins/roboflow/utils.pyplugins/roboflow/vision_agents/plugins/roboflow/roboflow_local_processor.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: unit / Test "not integration"
- GitHub Check: unit / Mypy
- GitHub Check: unit / Test "not integration"
- GitHub Check: unit / Mypy
🔇 Additional comments (3)
plugins/roboflow/vision_agents/plugins/roboflow/utils.py (1)
13-16: LGTM!The new annotation parameters are cleanly integrated. Default values preserve backward compatibility and the parameters flow correctly to
BoxAnnotatorandLabelAnnotator.Also applies to: 30-41
plugins/roboflow/vision_agents/plugins/roboflow/roboflow_local_processor.py (1)
113-113: LGTM!The new annotation parameters are properly declared, stored as internal state, and passed through to
annotate_image. The implementation mirrors the cloud processor, maintaining consistency.Also applies to: 116-119, 164-167, 282-285
plugins/roboflow/vision_agents/plugins/roboflow/roboflow_cloud_processor.py (1)
113-118: LGTM!The new annotation styling parameters are cleanly integrated into the constructor, stored appropriately, and correctly passed to
annotate_image. Good consistency with the local processor implementation.Also applies to: 150-153, 251-259
plugins/roboflow/vision_agents/plugins/roboflow/roboflow_cloud_processor.py
Outdated
Show resolved
Hide resolved
plugins/roboflow/vision_agents/plugins/roboflow/roboflow_local_processor.py
Outdated
Show resolved
Hide resolved
plugins/roboflow/vision_agents/plugins/roboflow/roboflow_local_processor.py
Outdated
Show resolved
Hide resolved
plugins/roboflow/vision_agents/plugins/roboflow/roboflow_cloud_processor.py
Outdated
Show resolved
Hide resolved
…_processor.py Co-authored-by: Deven Joshi <[email protected]>
…_processor.py Co-authored-by: Deven Joshi <[email protected]>
d3xvn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Users can now tweak annonation params like text size and box thickness
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.