Skip to content
Meta logo

detr-resnet-50 Beta

Object DetectionMetaHosted

DEtection TRansformer (DETR) model trained end-to-end on COCO 2017 object detection (118k annotated images).

Model Info
BetaYes
Unit Pricing$0.0000075 per inference request

Usage

export interface Env {
AI: Ai;
}
export default {
async fetch(request, env): Promise<Response> {
const res = await fetch("https://cataas.com/cat");
const blob = await res.arrayBuffer();
const inputs = {
image: [...new Uint8Array(blob)],
};
const response = await env.AI.run(
"@cf/facebook/detr-resnet-50",
inputs
);
return new Response(JSON.stringify({ inputs: { image: [] }, response }));
},
} satisfies ExportedHandler<Env>;

Parameters

Option 1
stringformat: binary
The image to use for detection

API Schemas

{
"oneOf": [
{
"type": "string",
"format": "binary",
"description": "The image to use for detection"
},
{
"type": "object",
"properties": {
"image": {
"type": "array",
"description": "An array of integers that represent the image data constrained to 8-bit unsigned integer values",
"items": {
"type": "number",
"description": "A value between 0 and 255 (unsigned 8bit)"
}
}
}
}
]
}