Skip to content

Conversation

@dangusev
Copy link
Contributor

@dangusev dangusev commented Dec 10, 2025

Users can now tweak annonation params like text size and box thickness

Summary by CodeRabbit

  • New Features
    • Configurable annotation styling for detection visuals: text scale, text padding, box thickness, and label position (sensible defaults applied).
    • Optional support for using a custom local detection model, allowing a provided RFDETR instance for local processing.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 10, 2025

Walkthrough

The 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 annotate_image utility, and lets the local processor accept an optional model parameter.

Changes

Cohort / File(s) Summary
Detection Processors (Annotation Configuration)
plugins/roboflow/vision_agents/plugins/roboflow/roboflow_cloud_processor.py, plugins/roboflow/vision_agents/plugins/roboflow/roboflow_local_processor.py
Added constructor parameters annotate_text_scale: float, annotate_text_padding: int, annotate_box_thickness: int, annotate_text_position: sv.Position; persisted as private attributes and forwarded to annotate_image. roboflow_local_processor.py also accepts optional model: Optional[RFDETR].
Annotation Utility Function
plugins/roboflow/vision_agents/plugins/roboflow/utils.py
Extended annotate_image signature with text_scale, text_padding, box_thickness, text_position (defaults set). Rewired BoxAnnotator and LabelAnnotator to use these parameters instead of hard-coded values.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Verify constructor parameter ordering and defaults in both processors.
  • Confirm all new private attributes are used where intended and have correct types.
  • Check annotate_image defaults and that annotator calls use the passed-through values.
  • Ensure no callers rely on previous hard-coded annotation behavior.

Possibly related PRs

Suggested reviewers

  • Nash0x7E2

Poem

I stitch the frame with a small, precise despair,
Letters pressed like bruises at the crown,
A thinness turned thick around each named object,
The top-centred words bloom, reluctant and exact,
The image opens and lets its secrets fall.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: exposing annotation parameters for Roboflow processors, which aligns perfectly with the changeset modifications.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/roboflow-processor-annotation-params

📜 Recent 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.

📥 Commits

Reviewing files that changed from the base of the PR and between 69a15b7 and fb1f5fe.

📒 Files selected for processing (2)
  • plugins/roboflow/vision_agents/plugins/roboflow/roboflow_cloud_processor.py (4 hunks)
  • plugins/roboflow/vision_agents/plugins/roboflow/roboflow_local_processor.py (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • plugins/roboflow/vision_agents/plugins/roboflow/roboflow_local_processor.py
  • plugins/roboflow/vision_agents/plugins/roboflow/roboflow_cloud_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

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a 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 broad except Exception per 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 broad except Exception per coding guidelines.

Same concern as the local processor—this catches all exceptions. Consider catching the specific exceptions that infer_async and 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.

📥 Commits

Reviewing files that changed from the base of the PR and between 210b64d and e73a2e5.

📒 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 write except 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.py
  • plugins/roboflow/vision_agents/plugins/roboflow/utils.py
  • plugins/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 BoxAnnotator and LabelAnnotator.

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

Copy link
Contributor

@d3xvn d3xvn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dangusev dangusev merged commit 8b6f724 into main Dec 10, 2025
8 checks passed
@dangusev dangusev deleted the feat/roboflow-processor-annotation-params branch December 10, 2025 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants