Skip to content

perception.analyze

Operation: perception.analyze
Category: ai
Tags: perception, detection, segmentation, ocr, vision, image

Detect objects, segment instances, and extract text (OCR) from images using the Falcon-Perception vision model (0.3B parameters, runs locally).

Type: Local Model (Falcon-Perception)
Timeout: 120s
Retries: 1

NameTypeRequiredDefaultDescription
image_pathStringYesPath to image file
perception_operationsString[]No["detect:object"]Operations to run (see below)
OperationDescription
detect:<query>Detect objects matching the natural language query, returns bounding boxes
segment:<query>Instance segmentation for the query, saves mask PNGs to staging dir
ocrExtract all text from the image (plain mode)
ocr:layoutLayout-aware OCR with region coordinates, categories, and confidence
NameTypeDescription
_perception_result.detectionsObject[][{"object": str, "bbox": {"x_min", "y_min", "x_max", "y_max"}}]
_perception_result.segmentsObject[][{"object": str, "mask_path": str, "bbox": {...}}]
_perception_result.ocrObject | null{"text": str} or {"text": str, "regions": [...]} for layout mode
Terminal window
pip install 'fabric-workflow-sdk[local-perception]'
from fabric_workflow_sdk.stages.perception import analyze_perception, extract_text
# Object detection
result = await analyze_perception({
"image_path": "photo.jpg",
"perception_operations": ["detect:person", "detect:car"],
})
detections = result["_perception_result"]["detections"]
# Instance segmentation
result = await analyze_perception({
"image_path": "photo.jpg",
"perception_operations": ["segment:person"],
})
mask_paths = [s["mask_path"] for s in result["_perception_result"]["segments"]]
# OCR (plain)
result = await extract_text({"image_path": "document.png"})
text = result["_perception_result"]["ocr"]["text"]
# OCR (layout-aware)
result = await analyze_perception({
"image_path": "document.png",
"perception_operations": ["ocr:layout"],
})
regions = result["_perception_result"]["ocr"]["regions"]
{
"image_path": "photo.jpg",
"perception_operations": ["detect:cat", "ocr"]
}
ModelParametersSizeLicense
Falcon-Perception-0.3B0.3B~600 MBApache 2.0

The model downloads automatically on first use. Supports CUDA (NVIDIA), MPS (Apple Silicon), and CPU.

ErrorCauseFix
ImportError: falcon_perceptionPackage not installedpip install 'fabric-workflow-sdk[local-perception]'
No image_path in inputMissing required inputProvide image_path in the input dict
perception model set to 'skip'Quality profile disables perceptionUse a local-capable profile (free, local, local-quality)