Quick start
This is the fastest way to run your first exported .denkflow pipeline.
What you need
Before you start, make sure you have:
- a
.denkflowexport from the Vision AI Hub - a valid personal access token (PAT)
- a test image
- either a Python environment or a C/C++ build environment
Step 1: Install the SDK
Follow the matching section in the Installation Guide:
- Python: wheel installation from the DENKweit package registry
- C/C++:
denkflow.hplus the shared library package for your platform
Step 2: Run an exported pipeline
- Python
- C / C++
from denkflow import Pipeline, ImageTensor
model_file = "path/to/exported_model.denkflow"
pat = "YOUR_PERSONAL_ACCESS_TOKEN"
image_file = "path/to/image.jpg"
pipeline = Pipeline.from_denkflow(model_file, pat=pat)
pipeline.initialize()
receiver = pipeline.subscribe(
"bounding_box_filter_node/filtered_bounding_boxes"
)
pipeline.publish_image_tensor("camera/image", ImageTensor.from_file(image_file))
pipeline.run()
objects = receiver.receive_bounding_box_tensor().to_objects(0.5)
for obj in objects:
print(obj.class_label.name, obj.confidence)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "denkflow.h"
static void handle_error(enum DenkflowResult code, const char* fn) {
printf("%s: %d", fn, (int)code);
if (code != DenkflowResult_Ok) {
char* buffer = (char*)malloc(DENKFLOW_ERROR_BUFFER_SIZE);
denkflow_get_last_error(buffer);
printf(" (%s)\n", buffer);
free(buffer);
exit(EXIT_FAILURE);
}
printf("\n");
}
int main(void) {
DenkflowPipeline* pipeline = NULL;
DenkflowInitializedPipeline* initialized_pipeline = NULL;
DenkflowHubLicenseSource* license_source = NULL;
DenkflowImageTensor* image_tensor = NULL;
DenkflowReceiverTensor* receiver = NULL;
DenkflowBoundingBoxTensor* tensor = NULL;
DenkflowBoundingBoxResults* results = 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(&license_source, pat, NULL, NULL),
"denkflow_hub_license_source_from_pat"
);
handle_error(
denkflow_pipeline_from_denkflow(&pipeline, denkflow_path, (void*)license_source),
"denkflow_pipeline_from_denkflow"
);
handle_error(denkflow_initialize_pipeline(&initialized_pipeline, &pipeline), "denkflow_initialize_pipeline");
handle_error(
denkflow_initialized_pipeline_subscribe(
&receiver,
initialized_pipeline,
"bounding_box_filter_node/filtered_bounding_boxes"
),
"denkflow_initialized_pipeline_subscribe"
);
handle_error(denkflow_image_tensor_from_file(&image_tensor, image_path), "denkflow_image_tensor_from_file");
handle_error(
denkflow_initialized_pipeline_publish_image_tensor(initialized_pipeline, "camera/image", &image_tensor),
"denkflow_initialized_pipeline_publish_image_tensor"
);
handle_error(denkflow_initialized_pipeline_run(initialized_pipeline, 8000), "denkflow_initialized_pipeline_run");
handle_error(denkflow_receiver_receive_bounding_box_tensor(&tensor, receiver), "denkflow_receiver_receive_bounding_box_tensor");
handle_error(denkflow_bounding_box_tensor_to_objects(&results, tensor, 0.5f), "denkflow_bounding_box_tensor_to_objects");
for (int i = 0; i < results->bounding_boxes_length; ++i) {
printf("%s: %f\n", results->bounding_boxes[i].class_label.name, results->bounding_boxes[i].confidence);
}
denkflow_free_object((void**)&results);
denkflow_free_object((void**)&tensor);
denkflow_free_object((void**)&receiver);
denkflow_free_object((void**)&initialized_pipeline);
denkflow_free_object((void**)&license_source);
return 0;
}
Step 3: Verify the runtime
If the pipeline initializes successfully and returns detections, your environment is working.
If the initialization fails:
- Confirm the model file is valid
- Confirm the PAT or license is valid
- Confirm your runtime dependencies are installed
- Check the Troubleshooting guide
Next steps
- See Authentication and licensing for more information on the licensing and authentication.
- See Creating ImageTensors to choose the right input constructor and shape.
- See Runtime and device selection for choosing between CPU and GPU as the inference device.
- See Docker deployment for production containers.