Skip to content

Fail to run inference example with the rfdetr-seg-preview model #457

@erikatbeof

Description

@erikatbeof

Search before asking

  • I have searched the RF-DETR issues and found no similar bug report.

Bug

Hi! Thanks for providing rfdetr!

I tried to run the inference example from the README.md. With the rfdetr-base model it goes alright. But switching to the rfdetr-seg-preview model I get the error:

inference.core.exceptions.RoboflowAPIForbiddenError: Unauthorized access to roboflow API - check API key regarding correctness and required scopes. Visit https://docs.roboflow.com/api-reference/authentication#retrieve-an-api-key to learn how to retrieve one.

Is this expected? It would be nice to be able to use the rfdetr-seg-preview model without any API key.

I also get a whole bunch of warnings:

ModelDependencyMissing: Your inference configuration does not support SAM model. Use pip install 'inference[sam]' to install missing requirements.To suppress this warning, set CORE_MODEL_SAM_ENABLED to False.
ModelDependencyMissing: Your inference configuration does not support SAM2 model. Use pip install 'inference[sam]' to install missing requirements.To suppress this warning, set CORE_MODEL_SAM2_ENABLED to False.
ModelDependencyMissing: Your inference configuration does not support Gaze Detection model. Use pip install 'inference[gaze]' to install missing requirements.To suppress this warning, set CORE_MODEL_GAZE_ENABLED to False.
ModelDependencyMissing: Your inference configuration does not support GroundingDINO model. Use pip install 'inference[grounding-dino]' to install missing requirements.To suppress this warning, set CORE_MODEL_GROUNDINGDINO_ENABLED to False.
ModelDependencyMissing: Your inference configuration does not support YoloWorld model. Use pip install 'inference[yolo-world]' to install missing requirements.To suppress this warning, set CORE_MODEL_YOLO_WORLD_ENABLED to False.

I did 'pip install inference'. Is there another way to install the inference module?

Erik

Environment

pip install rfdetr inference

Minimal Reproducible Example

import os
import supervision as sv
from inference import get_model
from PIL import Image
from io import BytesIO
import requests

# https://github.com/roboflow/rf-detr

url = "https://media.roboflow.com/dog.jpeg"
image = Image.open(BytesIO(requests.get(url).content))

# model = get_model("rfdetr-base")
model = get_model("rfdetr-seg-preview")

predictions = model.infer(image, confidence=0.5)[0]

detections = sv.Detections.from_inference(predictions)

labels = [prediction.class_name for prediction in predictions.predictions]

annotated_image = image.copy()
annotated_image = sv.BoxAnnotator(color=sv.ColorPalette.ROBOFLOW).annotate(
    annotated_image, detections
)
annotated_image = sv.LabelAnnotator(color=sv.ColorPalette.ROBOFLOW).annotate(
    annotated_image, detections, labels
)

sv.plot_image(annotated_image)

Additional

No response

Are you willing to submit a PR?

  • Yes, I'd like to help by submitting a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions