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.
-
Attributes
-
model_size
:int
, default=0int: DDR space for model.
-
input_buffer_size
:int
, default=0int: Input buffer size for FIFO queue.
-
input_buffer_count
:int
, default=0int: Input buffer count for FIFO queue.
-
result_buffer_size
:kp.ModelNefDescriptor
, default=kp.ModelNefDescriptor()int: Result buffer size for FIFO queue.
-
result_buffer_count
:int
, default=0int: Result buffer count for FIFO queue.
-
get_member_variable_dict()
Represent member variables with Dict format.
-
Returns
- ret :
dict
Represent member variables in Dict format.
- ret :
-
Return type
property input_buffer_count(: int)
int: Input buffer count for FIFO queue.
-
Return type
property input_buffer_size(: int)
int: Input buffer size for FIFO queue.
-
Return type
property model_size(: int)
int: DDR space for model.
-
Return type
property result_buffer_count(: int)
int: Result buffer count for FIFO queue.
-
Return type
property result_buffer_size(: int)
int: Result buffer size for FIFO queue.
-
Return type
class kp.DeviceDescriptor(usb_port_id=0, vendor_id=0, product_id=0, link_speed=UsbSpeed.KP_USB_SPEED_UNKNOWN, kn_number=0, is_connectable=False, usb_port_path='', firmware='')
Information of one connected device from USB perspectives.
-
Attributes
-
usb_port_id
:int
, default=0int: An unique ID representing for a Kneron device, can be used as input while connecting devices.
-
vendor_id
:int
, default=0int: Supposed to be 0x3231.
-
product_id
:int
, default=0int: USB PID (Product ID).
-
link_speed
:UsbSpeed
, default=UsbSpeed.KP_USB_SPEED_UNKNOWNUsbSpeed: Enum for USB speed mode.
-
kn_number
:int
, default=0int: KN number.
-
is_connectable
: bool, default=Falsebool: Indicate if this device is connectable.
-
usb_port_path
:str
, default=’’str: “busNo-hub_portNo-device_portNo” (ex: “1-2-3”, means bus 1 - (hub) port 2 - (device) port 3)
-
firmware
:str
, default=’’str: Firmware description.
-
property firmware(: str)
str: Firmware description.
-
Return type
get_member_variable_dict()
Represent member variables with Dict format.
-
Returns
- ret :
dict
Represent member variables in Dict format.
- ret :
-
Return type
property is_connectable(: bool)
bool: Indicate if this device is connectable.
-
Return type
property kn_number(: int)
int: KN number.
-
Return type
property link_speed(: UsbSpeed)
UsbSpeed: Enum for USB speed mode.
-
Return type
property product_id(: int)
int: USB PID (Product ID).
-
Return type
property usb_port_id(: int)
int: An unique ID representing for a Kneron device, can be used as input while connecting devices.
-
Return type
property usb_port_path(: str)
str: “busNo-hub_portNo-device_portNo” (ex: “1-2-3”, means bus 1 - (hub) port 2 - (device) port 3)
-
Return type
property vendor_id(: int)
int: Supposed to be 0x3231.
-
Return type
class kp.DeviceDescriptorList(device_descriptor_list=[])
Information of connected devices from USB perspectives.
-
Attributes
device_descriptor_list
:List
[kp.DeviceDescriptor
], default=[]List[kp.DeviceDescriptor]: DeviceDescriptor objects list, contain 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.
-
Return type
List
[DeviceDescriptor
]
property device_descriptor_number(: int)
int: Number of connected devices.
-
Return type
get_member_variable_dict()
Represent member variables with Dict format.
-
Returns
- ret :
dict
Represent member variables in Dict format.
- ret :
-
Return type
class kp.DeviceGroup(address)
A handle represent connected Kneron device.
-
Attributes
address
:int
int: Memory address of connected Kneron device handler.
property address(: int)
int: Memory address of connected Kneron device handler.
-
Return type
property content(: DeviceGroupContent)
DeviceGroupContent: A DeviceGroup descriptor.
-
Return type
DeviceGroupContent
get_member_variable_dict()
Represent member variables with Dict format.
-
Returns
- ret :
dict
Represent member variables in Dict format.
- ret :
-
Return type
class kp.FirmwareVersion(reserved=0, major=0, minor=0, update=0, build=0)
Information of firmware version.
-
Attributes
get_member_variable_dict()
Represent member variables with Dict format.
-
Returns
- ret :
dict
Represent member variables in Dict format.
- ret :
-
Return type
property reserved(: int)
int: Reserved version number for backward compatibility.
-
Return type
class kp.GenericDataInferenceDescriptor(inference_number=0, model_id=0, input_node_data_list=[])
Multiple input inference descriptor for bypass pre-processing inference.
-
Attributes
-
model_id
:int
, default=0int: Target inference model ID.
-
inference_number
:int
, default=0int: Inference sequence number.
-
input_node_data_list
:List
[GenericInputNodeData
], default=[]List[GenericInputNodeData]: Multiple input inference data descriptors (The data order must be mapping model input tensor order as shown in ModelNefDescriptor).
-
get_member_variable_dict()
Represent member variables with Dict format.
-
Returns
- ret :
dict
Represent member variables in Dict format.
- ret :
-
Return type
property inference_number(: int)
int: Inference sequence number.
-
Return type
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).
-
Return type
List
[GenericInputNodeData
]
property input_node_data_num(: int)
int: Number of multiple input inference data descriptors in input_node_data_list.
-
Return type
property model_id(: int)
int: Target inference model ID.
-
Return type
class kp.GenericDataInferenceResult(buffer_size)
Multiple input bypass pre-processing inference raw result.
-
Attributes
-
header
:kp.GenericDataInferenceResultHeader
kp.GenericDataInferenceResultHeader: Multiple input bypass pre-processing inference raw output descriptor.
-
raw_result
:kp.GenericRawResultNDArray
kp.GenericRawResultNDArray: Inference raw result buffer.
-
get_member_variable_dict()
Represent member variables with Dict format.
-
Returns
- ret :
dict
Represent member variables in Dict format.
- ret :
-
Return type
property header(: GenericDataInferenceResultHeader)
kp.GenericDataInferenceResultHeader: Multiple input bypass pre-processing inference raw output descriptor.
-
Return type
GenericDataInferenceResultHeader
property raw_result(: GenericRawResultNDArray)
kp.GenericRawResultNDArray: Inference raw result buffer.
-
Return type
GenericRawResultNDArray
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.
-
Attributes
property crop_number(: int)
int: Crop box sequence number.
-
Return type
get_member_variable_dict()
Represent member variables with Dict format.
-
Returns
- ret :
dict
Represent member variables in Dict format.
- ret :
-
Return type
property inference_number(: int)
int: Inference sequence number.
-
Return type
property num_output_node(: int)
int: Total number of output nodes.
-
Return type
property product_id(: int)
int: USB PID (Product ID).
-
Return type
class kp.GenericImageInferenceDescriptor(inference_number=0, model_id=0, input_node_image_list=[])
Multiple input inference descriptor for images.
-
Attributes
-
model_id
:int
, default=0int: Target inference model ID.
-
inference_number
:int
, default=0int: Inference sequence number.
-
input_node_image_list
:List
[GenericInputNodeImage
], default=[]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).
-
get_member_variable_dict()
Represent member variables with Dict format.
-
Returns
- ret :
dict
Represent member variables in Dict format.
- ret :
-
Return type
property inference_number(: int)
int: Inference sequence number.
-
Return type
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).
-
Return type
List
[GenericInputNodeImage
]
property input_node_image_num(: int)
int: Number of multiple input inference image data descriptors in input_node_image_list.
-
Return type
property model_id(: int)
int: Target inference model ID.
-
Return type
class kp.GenericImageInferenceResult(buffer_size)
Generic multiple input inference raw result.
-
Attributes
-
header
:kp.GenericImageInferenceResultHeader
kp.GenericImageInferenceResultHeader: Multiple input image inference raw output descriptor.
-
raw_result
:kp.GenericRawResultNDArray
kp.GenericRawResultNDArray: Inference raw result buffer.
-
get_member_variable_dict()
Represent member variables with Dict format.
-
Returns
- ret :
dict
Represent member variables in Dict format.
- ret :
-
Return type
property header(: GenericImageInferenceResultHeader)
kp.GenericImageInferenceResultHeader: Multiple input image inference raw output descriptor.
-
Return type
GenericImageInferenceResultHeader
property raw_result(: GenericRawResultNDArray)
kp.GenericRawResultNDArray: Inference raw result buffer.
-
Return type
GenericRawResultNDArray
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.
-
Attributes
-
inference_number
:int
, default=0int: Inference sequence number.
-
crop_number
:int
, default=0int: Crop box sequence number.
-
num_output_node
:int
, default=0int: Total number of output nodes.
-
product_id
:int
, default=0int: USB PID (Product ID).
-
hw_pre_proc_info_list
:List
[kp.HwPreProcInfo
], default=[]List[kp.HwPreProcInfo]: Hardware pre-process information for each input node.
-
property crop_number(: int)
int: Crop box sequence number.
-
Return type
get_member_variable_dict()
Represent member variables with Dict format.
-
Returns
- ret :
dict
Represent member variables in Dict format.
- ret :
-
Return type
property hw_pre_proc_info_list(: List[HwPreProcInfo])
List[kp.HwPreProcInfo]: Hardware pre-process information for each input node.
-
Return type
List
[HwPreProcInfo
]
property inference_number(: int)
int: Inference sequence number.
-
Return type
property num_hw_pre_proc_info(: int)
int: Number of hardware pre-process information.
-
Return type
property num_output_node(: int)
int: Total number of output nodes.
-
Return type
property product_id(: int)
int: USB PID (Product ID).
-
Return type
class kp.GenericInputNodeData(buffer=b'')
Single data descriptor for bypass pre-processing inference.
-
Attributes
buffer
:bytes
, default=bytes()bytes: The data bytes contains the inference data.
property buffer(: bytes)
bytes: The data bytes contains the inference data.
-
Return type
property buffer_size(: int)
int: Inference data buffer size.
-
Return type
get_member_variable_dict()
Represent member variables with Dict format.
-
Returns
- ret :
dict
Represent member variables in Dict format.
- ret :
-
Return type
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.
-
Attributes
-
image
:bytes
,numpy.ndarray
, default=numpy.ndarray([0, 0,kp.Const.CHANNEL_NUM_OTHER_FORMAT.value
], dtype=np.uint8)numpy.ndarray: The data bytes or numpy.ndarray (dtype=numpy.uint8, dim=3) contains the image.
-
width
:int
, default=0int: Inference image width (Must apply when using bytes image data).
-
height
:int
, default=0int: Inference image height (Must apply when using bytes image data).
-
image_format
:kp.ImageFormat
, default=kp.ImageFormat.KP_IMAGE_FORMAT_RGB565kp.ImageFormat: Inference image format, refer to ImageFormat.
-
resize_mode
:kp.ResizeMode
, default=kp.ResizeMode.KP_RESIZE_ENABLEkp.ResizeMode: Preprocess resize mode, refer to ResizeMode.
-
padding_mode
:kp.PaddingMode
, default=kp.PaddingMode.KP_PADDING_CORNERkp.PaddingMode: Preprocess padding mode, none or auto refer to PaddingMode.
-
normalize_mode
:kp.NormalizeMode
, default=kp.NormalizeMode.KP_NORMALIZE_KNERONkp.NormalizeMode: Inference normalization, refer to NormalizeMode.
-
inference_crop_box_list
:List
[kp.InferenceCropBox
], default=[]List[kp.InferenceCropBox]: Box information to crop.
-
property crop_count(: int)
int: Number of crop box.
-
Return type
get_member_variable_dict()
Represent member variables with Dict format.
-
Returns
- ret :
dict
Represent member variables in Dict format.
- ret :
-
Return type
property height(: int)
int: Inference image height (Must apply when using bytes image data).
-
Return type
property image(: ndarray)
numpy.ndarray: The data bytes or numpy.ndarray (dtype=numpy.uint8, dim=3) contains the image.
-
Return type
property image_format(: ImageFormat)
kp.ImageFormat: Inference image format, refer to ImageFormat.
-
Return type
property inference_crop_box_list(: List[InferenceCropBox])
List[kp.InferenceCropBox]: Box information to crop.
-
Return type
List
[InferenceCropBox
]
property normalize_mode(: NormalizeMode)
kp.NormalizeMode: Inference normalization, refer to NormalizeMode.
-
Return type
property padding_mode(: PaddingMode)
kp.PaddingMode: Preprocess padding mode, none or auto refer to PaddingMode.
-
Return type
property resize_mode(: ResizeMode)
kp.ResizeMode: Preprocess resize mode, refer to ResizeMode.
-
Return type
property width(: int)
int: Inference image width (Must apply when using bytes image data).
-
Return type
class kp.GenericRawResultNDArray(buffer_size)
Inference raw result buffer.
-
Attributes
buffer_size
:int
int: Size of generic inference raw result buffer.
property buffer_size(: int)
int: Size of generic inference raw result buffer.
-
Return type
get_member_variable_dict()
Represent member variables with Dict format.
-
Returns
- ret :
dict
Represent member variables in Dict format.
- ret :
-
Return type
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.
-
Attributes
-
img_width
:int
, default=0int: Image width before hardware pre-process.
-
img_height: int, default=0
Image height before hardware pre-process.
-
resized_img_width: int, default=0
Image width after resize.
-
resized_img_height: int, default=0
Image height after resize.
-
pad_top: int, default=0
Pixels padding on top.
-
pad_bottom: int, default=0
Pixels padding on bottom.
-
pad_left: int, default=0
Pixels padding on left.
-
pad_right: int, default=0
Pixels padding on right.
-
model_input_width: int, default=0
Model required input width.
-
model_input_height: int, default=0
Model required input height.
-
crop_area: InferenceCropBox, default=InferenceCropBox()
Information of crop area. (may not be the same as input due to hardware limitation)
-
property crop_area(: InferenceCropBox)
InferenceCropBox: Information of crop area. (may not be the same as input due to hardware limitation)
-
Return type
InferenceCropBox
get_member_variable_dict()
Represent member variables with Dict format.
-
Returns
- ret :
dict
Represent member variables in Dict format.
- ret :
-
Return type
property img_height(: int)
int: Image height before hardware pre-process.
-
Return type
property img_width(: int)
int: Image width before hardware pre-process.
-
Return type
property model_input_height(: int)
int: Model required input height.
-
Return type
property model_input_width(: int)
int: Model required input width.
-
Return type
property pad_bottom(: int)
int: Pixels padding on bottom.
-
Return type
property pad_left(: int)
int: Pixels padding on left.
-
Return type
property pad_right(: int)
int: Pixels padding on right.
-
Return type
property pad_top(: int)
int: Pixels padding on top.
-
Return type
property resized_img_height(: int)
int: Image height after resize.
-
Return type
property resized_img_width(: int)
int: Image width after resize.
-
Return type
class kp.InferenceConfiguration(enable_frame_drop=False)
Inference configurations.
-
Attributes
enable_frame_drop
: bool, default=Falsebool: Enable this to keep inference non-blocking by dropping oldest and unprocessed frames.
property enable_frame_drop(: bool)
bool: Enable this to keep inference non-blocking by dropping oldest and unprocessed frames.
-
Return type
get_member_variable_dict()
Represent member variables with Dict format.
-
Returns
- ret :
dict
Represent member variables in Dict format.
- ret :
-
Return type
class kp.InferenceCropBox(crop_box_index=0, x=0, y=0, width=0, height=0)
Class for an image crop region.
-
Attributes
-
crop_box_index
:int
, default=0int: Index number of crop box.
-
x
:int
, default=0int: X coordinate of crop box top-left corner.
-
y
:int
, default=0int: Y coordinate of crop box top-left corner.
-
width
:int
, default=0int: Width coordinate of crop box.
-
height
:int
, default=0int: Height coordinate of crop box.
-
property crop_box_index(: int)
int: Index number of crop box.
-
Return type
get_member_variable_dict()
Represent member variables with Dict format.
-
Returns
- ret :
dict
Represent member variables in Dict format.
- ret :
-
Return type
property height(: int)
int: Height coordinate of crop box.
-
Return type
property width(: int)
int: Width coordinate of crop box.
-
Return type
property x(: int)
int: X coordinate of crop box top-left corner.
-
Return type
property y(: int)
int: Y coordinate of crop box top-left corner.
-
Return type
class kp.InferenceFixedNodeOutput(width=0, height=0, channel=0, radix=0, scale=0, factor=0, 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.
-
Attributes
-
width
:int
, default=0int: Width of output node.
-
height
:int
, default=0int: Height of output node.
-
channel
:int
, default=0int: Channel of output node.
-
radix
:int
, default=0int: Radix for fixed/floating point conversion.
-
scale
:float
, default=0float: Scale for fixed/floating point conversion.
-
factor
:float
, default=0float: Conversion factor for fixed-point to floating-point conversion - formulation: scale \* (2 ^ radix).
-
dtype
:FixedPointDType
, default=FixedPointDType.FixedPointDType: fixed-point data type.
-
num_data
:int
, default=0int: Total number of fixed-point values.
-
data :
np.ndarray
, default=np.array([])N-dimensional numpy.ndarray of feature map. (Channel ordering: KL520 - H,C,W; KL720 - C,H,W)
-
channels_ordering
:kp.ChannelOrdering
, default=kp.ChannelOrdering.KP_CHANNEL_ORDERING_CHWkp.ChannelOrdering: Channel ordering of feature map. (Options: KP_CHANNEL_ORDERING_HCW, KP_CHANNEL_ORDERING_CHW)
-
property channel(: int)
int: Channel of output node.
-
Return type
property channels_ordering(: ChannelOrdering)
kp.ChannelOrdering: Channel ordering of feature map. (Options: KP_CHANNEL_ORDERING_HCW, KP_CHANNEL_ORDERING_CHW)
-
Return type
property dtype(: FixedPointDType)
FixedPointDType: fixed-point data type.
-
Return type
property factor(: float)
float: Conversion factor for fixed-point to floating-point conversion - formulation: scale * (2 ^ radix).
-
Return type
get_member_variable_dict()
Represent member variables with Dict format.
-
Returns
- ret :
dict
Represent member variables in Dict format.
- ret :
-
Return type
property height(: int)
int: Height of output node.
-
Return type
property ndarray(: ndarray)
numpy.ndarray: N-dimensional numpy.ndarray of feature map.
-
Return type
property num_data(: int)
int: Total number of fixed-point values.
-
Return type
property radix(: int)
int: Radix for fixed/floating point conversion.
-
Return type
property scale(: float)
float: Scale for fixed/floating point conversion.
-
Return type
to_float_node_output()
Convert fixed-point node output to floating-point node output.
-
Returns
- inference_float_node_output :
kp.InferenceFloatNodeOutput
- inference_float_node_output :
-
Return type
InferenceFloatNodeOutput
property width(: int)
int: Width of output node.
-
Return type
class kp.InferenceFloatNodeOutput(width=0, height=0, channel=0, num_data=0, data=array([], dtype=float64), channels_ordering=ChannelOrdering.KP_CHANNEL_ORDERING_CHW)
Generic inference node output in floating-point format.
-
Attributes
-
width
:int
, default=0int: Width of output node.
-
height
:int
, default=0int: Height of output node.
-
channel
:int
, default=0int: Channel of output node.
-
num_data
:int
, default=0int: Total number of floating-point values.
-
data :
np.ndarray
, default=np.array([])N-dimensional numpy.ndarray of feature map. (Channel ordering: KL520 - H,C,W; KL720 - C,H,W)
-
channels_ordering
:kp.ChannelOrdering
, default=kp.ChannelOrdering.KP_CHANNEL_ORDERING_CHWkp.ChannelOrdering: Channel ordering of feature map. (Options: KP_CHANNEL_ORDERING_HCW, KP_CHANNEL_ORDERING_CHW)
-
property channel(: int)
int: Channel of output node.
-
Return type
property channels_ordering(: ChannelOrdering)
kp.ChannelOrdering: Channel ordering of feature map. (Options: KP_CHANNEL_ORDERING_HCW, KP_CHANNEL_ORDERING_CHW)
-
Return type
get_member_variable_dict()
Represent member variables with Dict format.
-
Returns
- ret :
dict
Represent member variables in Dict format.
- ret :
-
Return type
property height(: int)
int: Height of output node.
-
Return type
property ndarray(: ndarray)
numpy.ndarray: N-dimensional numpy.ndarray of feature map.
-
Return type
property num_data(: int)
int: Total number of floating-point values.
-
Return type
property width(: int)
int: Width of output node.
-
Return type
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.
-
Attributes
-
magic
:int
, default=0int: Magic number for model_nef_descriptor (0x5AA55AA5).
-
metadata
:ModelNefMetadata
, default=ModelNefMetadata()ModelNefMetadata: NEF metadata.
-
target_chip
:ModelTargetChip
, default=ModelTargetChip.KP_MODEL_TARGET_CHIP_UNKNOWNModelTargetChip: Target chip of all models.
-
crc
:int
, default=0int: CRC of NEF models.
-
models
:List
[SingleModelDescriptor
], default=[]List[SingleModelDescriptor]: Model descriptors.
-
property crc(: int)
int: CRC of NEF models.
-
Return type
get_member_variable_dict()
Represent member variables with Dict format.
-
Returns
- ret :
dict
Represent member variables in Dict format.
- ret :
-
Return type
property magic(: int)
int: Magic number for model_nef_descriptor (0x5AA55AA5).
-
Return type
property metadata(: ModelNefMetadata)
ModelNefMetadata: NEF metadata.
-
Return type
ModelNefMetadata
property models(: List[SingleModelDescriptor])
List[SingleModelDescriptor]: Model descriptors.
-
Return type
List
[SingleModelDescriptor
]
property target_chip(: ModelTargetChip)
ModelTargetChip: Target chip of all models.
-
Return type
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.
-
Attributes
-
kn_number
:int
, default=0int: Target KN number device of encrypted all models.
-
toolchain_version
:str
, default=’’str: Toolchain version of all models.
-
compiler_version
:str
, default=’’str: Compiler version of all models.
-
nef_schema_version
:NefSchemaVersion
, default=NefSchemaVersion()NefSchemaVersion: Schema version of nef.
-
platform
:str
, default=’’str: Target device platform USB dongle, 96 board, etc.
-
property compiler_version(: str)
str: Compiler version of all models.
-
Return type
get_member_variable_dict()
Represent member variables with Dict format.
-
Returns
- ret :
dict
Represent member variables in Dict format.
- ret :
-
Return type
property kn_number(: int)
int: Target KN number device of encrypted all models.
-
Return type
property nef_schema_version(: NefSchemaVersion)
NefSchemaVersion: Schema version of nef.
-
Return type
NefSchemaVersion
property platform(: str)
str: Target device platform USB dongle, 96 board, etc.
-
Return type
property toolchain_version(: str)
str: Toolchain version of all models.
-
Return type
class kp.NefSchemaVersion(major=0, minor=0, revision=0)
A NEF schema version object.
-
Attributes
-
major
int: Major number.
-
minor
int: Minor number.
-
revision
int: Revision number.
-
get_member_variable_dict()
Represent member variables with Dict format.
-
Returns
- ret :
dict
Represent member variables in Dict format.
- ret :
-
Return type
property major(: int)
int: Major number.
-
Return type
property minor(: int)
int: Minor number.
-
Return type
property revision(: int)
int: Revision number.
-
Return type
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.
-
Attributes
-
model_id
:int
, default=0int: Target inference model ID.
-
npu_clock_rate
:int
, default=0int: NPU clock rate.
-
f0
:int
, default=0int: Value of performance monitor mode f0.
-
f0_time
:float
, default=0float: time of performance monitor mode f0.
-
f1
:int
, default=0int: Value of performance monitor mode f1.
-
f1_time
:float
, default=0float: time of performance monitor mode f1.
-
f2
:int
, default=0int: Value of performance monitor mode f2.
-
f2_time
:float
, default=0float: time of performance monitor mode f2.
-
f3
:int
, default=0int: Value of performance monitor mode f3.
-
f3_time
:float
, default=0float: time of performance monitor mode f3.
-
f4
:int
, default=0int: Value of performance monitor mode f4.
-
f4_time
:float
, default=0float: time of performance monitor mode f4.
-
f5
:int
, default=0int: Value of performance monitor mode f5.
-
f5_time
:float
, default=0float: time of performance monitor mode f5.
-
f6
:int
, default=0int: Value of performance monitor mode f6.
-
f6_time
:float
, default=0float: time of performance monitor mode f6.
-
f7
:int
, default=0int: Value of performance monitor mode f7.
-
f7_time
:float
, default=0float: time of performance monitor mode f7.
-
property f0(: int)
int: Value of performance monitor mode f0.
-
Return type
property f0_time(: float)
float: time of performance monitor mode f0.
-
Return type
property f1(: int)
int: Value of performance monitor mode f1.
-
Return type
property f1_time(: float)
float: time of performance monitor mode f1.
-
Return type
property f2(: int)
int: Value of performance monitor mode f2.
-
Return type
property f2_time(: float)
float: time of performance monitor mode f2.
-
Return type
property f3(: int)
int: Value of performance monitor mode f3.
-
Return type
property f3_time(: float)
float: time of performance monitor mode f3.
-
Return type
property f4(: int)
int: Value of performance monitor mode f4.
-
Return type
property f4_time(: float)
float: time of performance monitor mode f4.
-
Return type
property f5(: int)
int: Value of performance monitor mode f5.
-
Return type
property f5_time(: float)
float: time of performance monitor mode f5.
-
Return type
property f6(: int)
int: Value of performance monitor mode f6.
-
Return type
property f6_time(: float)
float: time of performance monitor mode f6.
-
Return type
property f7(: int)
int: Value of performance monitor mode f7.
-
Return type
property f7_time(: float)
float: time of performance monitor mode f7.
-
Return type
get_member_variable_dict()
Represent member variables with Dict format.
-
Returns
- ret :
dict
Represent member variables in Dict format.
- ret :
-
Return type
property model_id(: int)
int: Target inference model ID.
-
Return type
property npu_clock_rate(: int)
int: NPU clock rate.
-
Return type
class kp.PerformanceMonitorData(npu_clock_rate=0, model_statistic_list=[])
Model inference performance monitor data.
-
Attributes
-
model_profiled_num
:int
, default=0int: Number of profiled model.
-
model_statistic_list
:List
[kp.NpuPerformanceMonitorStatistics
], default=[]List[kp.NpuPerformanceMonitorStatistics]: List of performance monitor statistic data.
-
get_member_variable_dict()
Represent member variables with Dict format.
-
Returns
- ret :
dict
Represent member variables in Dict format.
- ret :
-
Return type
property model_profiled_num(: int)
int: Number of profiled model.
-
Return type
property model_statistic_list(: List[NpuPerformanceMonitorStatistics])
List[kp.NpuPerformanceMonitorStatistics]: List of performance monitor statistic data.
-
Return type
List
[NpuPerformanceMonitorStatistics
]
class kp.ProfileData(model_statistic_list=[])
Model inference profiling data.
-
Attributes
-
model_profiled_num
:int
, default=0int: Number of profiled model.
-
model_statistic_list
:List
[kp.ProfileModelStatistics
], default=[]List[kp.ProfileModelStatistics]: List of model inference statistic data.
-
get_member_variable_dict()
Represent member variables with Dict format.
-
Returns
- ret :
dict
Represent member variables in Dict format.
- ret :
-
Return type
property model_profiled_num(: int)
int: Number of profiled model.
-
Return type
property model_statistic_list(: List[ProfileModelStatistics])
List[kp.ProfileModelStatistics]: List of model inference statistic data.
-
Return type
List
[ProfileModelStatistics
]
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.
-
Attributes
-
model_id
:int
, default=0int: Target inference model ID.
-
inference_count
:int
, default=0int: Number of Inference in the statistic.
-
cpu_op_count
:int
, default=0int: Number of CPU operation per inference.
-
avg_pre_process_ms
:float
, default=0float: Average pre-process time in milliseconds.
-
avg_inference_ms
:float
, default=0float: Average inference time in milliseconds.
-
avg_cpu_op_ms
:float
, default=0float: Average CPU operation time per-inference in milliseconds.
-
avg_cpu_op_per_cpu_node_ms
:float
, default=0float: Average CPU operation time per-CPU node in milliseconds.
-
avg_post_process_ms
:float
, default=0float: Average post-process time in milliseconds.
-
property avg_cpu_op_ms(: float)
float: Average CPU operation time per-inference in milliseconds.
-
Return type
property avg_cpu_op_per_cpu_node_ms(: float)
float: Average CPU operation time per-CPU node in milliseconds.
-
Return type
property avg_inference_ms(: float)
float: Average inference time in milliseconds.
-
Return type
property avg_post_process_ms(: float)
float: Average post-process time in milliseconds.
-
Return type
property avg_pre_process_ms(: float)
float: Average pre-process time in milliseconds.
-
Return type
property cpu_op_count(: int)
int: Number of CPU operation per inference.
-
Return type
get_member_variable_dict()
Represent member variables with Dict format.
-
Returns
- ret :
dict
Represent member variables in Dict format.
- ret :
-
Return type
property inference_count(: int)
int: Number of Inference in the statistic.
-
Return type
property model_id(: int)
int: Target inference model ID.
-
Return type
class kp.QuantizationParameters(quantized_fixed_point_descriptor_list=[])
Quantization parameters for tensor.
-
Attributes
quantized_fixed_point_descriptor_list
:List
[QuantizedFixedPointDescriptor
], default=[]List[QuantizedFixedPointDescriptor]: (a) List length = 1 for all-channel fixed-point quantization parameter, (b) List length > 1 for per-channel fixed-point quantization parameter.
get_member_variable_dict()
Represent member variables with Dict format.
-
Returns
- ret :
dict
Represent member variables in Dict format.
- ret :
-
Return type
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.
-
Return type
List
[QuantizedFixedPointDescriptor
]
class kp.QuantizedFixedPointDescriptor(scale=0, radix=0)
Quantization parameters for fixed-point value.
-
Attributes
get_member_variable_dict()
Represent member variables with Dict format.
-
Returns
- ret :
dict
Represent member variables in Dict format.
- ret :
-
Return type
property radix(: int)
int: Radix for fixed/floating point conversion.
-
Return type
property scale(: float)
float: Scale for fixed/floating point conversion.
-
Return type
class kp.SetupFileSchemaVersion(major=0, minor=0, revision=0)
A setup information file version object.
-
Attributes
-
major
int: Major number.
-
minor
int: Minor number.
-
revision
int: Revision number.
-
get_member_variable_dict()
Represent member variables with Dict format.
-
Returns
- ret :
dict
Represent member variables in Dict format.
- ret :
-
Return type
property major(: int)
int: Major number.
-
Return type
property minor(: int)
int: Minor number.
-
Return type
property revision(: int)
int: Revision number.
-
Return type
class kp.SetupSchemaVersion(major=0, minor=0, revision=0)
A setup information schema version object.
-
Attributes
-
major
int: Major number.
-
minor
int: Minor number.
-
revision
int: Revision number.
-
get_member_variable_dict()
Represent member variables with Dict format.
-
Returns
- ret :
dict
Represent member variables in Dict format.
- ret :
-
Return type
property major(: int)
int: Major number.
-
Return type
property minor(: int)
int: Minor number.
-
Return type
property revision(: int)
int: Revision number.
-
Return type
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.
-
Attributes
-
target_chip
:ModelTargetChip
, default=KP_MODEL_TARGET_CHIP_UNKNOWNModelTargetChip: Target chip of model.
-
version
:int
, default=0int: Version of model.
-
id
:int
, default=0int: Model ID.
-
input_nodes
:List
[TensorDescriptor
], default=[]List[TensorDescriptor]: List of model input node tensor information.
-
output_nodes
:List
[TensorDescriptor
], default=[]List[TensorDescriptor]: List of model output node tensor information.
-
setup_schema_version
:SetupSchemaVersion
, default=SetupSchemaVersion()SetupSchemaVersion: Schema version of setup.
-
setup_file_schema_version
:SetupFileSchemaVersion
, default=SetupFileSchemaVersion()SetupFileSchemaVersion: File schema version of setup.
-
max_raw_out_size
:int
, default=0int: Needed raw output buffer size for this model.
-
get_member_variable_dict()
Represent member variables with Dict format.
-
Returns
- ret :
dict
Represent member variables in Dict format.
- ret :
-
Return type
property id(: int)
int: Model ID.
-
Return type
property input_nodes(: List[TensorDescriptor])
List[TensorDescriptor]: List of model input node tensor information.
-
Return type
List
[TensorDescriptor
]
property max_raw_out_size(: int)
int: Needed raw output buffer size for this model.
-
Return type
property output_nodes(: List[TensorDescriptor])
List[TensorDescriptor]: List of model output node tensor information.
-
Return type
List
[TensorDescriptor
]
property setup_file_schema_version(: SetupFileSchemaVersion)
SetupFileSchemaVersion: File schema version of setup.
-
Return type
SetupFileSchemaVersion
property setup_schema_version(: SetupSchemaVersion)
SetupSchemaVersion: Schema version of setup.
-
Return type
SetupSchemaVersion
property target_chip(: ModelTargetChip)
ModelTargetChip: Target chip of model.
-
Return type
property version(: int)
int: Version of model.
-
Return type
class kp.SystemInfo(kn_number=0, firmware_version={'firmware_version': '0.0.0-build.0'})
System Information of Kneron device.
-
Attributes
-
kn_number
:int
, default=0int: Unique Kneron device ID.
-
firmware_version
:kp.FirmwareVersion
, default=kp.FirmwareVersion()kp.FirmwareVersion: Firmware version of Kneron device.
-
property firmware_version()
kp.FirmwareVersion: Firmware version of Kneron device.
get_member_variable_dict()
Represent member variables with Dict format.
-
Returns
- ret :
dict
Represent member variables in Dict format.
- ret :
-
Return type
property kn_number()
int: Unique Kneron device ID.
class kp.TensorDescriptor(index=0, name='', shape_npu=[], shape_onnx=[], data_layout=ModelTensorDataLayout.KP_MODEL_TENSOR_DATA_LAYOUT_UNKNOWN, quantization_parameters={'quantized_fixed_point_descriptor_list': {}})
Tensor information.
-
Attributes
-
index
:int
, default=0int: Index number of the tensor.
-
name
:str
, default=’’str: Name of the tensor.
-
shape_npu
:List
[int
], default=[]List[int]: NPU shape of the tensor (Default dimension order: BxCxHxW).
-
shape_onnx
:List
[int
], default=[]List[int]: ONNX shape of the tensor.
-
data_layout
:ModelTensorDataLayout
, default=ModelTensorDataLayout.KP_MODEL_TENSOR_DATA_LAYOUT_UNKNOWNModelTensorDataLayout: NPU data layout of the tensor.
-
quantization_parameters
:QuantizationParameters
, default=QuantizationParameters()QuantizationParameters: Quantization parameters f the tensor.
-
property data_layout(: ModelTensorDataLayout)
ModelTensorDataLayout: NPU data layout of the tensor.
-
Return type
get_member_variable_dict()
Represent member variables with Dict format.
-
Returns
- ret :
dict
Represent member variables in Dict format.
- ret :
-
Return type
property index(: int)
int: Index number of the tensor.
-
Return type
property name(: str)
str: Name of the tensor.
-
Return type
property quantization_parameters(: QuantizationParameters)
QuantizationParameters: Quantization parameters f the tensor.
-
Return type
QuantizationParameters
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.