-
Notifications
You must be signed in to change notification settings - Fork 501
Description
Search before asking
- I have searched the RF-DETR issues and found no similar bug report.
Bug
I fine-tune rf-detr seg preview for my project, and I found out that when I deployed the model and do the inference without this line "model.optimize_for_inference()", everything works fine like below
detections = model.predict(image, threshold=0.3)
print(detections)
Detections(xyxy=array([[888.2473 , 746.7094 , 932.44073, 768.10944]], dtype=float32), mask=array([[[False, False, False, ..., False, False, False],
[False, False, False, ..., False, False, False],
[False, False, False, ..., False, False, False],
...,
[False, False, False, ..., False, False, False],
[False, False, False, ..., False, False, False],
[False, False, False, ..., False, False, False]]],
shape=(1, 1024, 1280)), confidence=array([0.75640106], dtype=float32), class_id=array([1]), tracker_id=None, data={}, metadata={})
but when I implement this line of code "model.optimize_for_inference()", the model stops generating mask.
Detections(xyxy=array([[888.24963, 746.70496, 932.4463 , 768.10974]], dtype=float32), mask=None, confidence=array([0.75613964], dtype=float32), class_id=array([1]), tracker_id=None, data={}, metadata={})
For people who want to train segmentation, please do not use this line of code as they use in their repo predict example.
Environment
RF-DETR 1.3
Minimal Reproducible Example
custom_weights_path = "/root/runs/rfdetr_seg/checkpoint_best_regular.pth"
try:
model = RFDETRSegPreview(pretrain_weights=custom_weights_path)
except Exception as e:
model = RFDETRSegPreview()
detections = model.predict(image, threshold=0.3)
print(detections)
Additional
No response
Are you willing to submit a PR?
- Yes, I'd like to help by submitting a PR!