SimplifiedPipeline
SimplifiedPipeline is the default way to run an exported .denkflow pipeline. It wraps a Pipeline, performs initialization internally, and returns structured results in absolute pixel coordinates. Subscribing to topics, publishing tensors, and decoding raw output tensors are handled automatically.
For full manual control over graph construction and topic wiring, see the classic Pipeline flow.
Basic usage
A SimplifiedPipeline is created from an uninitialized Pipeline and run on an image. The image argument accepts an image file path, an ImageTensor / ImageTensorU8, or a NumPy array.
- Python
- C / C++
import denkflow
pipeline = denkflow.Pipeline.from_denkflow("path/to/model.denkflow", pat="YOUR-PAT")
simplified = denkflow.SimplifiedPipeline(pipeline)
results = simplified.run("path/to/image.jpg", confidence_threshold=0.5)
for image_result in results:
for r in image_result.results:
if r.bounding_box:
bb = r.bounding_box
print(f"[{r.index}] {bb.class_label.name}: {bb.confidence:.2f}")
#include <stdio.h>
#include <stdlib.h>
#include "denkflow.h"
void handle_error(enum DenkflowResult error_code, const char* function_name) {
printf("%s: %d", function_name, (int32_t)error_code);
if (error_code != DenkflowResult_Ok) {
char* error_buffer = (char*)malloc(DENKFLOW_ERROR_BUFFER_SIZE);
denkflow_get_last_error(error_buffer);
printf(" (%s)\n", error_buffer);
free(error_buffer);
exit(EXIT_FAILURE);
}
printf("\n");
}
int main() {
DenkflowPipeline* pipeline = NULL;
DenkflowSimplifiedPipeline* simplified = NULL;
DenkflowImageInferenceResults* inference_results = NULL;
DenkflowHubLicenseSource* hub_license_source = NULL;
const char* pat = "YOUR-PAT";
const char* denkflow_path = "path/to/model.denkflow";
const char* image_path = "path/to/image.jpg";
handle_error(denkflow_hub_license_source_from_pat(&hub_license_source, pat, NULL, NULL),
"denkflow_hub_license_source_from_pat");
handle_error(denkflow_pipeline_from_denkflow(&pipeline, denkflow_path, (void*)hub_license_source),
"denkflow_pipeline_from_denkflow");
// Consumes the pipeline and initializes it internally.
handle_error(denkflow_simplified_pipeline_new(&simplified, &pipeline),
"denkflow_simplified_pipeline_new");
handle_error(denkflow_simplified_pipeline_run_from_file(&inference_results, simplified, image_path, 0.5f),
"denkflow_simplified_pipeline_run_from_file");
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* result = &image_result->results[i];
if (result->bounding_box != NULL) {
DenkflowBoundingBox* bb = result->bounding_box;
printf("[%zu] %s: %f\n", result->index, bb->class_label.name, bb->confidence);
}
}
}
denkflow_inference_results_free(&inference_results);
denkflow_simplified_pipeline_free(&simplified);
denkflow_free_object((void**)&hub_license_source);
return 0;
}
What comes next
- Running inference: input types, batches, and constant overrides
- Interpreting results: the
ImageInferenceResultandInferenceResultstructure - Drawing results: draw boxes, segmentations, and labels on the input image