Web Analytics

kp value


class kp.DdrManageAttributes(model_size=0, input_buffer_size=0, input_buffer_count=0, result_buffer_size=0, result_buffer_count=0)

DDR memory management descriptor of Kneron device.

get_member_variable_dict()

Represent member variables with Dict format.

property input_buffer_count(: int)

int: Input buffer count for FIFO queue.

property input_buffer_size(: int)

int: Input buffer size for FIFO queue.

property model_size(: int)

int: DDR space for model.

property result_buffer_count(: int)

int: Result buffer count for FIFO queue.

property result_buffer_size(: int)

int: Result buffer size for FIFO queue.


Information of one connected device from USB perspectives.

property firmware(: str)

str: Firmware description.

get_member_variable_dict()

Represent member variables with Dict format.

property is_connectable(: bool)

bool: Indicate if this device is connectable.

property kn_number(: int)

int: KN number.

UsbSpeed: Enum for USB speed mode.

property product_id(: int)

int: USB PID (Product ID).

property usb_port_id(: int)

int: An unique ID representing for a Kneron device, can be used as input while connecting devices.

property usb_port_path(: str)

str: “busNo-hub_portNo-device_portNo” (ex: “1-2-3”, means bus 1 - (hub) port 2 - (device) port 3)

property vendor_id(: int)

int: Supposed to be 0x3231.


class kp.DeviceDescriptorList(device_descriptor_list=[])

Information of connected devices from USB perspectives.

property device_descriptor_list(: List[DeviceDescriptor])

List[kp.DeviceDescriptor]: DeviceDescriptor objects list, contain information of connected devices from USB perspectives.

property device_descriptor_number(: int)

int: Number of connected devices.

get_member_variable_dict()

Represent member variables with Dict format.


class kp.DeviceGroup(address)

A handle represent connected Kneron device.

property address(: int)

int: Memory address of connected Kneron device handler.

property content(: DeviceGroupContent)

DeviceGroupContent: A DeviceGroup descriptor.

get_member_variable_dict()

Represent member variables with Dict format.


class kp.FirmwareVersion(reserved=0, major=0, minor=0, update=0, build=0)

Information of firmware version.

get_member_variable_dict()

Represent member variables with Dict format.

property reserved(: int)

int: Reserved version number for backward compatibility.


class kp.GenericDataInferenceDescriptor(inference_number=0, model_id=0, input_node_data_list=[])

Multiple input inference descriptor for bypass pre-processing inference.

get_member_variable_dict()

Represent member variables with Dict format.

property inference_number(: int)

int: Inference sequence number.

property input_node_data_list(: List[GenericInputNodeData])

List[GenericInputNodeData]: Multiple input inference data descriptors (The data order must be mapping model input tensor order as shown in ModelNefDescriptor).

property input_node_data_num(: int)

int: Number of multiple input inference data descriptors in input_node_data_list.

property model_id(: int)

int: Target inference model ID.


class kp.GenericDataInferenceResult(buffer_size)

Multiple input bypass pre-processing inference raw result.

get_member_variable_dict()

Represent member variables with Dict format.

property header(: GenericDataInferenceResultHeader)

kp.GenericDataInferenceResultHeader: Multiple input bypass pre-processing inference raw output descriptor.

property raw_result(: GenericRawResultNDArray)

kp.GenericRawResultNDArray: Inference raw result buffer.


class kp.GenericDataInferenceResultHeader(inference_number=0, crop_number=0, num_output_node=0, product_id=0)

Multiple input bypass pre-processing inference raw output descriptor.

property crop_number(: int)

int: Crop box sequence number.

get_member_variable_dict()

Represent member variables with Dict format.

property inference_number(: int)

int: Inference sequence number.

property num_output_node(: int)

int: Total number of output nodes.

property product_id(: int)

int: USB PID (Product ID).


class kp.GenericImageInferenceDescriptor(inference_number=0, model_id=0, input_node_image_list=[])

