Roboflow 3.0

Use the Roboflow 3.0 model family through our Serverless Hosted API

Roboflow 3.0 is Roboflow's in-house model architecture. It supports object detection, instance segmentation, classification, and keypoint detection. You train Roboflow 3.0 models on the Roboflow platform and deploy them through our Serverless Hosted API.

For self-hosted deployment, see Roboflow Inference.

Roboflow 3.0 has no public default COCO aliases. You call your own trained model using its project/version identifier from your Roboflow Project.

Code samples

Install the Inference SDK and supervision:

pip install inference-sdk supervision

The samples below run inference against a Roboflow 3.0 model you have trained. Replace your-project/1 with your model URL and version. Pass your Roboflow API Key via the API_KEY environment variable.

Object detection

import os
import cv2
import urllib.request
import supervision as sv
from inference_sdk import InferenceHTTPClient

image_url = "https://storage.googleapis.com/com-roboflow-marketing/notebooks/examples/cars-highway.png"
image_path = "cars-highway.png"
urllib.request.urlretrieve(image_url, image_path)

image = cv2.imread(image_path)

client = InferenceHTTPClient(
    api_url="https://serverless.roboflow.com",
    api_key=os.getenv("API_KEY"),
)
result = client.infer(image, model_id="your-project/1")

detections = sv.Detections.from_inference(result)
labels = [
    f"{class_name} {confidence:.2f}"
    for class_name, confidence
    in zip(detections.data.get("class_name", []), detections.confidence)
]

annotated = sv.BoxAnnotator().annotate(scene=image.copy(), detections=detections)
annotated = sv.LabelAnnotator().annotate(scene=annotated, detections=detections, labels=labels)
cv2.imwrite("output.png", annotated)

Instance segmentation

Keypoint detection

Classification

Classification responses contain a list of class predictions with confidences, so visualization is not applicable. Read the top class directly from the response.

Set api_url to match your deployment target:

  • https://serverless.roboflow.com for the Serverless Hosted API.

  • http://localhost:9001 for a local Inference server.

  • Your Dedicated Deployment URL for a private endpoint.

Last updated

Was this helpful?