Create prediction_visualizer.py #345
Open
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.
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 usingsupervision
. Motivation: enhance usability for developers testing RF-DETR performance. Dependencies:numpy
,opencv-python
,supervision
,pillow
,rfdetr
.Type of change
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
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.