Multiple input inference descriptor for images.

get_member_variable_dict()

Represent member variables with Dict format.

property inference_number(: int)

int: Inference sequence number.

property input_node_image_list(: List[GenericInputNodeImage])

List[kp.GenericInputNodeImage]: Multiple input inference image data descriptors (Max number of input image is 5) (The image data order must be mapping model input tensor order as shown in ModelNefDescriptor).

property input_node_image_num(: int)

int: Number of multiple input inference image data descriptors in input_node_image_list.

property model_id(: int)

int: Target inference model ID.


class kp.GenericImageInferenceResult(buffer_size)

Generic multiple input inference raw result.

get_member_variable_dict()

Represent member variables with Dict format.

property header(: GenericImageInferenceResultHeader)

kp.GenericImageInferenceResultHeader: Multiple input image inference raw output descriptor.

property raw_result(: GenericRawResultNDArray)

kp.GenericRawResultNDArray: Inference raw result buffer.


class kp.GenericImageInferenceResultHeader(inference_number=0, crop_number=0, num_output_node=0, product_id=0, hw_pre_proc_info_list=[])

Multiple input image inference raw output descriptor.

property crop_number(: int)

int: Crop box sequence number.

get_member_variable_dict()

Represent member variables with Dict format.

property hw_pre_proc_info_list(: List[HwPreProcInfo])

List[kp.HwPreProcInfo]: Hardware pre-process information for each input node.

property inference_number(: int)

int: Inference sequence number.

property num_hw_pre_proc_info(: int)

int: Number of hardware pre-process information.

property num_output_node(: int)

int: Total number of output nodes.

property product_id(: int)

int: USB PID (Product ID).


class kp.GenericInputNodeData(buffer=b'')

Single data descriptor for bypass pre-processing inference.

property buffer(: bytes)

bytes: The data bytes contains the inference data.

property buffer_size(: int)

int: Inference data buffer size.

get_member_variable_dict()

Represent member variables with Dict format.


class kp.GenericInputNodeImage(image=array([], shape=(0, 0, 2), dtype=uint8), width=0, height=0, image_format=ImageFormat.KP_IMAGE_FORMAT_RGB565, resize_mode=ResizeMode.KP_RESIZE_ENABLE, padding_mode=PaddingMode.KP_PADDING_CORNER, normalize_mode=NormalizeMode.KP_NORMALIZE_KNERON, inference_crop_box_list=[])

Single inference image data descriptor.

property crop_count(: int)

int: Number of crop box.

get_member_variable_dict()

Represent member variables with Dict format.

property height(: int)

int: Inference image height (Must apply when using bytes image data).

property image(: ndarray)

numpy.ndarray: The data bytes or numpy.ndarray (dtype=numpy.uint8, dim=3) contains the image.

property image_format(: ImageFormat)

kp.ImageFormat: Inference image format, refer to ImageFormat.

property inference_crop_box_list(: List[InferenceCropBox])

List[kp.InferenceCropBox]: Box information to crop.

property normalize_mode(: NormalizeMode)

kp.NormalizeMode: Inference normalization, refer to NormalizeMode.

property padding_mode(: PaddingMode)

kp.PaddingMode: Preprocess padding mode, none or auto refer to PaddingMode.

property resize_mode(: ResizeMode)

kp.ResizeMode: Preprocess resize mode, refer to ResizeMode.

property width(: int)

int: Inference image width (Must apply when using bytes image data).


class kp.GenericRawResultNDArray(buffer_size)

Inference raw result buffer.

property buffer_size(: int)

int: Size of generic inference raw result buffer.

get_member_variable_dict()

Represent member variables with Dict format.


class kp.HwPreProcInfo(img_width=0, img_height=0, resized_img_width=0, resized_img_height=0, pad_top=0, pad_bottom=0, pad_left=0, pad_right=0, model_input_width=0, model_input_height=0, crop_area={'crop_box_index': 0, 'x': 0, 'y': 0, 'width': 0, 'height': 0})

