kp value
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.
-
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(: kp.KPEnum.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[kp.KPValue.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.
-
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
get_member_variable_dict()
Represent member variables with Dict format.
-
Returns
ret :
dict
Represent member variables in Dict format.
-
Return type
class kp.FirmwareVersion(reserved=0, major=0, minor=0, update=0, build=0)
Information of firmware version.
-
Attributes
reserved
:int
, default=0int: Reserved version number for backward compatibility.
major :
int
, default=0minor :
int
, default=0update :
int
, default=0build :
int
, default=0
get_member_variable_dict()
Represent member variables with Dict format.
-
Returns
ret :
dict
Represent member variables in Dict format.
-
Return type
property reserved(: int)
int: Reserved version number for backward compatibility.
-
Return type
class kp.GenericRawBypassPreProcImageHeader(model_id=0, inference_number=0, image_buffer_size=0)
Inference descriptor for images bypass pre-processing.
-
Attributes
model_id
:int
, default=0int: Target inference model ID.
inference_number
:int
, default=0int: Inference sequence number.
image_buffer_size
:int
, default=0int: Inference image buffer size.
get_member_variable_dict()
Represent member variables with Dict format.
-
Returns
ret :
dict
Represent member variables in Dict format.
-
Return type
property image_buffer_size(: int)
int: Inference image buffer size.
-
Return type
property inference_number(: int)
int: Inference sequence number.
-
Return type
property model_id(: int)
int: Target inference model ID.
-
Return type
class kp.GenericRawBypassPreProcResult(buffer_size)
Generic inference raw result for bypass pre-processing.
-
Attributes
header
:kp.GenericRawBypassPreProcResultHeader
kp.GenericRawBypassPreProcResultHeader: Inference raw output descriptor for bypass pre-processing.
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.
-
Return type
property header(: kp.KPValue.GenericRawBypassPreProcResultHeader)
kp.GenericRawBypassPreProcResultHeader: Inference raw output descriptor for bypass pre-processing.
-
Return type
GenericRawBypassPreProcResultHeader
property raw_result(: kp.KPValue.GenericRawResultNDArray)
kp.GenericRawResultNDArray: Inference raw result buffer.
-
Return type
GenericRawResultNDArray
class kp.GenericRawBypassPreProcResultHeader(inference_number=0, crop_number=0, num_output_node=0)
Inference raw output descriptor for bypass pre-processing.
-
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.
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.
-
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
class kp.GenericRawImageHeader(model_id=0, resize_mode=ResizeMode.KP_RESIZE_ENABLE, padding_mode=PaddingMode.KP_PADDING_CORNER, normalize_mode=NormalizeMode.KP_NORMALIZE_KNERON, inference_number=0, inference_crop_box_list=[], width=0, height=0, image_format=ImageFormat.KP_IMAGE_FORMAT_RGB565)
Inference descriptor for images.
-
Attributes
model_id
:int
, default=0int: Target inference model ID.
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_number
:int
, default=0int: Inference sequence number.
inference_crop_box_list
:List
[kp.InferenceCropBox
], default=[]List[kp.InferenceCropBox]: Box information to crop.
width
:int
, default=0int: Inference image width.
height
:int
, default=0int: Inference image height.
image_format
:kp.ImageFormat
, default=kp.ImageFormat.KP_IMAGE_FORMAT_RGB565kp.ImageFormat: Inference image format, refer to ImageFormat.
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.
-
Return type
property height(: int)
int: Inference image height.
-
Return type
property image_format(: kp.KPEnum.ImageFormat)
kp.ImageFormat: Inference image format, refer to ImageFormat.
-
Return type
property inference_crop_box_list(: List[kp.KPValue.InferenceCropBox])
List[kp.InferenceCropBox]: Box information to crop.
-
Return type
List
[InferenceCropBox
]
property inference_number(: int)
int: Inference sequence number.
-
Return type
property model_id(: int)
int: Target inference model ID.
-
Return type
property normalize_mode(: kp.KPEnum.NormalizeMode)
kp.NormalizeMode: Inference normalization, refer to NormalizeMode.
-
Return type
property padding_mode(: kp.KPEnum.PaddingMode)
kp.PaddingMode: Preprocess padding mode, none or auto refer to PaddingMode.
-
Return type
property resize_mode(: kp.KPEnum.ResizeMode)
kp.ResizeMode: Preprocess resize mode, refer to ResizeMode.
-
Return type
property width(: int)
int: Inference image width.
-
Return type
class kp.GenericRawResult(buffer_size)
Generic inference raw result.
-
Attributes
header
:kp.GenericRawResultHeader
kp.GenericRawResultHeader: 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.
-
Return type
property header(: kp.KPValue.GenericRawResultHeader)
kp.GenericRawResultHeader: Inference raw output descriptor.
-
Return type
GenericRawResultHeader
property raw_result(: kp.KPValue.GenericRawResultNDArray)
kp.GenericRawResultNDArray: Inference raw result buffer.
-
Return type
GenericRawResultNDArray
class kp.GenericRawResultHeader(inference_number=0, crop_number=0, num_output_node=0)
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.
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.
-
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
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.
-
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.
-
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.
-
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, 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: 1 / (scale \* (2 ^ radix)).
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(: kp.KPEnum.ChannelOrdering)
kp.ChannelOrdering: Channel ordering of feature map. (Options: KP_CHANNEL_ORDERING_HCW, KP_CHANNEL_ORDERING_CHW)
-
Return type
property factor(: float)
float: Conversion factor for fixed-point to floating-point conversion - formulation: 1 / (scale * (2 ^ radix)).
-
Return type
get_member_variable_dict()
Represent member variables with Dict format.
-
Returns
ret :
dict
Represent member variables in Dict format.
-
Return type
property height(: int)
int: Height of output node.
-
Return type
property ndarray(: numpy.ndarray)
numpy.ndarray: N-dimensional numpy.ndarray of feature map.
-
Return type
ndarray
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
-
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(: kp.KPEnum.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.
-
Return type
property height(: int)
int: Height of output node.
-
Return type
property ndarray(: numpy.ndarray)
numpy.ndarray: N-dimensional numpy.ndarray of feature map.
-
Return type
ndarray
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(crc=0, num_models=0, models=[])
A basic descriptor for a NEF.
-
Attributes
crc
:int
, default=0int: The CRC of all models.
num_models
:int
, default=0int: The number of models contains in NEF.
models
:List
[kp.SingleModelDescriptor
], default=[]List[kp.SingleModelDescriptor]: SingleModelDescriptor objects list, contain information of uploaded NEF information.
property crc(: int)
int: The CRC of all models.
-
Return type
get_member_variable_dict()
Represent member variables with Dict format.
-
Returns
ret :
dict
Represent member variables in Dict format.
-
Return type
property models(: List[kp.KPValue.SingleModelDescriptor])
List[kp.SingleModelDescriptor]: SingleModelDescriptor objects list, contain information of uploaded NEF information.
-
Return type
List
[SingleModelDescriptor
]
property num_models(: int)
int: The number of models contains in NEF.
-
Return type
class kp.SingleModelDescriptor(id=0, max_raw_out_size=0, width=0, height=0, channel=0, img_format=ImageFormat.KP_IMAGE_FORMAT_RGBA8888)
A basic descriptor for a model.
-
Attributes
id
:int
, default=0int: Model ID.
max_raw_out_size
:int
, default=0int: Needed raw output buffer size for this model.
width
:int
, default=0int: The input width of this model.
height
:int
, default=0int: input height of this model.
channel
:int
, default=0int: The input channel of this model.
img_format
:kp.ImageFormat
, default=kp.ImageFormat.KP_IMAGE_FORMAT_RGBA8888kp.ImageFormat: The input image format of this model.
property channel(: int)
int: The input channel of this model.
-
Return type
get_member_variable_dict()
Represent member variables with Dict format.
-
Returns
ret :
dict
Represent member variables in Dict format.
-
Return type
property height(: int)
int: input height of this model.
-
Return type
property id(: int)
int: Model ID.
-
Return type
property img_format(: kp.KPEnum.ImageFormat)
kp.ImageFormat: The input image format of this model.
-
Return type
property max_raw_out_size(: int)
int: Needed raw output buffer size for this model.
-
Return type
property width(: int)
int: The input width of this 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.
-
Return type
property kn_number()
int: Unique Kneron device ID.