rf-detr icon indicating copy to clipboard operation
rf-detr copied to clipboard

Create prediction_visualizer.py

Open catsmells opened this issue 2 months ago • 2 comments
trafficstars

Description

Added visualize_predictions.py to the RF-DETR repository (https://github.com/roboflow/rf-detr/tree/develop/rfdetr) to enable visualization of model predictions on sample images, improving user onboarding and debugging. The script loads a pre-trained RF-DETR model, runs inference on images in a specified directory, and saves annotated outputs with bounding boxes and labels using supervision. Motivation: enhance usability for developers testing RF-DETR performance. Dependencies: numpy, opencv-python, supervision, pillow, rfdetr.

Type of change

  • [x] New feature (non-breaking change which adds functionality)
  • [x] This change requires a documentation update

How has this change been tested, please provide a testcase or example of how you tested the change?

Tested by running python visualize_predictions.py --weights path/to/weights.pth --input-dir sample_images --output-dir output --confidence 0.5 with a COCO sample dataset. Verified annotated images in the output directory displayed correct bounding boxes and labels for detected objects.

Any specific deployment considerations

Requires pre-trained RF-DETR model weights and a directory with supported image formats (.jpg, .jpeg, .png). No additional costs or secrets required.

Docs

  • [x] Docs updated? What were the changes: Added section for visualize_predictions.py, detailing usage, command-line arguments (--weights, --input-dir, --output-dir, --confidence), and example command: python visualize_predictions.py --weights weights.pth --input-dir images/ --output-dir output/.

I have read the CLA Document and I sign the CLA.

catsmells avatar Sep 07 '25 17:09 catsmells

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Sep 07 '25 17:09 CLAassistant

I have read the CLA Document and I sign the CLA.

catsmells avatar Sep 07 '25 19:09 catsmells