Information of Hardware Pre Process.

property crop_area(: InferenceCropBox)

InferenceCropBox: Information of crop area. (may not be the same as input due to hardware limitation)

get_member_variable_dict()

Represent member variables with Dict format.

property img_height(: int)

int: Image height before hardware pre-process.

property img_width(: int)

int: Image width before hardware pre-process.

property model_input_height(: int)

int: Model required input height.

property model_input_width(: int)

int: Model required input width.

property pad_bottom(: int)

int: Pixels padding on bottom.

property pad_left(: int)

int: Pixels padding on left.

property pad_right(: int)

int: Pixels padding on right.

property pad_top(: int)

int: Pixels padding on top.

property resized_img_height(: int)

int: Image height after resize.

property resized_img_width(: int)

int: Image width after resize.


class kp.InferenceConfiguration(enable_frame_drop=False)

Inference configurations.

property enable_frame_drop(: bool)

bool: Enable this to keep inference non-blocking by dropping oldest and unprocessed frames.

get_member_variable_dict()

Represent member variables with Dict format.


class kp.InferenceCropBox(crop_box_index=0, x=0, y=0, width=0, height=0)

Class for an image crop region.

property crop_box_index(: int)

int: Index number of crop box.

get_member_variable_dict()

Represent member variables with Dict format.

property height(: int)

int: Height coordinate of crop box.

property width(: int)

int: Width coordinate of crop box.

property x(: int)

int: X coordinate of crop box top-left corner.

property y(: int)

int: Y coordinate of crop box top-left corner.


