Run a Model on an Image
Run inference on an image with the Python SDK, across all task types.
Object detection
import roboflow
rf = roboflow.Roboflow(api_key="YOUR_API_KEY")
project = rf.workspace().project("my-detector")
version = project.version(3)
model = version.model
predictions = model.predict(
"photo.jpg",
confidence=40, # 0–100
overlap=30, # 0–100, NMS IoU threshold
).json()
for p in predictions["predictions"]:
print(p["class"], p["confidence"], p["x"], p["y"], p["width"], p["height"])Classification
Instance segmentation
Semantic segmentation
Keypoint detection
Vision-language (VLM)
Hosted images
Where inference runs
REST and CLI equivalents
Last updated
Was this helpful?