Skip to main content

DENK SDK Quickstart Guide

This quickstart guide will help you understand how to use our SDK to call neural networks, called models, created on the DENK Vision AI Hub. These models can be downloaded as .denk files.

The main purpose of the SDK is to run neural network inference offline, locally, on premise and using your own program code.

Depending on your programming language of choice the main functions you have to call are the following:

import denk_sdk

pipeline = denk_sdk.InferencePipeline(token=token, device=device)
model = pipeline.add_model(model_path)

results = pipeline.run(img).get_results()

print(results) # contains objects, classification, texts etc.

Check out our fully functional examples here to get started immediately.

The next part shows a step-by-step instruction to setup your system and utilize the DENK SDK for your use-case.

Prerequisites

General

  1. Access to the denkweit platform
  2. .denk model files downloaded from the platform
  3. Valid authentication token or dongle (contact your denkweit customer success)

System

  • Currently only x86 64bit systems are supported. ARM Processors will be supported soon.
  • The DENK SDK is currently available for C# and Python.
    • C++ users can use our dynamic link library directly.
  • Windows:
    • You need Windows 10 or above
    • Install the Visual C++ Redistributable: vcredist
  • Linux:
    • Ubuntu 22.04
    • If you want to use other distros contact us here
tip

Check your hardware. Neural Networks run a lot faster on graphic cards (GPUs) than on normal processors (CPUs). You have to choose the right installation package to fully utilize your system. More info here.

Programming language

Python 3.8 or higher is required.

If you do not have Python installed on your system, you can download it from the official website. To use the DENK SDKs, we recommend using at least Python Version 3.8, but newer versions will work as well. To run a Python script, in this example a file called script.py, you can open a terminal window and simply enter:

python script.py

Installation

All packages can be downloaded from the DENKVision AI Hub Software Center.

Windows

  1. Download the appropriate wheel file (.whl) from our hub. For now the standard "DENK SDK Python", which uses DML, supports CPU and GPU execution. Advanced use cases can use CUDA or OpenVino directly (more information).

  2. Install the wheel:

    pip install denk_sdk_v1.0.0.whl

Linux

Packages are compiled for Ubuntu 22.04. If you encounter problems or are in need of a package for a different distro contact use here.

  1. Download the appropriate wheel file (.whl) for your system:
    • CPU: denk_sdk_lin_cpu_v1.0.0.whl
    • NVIDIA GPU: denk_sdk_lin_gpu_v1.0.0.whl
  2. Install the wheel:
    pip install <wheel_name>.whl

Usage

The following is a first simple example showing the basic usage.

There are more advanced "ready-to-use" programs in this documentation here and information on the structure of the returning result here.

import denk_sdk
import cv2

with open("token.txt", 'r') as file:
token = file.read()

model_path = "models/my_segmentation_model.denk"
example_image = cv2.imread("my_image.jpg")

# model loading and definiton, only done once
pipeline = denk_sdk.InferencePipeline(token=token, device=denk_sdk.Device.CPU)
model = pipeline.add_model(model_path)
model.post.set_segmentation_threshold(0.1).set_confidence_filter(0.992)

# run the model
results = pipeline.run(example_image).get_results()

for m in results.segmentation_models:
print("Model: {}".format(m.model_name))
for cl in m.classes:
print(" Class: {}".format(cl.class_name))
for ftr in cl.objects:
print(" Feature: {}".format(ftr.confidence))