For the complete documentation index, see llms.txt. This page is also available as Markdown.

RF-DETR

Serverless Hosted API를 통해 Roboflow의 RF-DETR model을 사용합니다.

RF-DETR 객체 감지

RF-DETR은 Roboflow의 transformer 기반 실시간 감지 모델입니다. COCO 사전 학습된 객체 감지 체크포인트에 대해 다음을 통해 inference를 실행하세요: Serverless Hosted API, 또는 다음을 사용해 자체 호스팅 Roboflow Inference.

코드 샘플

아래 단계에서는 RF-DETR을 다음을 통해 실행합니다 Serverless Hosted API 그리고 다음을 사용해 결과를 시각화합니다 supervision.

1

API Key를 받으세요

Roboflow 계정을 만들고, 다음에서 키를 찾으세요: Roboflow API 설정 페이지 그리고 이를 셸에서 사용할 수 있도록 설정하세요:

export ROBOFLOW_API_KEY="your-key-here"
2

종속성을 설치하세요

이 두 패키지는 모델을 호출하고 결과를 그립니다:

pip install inference-sdk supervision
3

모델을 실행하세요

실행 rfdetr-small 샘플 이미지에 대해 실행하고 박스와 레이블을 주석 처리합니다:

import os
import cv2
import numpy as np
import requests
import supervision as sv
from inference_sdk import InferenceHTTPClient

image_url = "https://media.roboflow.com/quickstart/traffic.jpg"
content = requests.get(image_url).content
image = cv2.imdecode(np.frombuffer(content, np.uint8), cv2.IMREAD_COLOR)

client = InferenceHTTPClient(
    api_url="https://serverless.roboflow.com",
    api_key=os.environ["ROBOFLOW_API_KEY"],
)
result = client.infer(image, model_id="rfdetr-small")

detections = sv.Detections.from_inference(result)

annotated = sv.BoxAnnotator().annotate(image.copy(), detections)
annotated = sv.LabelAnnotator().annotate(annotated, detections)

cv2.imwrite("traffic-annotated.png", annotated)

설정 api_url 을 배포 대상에 맞게 설정하세요:

  • https://serverless.roboflow.com Serverless Hosted API용입니다.

  • http://localhost:9001 로컬 Inference 서버용입니다.

  • 귀하의 Dedicated Deployment 비공개 엔드포인트용 URL입니다.

사전 학습된 모델 및 벤치마크

이 별칭들 중 아무거나 다음으로 전달하세요: model_id inference를 실행할 때. SDK는 각 alias를 기반이 되는 Roboflow 프로젝트 버전으로 해석합니다.

별칭
입력 크기
mAP50-95
ONNX 지연 시간(ms)*
TensorRT FP16(ms)*

rfdetr-nano

384x384

48.4

9.7

6.2

rfdetr-small

512x512

53.0

12.9

8.3

rfdetr-medium

576x576

54.7

16.3

9.5

rfdetr-large

704x704

56.5

25.6

11.6

rfdetr-xlarge

700x700

58.6

41.6

14.9

rfdetr-2xlarge

880x880

60.1

53.4

21.7

RF-DETR 인스턴스 세그멘테이션

RF-DETR은 박스와 함께 마스크를 예측하는 instance segmentation 체크포인트도 제공합니다. 다음을 통해 실행하세요 Serverless Hosted API, 또는 다음을 사용해 자체 호스팅 Roboflow Inference.

코드 샘플

위에 나온 대로 API 키를 설정하고 dependencies를 설치한 다음, segmentation 체크포인트를 실행하고 마스크를 그리세요:

사전 학습된 모델 및 벤치마크

이 별칭들 중 아무거나 다음으로 전달하세요: model_id inference를 실행할 때. SDK는 각 alias를 기반이 되는 Roboflow 프로젝트 버전으로 해석합니다. 수치는 COCO에서의 mask mAP입니다 검증.

별칭
입력 크기
Mask mAP50-95
ONNX 지연 시간(ms)*
TensorRT FP16(ms)*

rfdetr-seg-nano

312x312

40.3

15.8

10.5

rfdetr-seg-small

384x384

43.1

19.3

11.9

rfdetr-seg-medium

432x432

45.3

23.9

14.1

rfdetr-seg-large

504x504

47.1

30.1

15.4

rfdetr-seg-xlarge

624x624

48.8

51.2

19.1

rfdetr-seg-2xlarge

768x768

49.9

89.6

25.6


* 지연 시간은 다음으로 측정됩니다: Roboflow Inference 1x NVIDIA L4에서, batch size 1, 1,000회 inference의 평균(100회 워밍업). 기본 inference-gpu install은 ONNX를 CUDA execution provider에서 실행합니다. 다음을 추가하면 inference-models[trt10] extra가 사전 빌드된 TensorRT FP16 engine을 자동으로 선택합니다. FP16은 COCO에서 FP32 정확도와 0.2 mAP 이내로 일치합니다 val2017. 정확도는 공개된 COCO 검증 spec입니다(다음을 참조하세요: RF-DETR 발표).

마지막 업데이트

도움이 되었나요?