Repository navigation
Inference for RF-DETRSeg Model #1388
|
Hi, I have trained a custom model using RF-DETRSeg locally and everytime I try to use SAHI, it keeps asking for roboflow api key! Am I missing something here or there is a trick to force looking at local model without api key? Kr, |
Replies: 1 comment
|
Hi Mehrdad, thanks a lot for reporting this and sorry for the runaround! 🙏 You weren't missing anything, and there was no trick you overlooked. Our docs were wrong, and you walked straight into the trap they set. What was happeningThe Roboflow wrapper decided between the hosted API and a local model based purely on the type of the Worse, the local example in our docs was not merely incomplete — it could never have worked. It showed Working today (any version)Pass the RF-DETR class (or an instance), not a string: from rfdetr.detr import RFDETRSegMedium # whichever variant you trained
from sahi import AutoDetectionModel
detection_model = AutoDetectionModel.from_pretrained(
model_type="roboflow",
model=RFDETRSegMedium, # the class, not a string
model_path="/path/to/your/checkpoint.pth", # your local weights
category_mapping={"0": "cls_a", "1": "cls_b"},
image_size=640, # must match training resolution
confidence_threshold=0.3,
device="cuda:0",
)This path never contacts the API. Two gotchas that matter for a custom-trained model:
Fixed on
|
Hi Mehrdad, thanks a lot for reporting this and sorry for the runaround! 🙏
You weren't missing anything, and there was no trick you overlooked. Our docs were wrong, and you walked straight into the trap they set.
What was happening
The Roboflow wrapper decided between the hosted API and a local model based purely on the type of the
modelargument: anystrwas treated as a Roboflow Universe model id, which is exactly why it kept asking for an API key. Local models were only reachable by passing the RF-DETR class itself.Worse, the local example in our docs was not merely incomplete — it could never have worked. It showed
model_path="rfdetr-base"with nomodel=at all, which just raisesVal…