
Pointing example showing object keypoints.
Object Localization

Person Localization

Face Localization

Examples of keypoint detection for objects, people or faces.
Usage Example
Use the Structured Outputs API for structured, validated responses.
from vlmrun.client import VLMRun
# Initialize the VLMRun client
client = VLMRun(api_key="<VLMRUN_API_KEY>")
# Predict the keypoints in the image
response = client.agent.completions.create(
model="vlmrun-orion-1:auto",
messages=[
{
"role": "user",
"content": [
{"type": "text", "text": "Point to all the cars and doors in this image"},
{"type": "image_url", "image_url": {"url": "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.caption/car.jpg", "detail": "auto"}}
]
}
],
)
print(response.choices[0].message.content)
from vlmrun.client import VLMRun
from pydantic import BaseModel, Field
# Define the response schema
class KeyPoint(BaseModel):
xy: tuple[float, float] = Field(..., description="Normalized keypoint coordinates [x, y]")
label: str = Field(..., description="Label of the keypoint")
class Keypoints(BaseModel):
keypoints: list[KeyPoint] = Field(..., description="List of keypoints")
# Initialize the VLMRun client
client = VLMRun(api_key="<VLMRUN_API_KEY>")
# Predict the keypoints with structured output
response = client.agent.completions.create(
model="vlmrun-orion-1:auto",
messages=[
{
"role": "user",
"content": [
{"type": "text", "text": "Point to all the cars and doors in this image"},
{"type": "image_url", "image_url": {"url": "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.caption/car.jpg", "detail": "auto"}}
]
}
],
response_format={"type": "json_schema", "schema": Keypoints.model_json_schema()},
)
# Validate the response
result = Keypoints.model_validate_json(response.choices[0].message.content)
# >>> Keypoints(keypoints=[KeyPoint(xy=(0.5, 0.5), label='car'), ...])
import { VlmRun } from "vlmrun";
const client = new VlmRun({
apiKey: "<VLMRUN_API_KEY>",
baseURL: "https://api.vlm.run/v1"
});
const response = await client.agent.completions.create({
model: "vlmrun-orion-1:auto",
messages: [
{
role: "user",
content: [
{ type: "text", text: "Point to all the cars and doors in this image" },
{ type: "image_url", image_url: { url: "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.caption/car.jpg", detail: "auto" } }
]
}
]
});
console.log(response.choices[0].message.content);
import { VlmRun } from "vlmrun";
import { z } from "zod";
import { zodToJsonSchema } from "zod-to-json-schema";
// Define the response schema with Zod
const KeypointsSchema = z.object({
keypoints: z.array(z.object({
xy: z.array(z.number()).describe("Normalized keypoint coordinates [x, y]"),
label: z.string().describe("Label of the keypoint")
})).describe("List of keypoints")
});
// Initialize the VLMRun client
const client = new VlmRun({
apiKey: "<VLMRUN_API_KEY>",
baseURL: "https://api.vlm.run/v1"
});
// Predict the keypoints with structured output
const response = await client.agent.completions.create({
model: "vlmrun-orion-1:auto",
messages: [
{
role: "user",
content: [
{ type: "text", text: "Point to all the cars and doors in this image" },
{ type: "image_url", image_url: { url: "https://storage.googleapis.com/vlm-data-public-prod/hub/examples/image.caption/car.jpg", detail: "auto" } }
]
}
],
response_format: {
type: "json_schema",
schema: zodToJsonSchema(KeypointsSchema)
}
});
const result = KeypointsSchema.parse(JSON.parse(response.choices[0].message.content));
FAQ
What format do the keypoints come in?
What format do the keypoints come in?
Keypoints are a list of objects.Each keypoint is normalized
xy.x and y are the top-left corner of the keypoint.Values are between 0 and 1.x is normalized by the image width.y is normalized by the image height.What other tags can you extract for each keypoint?
What other tags can you extract for each keypoint?
- Object name: Name of the object the keypoint belongs to. Examples: car, door, person, face.
- Confidence score: Confidence of the keypoint detection.