class kp.InferenceFixedNodeOutput(name='', shape=[], quantization_parameters={'version': 'QuantizationParametersVersion.KP_MODEL_QUANTIZATION_PARAMS_VER ..., dtype=FixedPointDType.KP_FIXED_POINT_DTYPE_UNKNOWN, num_data=0, data=array([], dtype=float64), channels_ordering=ChannelOrdering.KP_CHANNEL_ORDERING_CHW)

Generic inference node output in fixed-point format.

property channels_ordering(: ChannelOrdering)

kp.ChannelOrdering: Channel ordering of feature map. (Options: KP_CHANNEL_ORDERING_HCW, KP_CHANNEL_ORDERING_CHW, KP_CHANNEL_ORDERING_DEFAULT)

property dtype(: FixedPointDType)

FixedPointDType: fixed-point data type.

property factor(: ndarray)

numpy.ndarray: N-dimensional numpy.ndarray of dequantization factor.

get_member_variable_dict()

Represent member variables with Dict format.

property name(: str)

str: Name of the tensor.

property ndarray(: ndarray)

numpy.ndarray: N-dimensional numpy.ndarray of feature map.

property num_data(: int)

int: Total number of fixed-point values.

property quantization_parameters(: QuantizationParameters)

QuantizationParameters: Quantization parameters of the tensor.

property shape(: List[int])

List[int]: ONNX shape of the tensor.

to_float_node_output()

Convert fixed-point node output to floating-point node output.


class kp.InferenceFloatNodeOutput(name='', shape=[], num_data=0, data=array([], dtype=float64), channels_ordering=ChannelOrdering.KP_CHANNEL_ORDERING_CHW)

Generic inference node output in floating-point format.

property channels_ordering(: ChannelOrdering)

kp.ChannelOrdering: Channel ordering of feature map. (Options: KP_CHANNEL_ORDERING_HCW, KP_CHANNEL_ORDERING_CHW)

get_member_variable_dict()

Represent member variables with Dict format.

property name(: str)

str: Name of the tensor.

property ndarray(: ndarray)

numpy.ndarray: N-dimensional numpy.ndarray of feature map.

property num_data(: int)

int: Total number of floating-point values.

property shape(: List[int])

List[int]: ONNX shape of the tensor.


class kp.ModelNefDescriptor(magic=0, metadata={'kn_number': '0x0', 'toolchain_version': '', 'compiler_version': '', 'nef_ ..., target_chip=ModelTargetChip.KP_MODEL_TARGET_CHIP_UNKNOWN, crc=0, models=[])

A basic descriptor for NEF.

property crc(: int)

int: CRC of NEF models.

get_member_variable_dict()

Represent member variables with Dict format.

property magic(: int)

int: Magic number for model_nef_descriptor (0x5AA55AA5).

property metadata(: ModelNefMetadata)

ModelNefMetadata: NEF metadata.

property models(: List[SingleModelDescriptor])

List[SingleModelDescriptor]: Model descriptors.

property target_chip(: ModelTargetChip)

ModelTargetChip: Target chip of all models.


class kp.ModelNefMetadata(kn_number=0, toolchain_version='', compiler_version='', nef_schema_version={'version': '0.0.0'}, platform='')

A basic descriptor for a model NEF metadata.

property compiler_version(: str)

str: Compiler version of all models.

get_member_variable_dict()

Represent member variables with Dict format.

property kn_number(: int)

int: Target KN number device of encrypted all models.

property nef_schema_version(: NefSchemaVersion)

NefSchemaVersion: Schema version of nef.

property platform(: str)

str: Target device platform USB dongle, 96 board, etc.

property toolchain_version(: str)

str: Toolchain version of all models.


class kp.NefSchemaVersion(major=0, minor=0, revision=0)

A NEF schema version object.

get_member_variable_dict()

Represent member variables with Dict format.

property major(: int)

int: Major number.

property minor(: int)

int: Minor number.

property revision(: int)

int: Revision number.


class kp.NpuPerformanceMonitorStatistics(model_id=0, npu_clock_rate=0, f0=0, f1=0, f2=0, f3=0, f4=0, f5=0, f6=0, f7=0)

One model inference performance monitor statistic data.

property f0(: int)

int: Value of performance monitor mode f0.

property f0_time(: float)

float: time of performance monitor mode f0.

property f1(: int)

int: Value of performance monitor mode f1.

property f1_time(: float)

float: time of performance monitor mode f1.

property f2(: int)

int: Value of performance monitor mode f2.

property f2_time(: float)

float: time of performance monitor mode f2.

property f3(: int)

int: Value of performance monitor mode f3.

property f3_time(: float)

float: time of performance monitor mode f3.

property f4(: int)

int: Value of performance monitor mode f4.

property f4_time(: float)

float: time of performance monitor mode f4.

property f5(: int)

int: Value of performance monitor mode f5.

property f5_time(: float)

float: time of performance monitor mode f5.

property f6(: int)

int: Value of performance monitor mode f6.

property f6_time(: float)

float: time of performance monitor mode f6.

property f7(: int)

int: Value of performance monitor mode f7.

property f7_time(: float)

float: time of performance monitor mode f7.

get_member_variable_dict()

Represent member variables with Dict format.

property model_id(: int)

int: Target inference model ID.

property npu_clock_rate(: int)

int: NPU clock rate.


class kp.PerformanceMonitorData(npu_clock_rate=0, model_statistic_list=[])

Model inference performance monitor data.

get_member_variable_dict()

Represent member variables with Dict format.

property model_profiled_num(: int)

int: Number of profiled model.

property model_statistic_list(: List[NpuPerformanceMonitorStatistics])

List[kp.NpuPerformanceMonitorStatistics]: List of performance monitor statistic data.


class kp.ProfileData(model_statistic_list=[])

Model inference profiling data.

get_member_variable_dict()

Represent member variables with Dict format.

property model_profiled_num(: int)

int: Number of profiled model.

property model_statistic_list(: List[ProfileModelStatistics])

List[kp.ProfileModelStatistics]: List of model inference statistic data.


class kp.ProfileModelStatistics(model_id=0, inference_count=0, cpu_op_count=0, avg_pre_process_ms=0, avg_inference_ms=0, avg_cpu_op_ms=0, avg_cpu_op_per_cpu_node_ms=0, avg_post_process_ms=0)

One model inference statistic data.

property avg_cpu_op_ms(: float)

float: Average CPU operation time per-inference in milliseconds.

property avg_cpu_op_per_cpu_node_ms(: float)

float: Average CPU operation time per-CPU node in milliseconds.

property avg_inference_ms(: float)

float: Average inference time in milliseconds.

property avg_post_process_ms(: float)

float: Average post-process time in milliseconds.

property avg_pre_process_ms(: float)

float: Average pre-process time in milliseconds.

property cpu_op_count(: int)

int: Number of CPU operation per inference.

get_member_variable_dict()

Represent member variables with Dict format.

property inference_count(: int)

int: Number of Inference in the statistic.

property model_id(: int)

int: Target inference model ID.


class kp.QuantizationParameters(version=QuantizationParametersVersion.KP_MODEL_QUANTIZATION_PARAMS_VERSION_1, data={'quantized_axis': 0, 'quantized_fixed_point_descriptor_list': {}})

Quantization parameters data for tensor.

property data(: QuantizationParametersV1)

Union[QuantizationParametersV1]: Quantization parameters for tensor.

get_member_variable_dict()

Represent member variables with Dict format.

property v1(: QuantizationParametersV1)

QuantizationParametersV1: Quantization parameters for tensor. (Version 1)

property version(: QuantizationParametersVersion)

QuantizationParametersVersion: Quantization parameters version (ref. QuantizationParametersVersion).


class kp.QuantizationParametersV1(quantized_axis=0, quantized_fixed_point_descriptor_list=[])

Quantization parameters V1 for tensor.

get_member_variable_dict()

Represent member variables with Dict format.

property quantized_axis(: int)

int: The axis along which the fixed-point quantization information performed.

property quantized_fixed_point_descriptor_list(: List[QuantizedFixedPointDescriptor])

List[QuantizedFixedPointDescriptor]: (a) List length = 1 for all-channel fixed-point quantization parameter, (b) List length > 1 for per-channel fixed-point quantization parameter.


class kp.QuantizedFixedPointDescriptor(scale={'dtype': 'DataType.KP_DTYPE_FLOAT32', 'value': 1.0}, radix=0)

Quantization parameters for fixed-point value.

get_member_variable_dict()

Represent member variables with Dict format.

property radix(: int)

int: Radix for fixed/floating point conversion.

property scale(: Scale)

float: Scale for fixed/floating point conversion.


class kp.Scale(dtype=DataType.KP_DTYPE_FLOAT32, value=1.0)

Scale of Quantization parameter.

property dtype(: DataType)

DataType: enum for Kneron data type.

get_member_variable_dict()

Represent member variables with Dict format.

property value(: float)

float: Scale for fixed/floating point conversion.


class kp.SetupFileSchemaVersion(major=0, minor=0, revision=0)

A setup information file version object.

get_member_variable_dict()

Represent member variables with Dict format.

property major(: int)

int: Major number.

property minor(: int)

int: Minor number.

property revision(: int)

int: Revision number.


class kp.SetupSchemaVersion(major=0, minor=0, revision=0)

A setup information schema version object.

get_member_variable_dict()

Represent member variables with Dict format.

property major(: int)

int: Major number.

property minor(: int)

int: Minor number.

property revision(: int)

int: Revision number.


class kp.SingleModelDescriptor(target_chip=ModelTargetChip.KP_MODEL_TARGET_CHIP_UNKNOWN, version=0, id=0, input_nodes=[], output_nodes=[], setup_schema_version={'version': '0.0.0'}, setup_file_schema_version={'version': '0.0.0'}, max_raw_out_size=0)

A basic descriptor for a model.

get_member_variable_dict()

Represent member variables with Dict format.

property id(: int)

int: Model ID.

property input_nodes(: List[TensorDescriptor])

List[TensorDescriptor]: List of model input node tensor information.

property max_raw_out_size(: int)

int: Needed raw output buffer size for this model.

property output_nodes(: List[TensorDescriptor])

List[TensorDescriptor]: List of model output node tensor information.

property setup_file_schema_version(: SetupFileSchemaVersion)

SetupFileSchemaVersion: File schema version of setup.

property setup_schema_version(: SetupSchemaVersion)

SetupSchemaVersion: Schema version of setup.

property target_chip(: ModelTargetChip)

ModelTargetChip: Target chip of model.

property version(: int)

int: Version of model.


class kp.SystemInfo(kn_number=0, firmware_version={'firmware_version': '0.0.0-build.0'})

System Information of Kneron device.

property firmware_version()

kp.FirmwareVersion: Firmware version of Kneron device.

get_member_variable_dict()

Represent member variables with Dict format.

property kn_number()

int: Unique Kneron device ID.


class kp.TensorDescriptor(index=0, name='', data_layout=ModelTensorDataLayout.KP_MODEL_TENSOR_DATA_LAYOUT_UNKNOWN, tensor_shape_info={'version': 'ModelTensorShapeInformationVersion.KP_MODEL_TENSOR_SHAPE_INFO_ ..., quantization_parameters={'version': 'QuantizationParametersVersion.KP_MODEL_QUANTIZATION_PARAMS_VER ...)

Tensor information.

property data_layout(: ModelTensorDataLayout)

ModelTensorDataLayout: NPU data layout of the tensor.

get_member_variable_dict()

Represent member variables with Dict format.

property index(: int)

int: Index number of the tensor.

property name(: str)

str: Name of the tensor.

property quantization_parameters(: QuantizationParameters)

QuantizationParameters: Quantization parameters of the tensor.

property tensor_shape_info(: TensorShapeInfo)

TensorShapeInfo: Tensor shape information.


class kp.TensorShapeInfo(version=ModelTensorShapeInformationVersion.KP_MODEL_TENSOR_SHAPE_INFO_VERSION_1, data={'shape_npu': [], 'shape_onnx': [], 'axis_permutation_onnx_to_npu': []})

Tensor shape information.

property data(: Union[TensorShapeInfoV1, TensorShapeInfoV2])

Union[TensorShapeInfoV1, TensorShapeInfoV2]: Shape information data.

get_member_variable_dict()

Represent member variables with Dict format.

property v1(: TensorShapeInfoV1)

TensorShapeInfoV1: Tensor shape information. (version 1)

property v2(: TensorShapeInfoV2)

TensorShapeInfoV2: Tensor shape information. (version 2)

property version(: ModelTensorShapeInformationVersion)

ModelTensorShapeInformationVersion: Shape information version (ref. kp_model_tensor_shape_info_version_t).


class kp.TensorShapeInfoV1(shape_npu=[], shape_onnx=[], axis_permutation_onnx_to_npu=[])

Tensor shape information. (version 1)

property axis_permutation_onnx_to_npu(: List[int])

List[int]: Remap axis permutation from onnx to npu shape (shape_intrp_dim).

get_member_variable_dict()

Represent member variables with Dict format.

property shape_npu(: List[int])

List[int]: NPU shape of the tensor (Default dimension order: BxCxHxW).

property shape_onnx(: List[int])

List[int]: ONNX shape of the tensor.


class kp.TensorShapeInfoV2(shape=[], stride_onnx=[], stride_npu=[])

Tensor shape information. (version 2)

get_member_variable_dict()

Represent member variables with Dict format.

property shape(: List[int])

List[int]: ONNX shape of the tensor.

property stride_npu(: List[int])

List[int]: Data access stride of NPU (in scalar).

property stride_onnx(: List[int])

List[int]: Data access stride of ONNX (in scalar).