Interpreting results
run returns a list of ImageInferenceResult, one per input image. Each holds a flat list of InferenceResult entries under results.
InferenceResult
Each InferenceResult carries the output of one network stage. The populated field depends on network_type:
| Field | Populated for |
|---|---|
bounding_box | object detection, instance segmentation |
segmentation | segmentation, instance segmentation |
scalar | classification, anomaly detection |
text | optical character recognition |
barcode | barcode reading |
sub_results | nested results from downstream stages |
Additional fields: network_type (the producing stage), index (position within its sibling list), and batch_index (the source image). Coordinates on bounding_box, segmentation and barcoce are absolute pixel values.
Object definition
- Python
- C / C++
class InferenceResult:
network_type: str
batch_index: int
index: int
sub_results: list[InferenceResult]
scalar: Scalar | None
bounding_box: BoundingBox | None
segmentation: Segmentation | None
text: str | None
barcode: Barcode | None
typedef struct DenkflowInferenceResult {
DenkflowNetworkType network_type;
size_t index;
struct DenkflowInferenceResult *sub_results;
size_t sub_results_length;
DenkflowBoundingBox *bounding_box;
DenkflowSegmentation *segmentation;
DenkflowScalar *scalar;
char *text;
DenkflowBarcode *barcode;
} DenkflowInferenceResult;
Walking the results
- Python
- C / C++
for image_result in results:
for r in image_result.results:
if r.bounding_box:
print(r.bounding_box.class_label.name, r.bounding_box.confidence)
if r.text is not None:
print(r.text)
for sub in r.sub_results:
... # nested stage output
for (size_t b = 0; b < inference_results->image_results_length; ++b) {
DenkflowImageInferenceResult* image_result = &inference_results->image_results[b];
for (size_t i = 0; i < image_result->results_length; ++i) {
DenkflowInferenceResult* r = &image_result->results[i];
if (r->bounding_box != NULL) {
printf("%s: %f\n", r->bounding_box->class_label.name, r->bounding_box->confidence);
}
}
}
In C, the result tree is released once with denkflow_inference_results_free.
Nested pipelines (for example detection followed by per-object classification) expose the downstream output under sub_results.