Files
echart/api_document/02.hailo_platform.pyhailort.pyhailort.txt
simonandClaude Opus 4.7 eedead0d41 feat: 全面代码更新 - ECharts 5.4.2 重构、新增量化分析模块、前端库升级
- 升级 ECharts 到 5.4.2,重构 lib/ 目录结构
- 新增 DataTables 2.x 和 FixedColumns 插件
- 新增 quant/ 宏观研究报告模块
- 重构图表页面:stock_trend、hkholdbycode 等采用 JS fetch API.doorcome.cn 模式
- 新增 CLAUDE.md 补充页面文档和新数据流说明
- 更新 inc/config.php TuShare API 配置
- 更新新闻联播分析模块 news/ 和相关研究报告 research/
- 新增 api_document/ 参考文档
- 清理 .gitignore,排除 uploads/xls/.mcp.json/ source maps 等非代码文件
- 所有 PHP 文件通过 php -l 语法检查

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-06 18:01:55 +08:00

2801 lines
91 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
hailo_platform.pyhailort.pyhailort
class hailo_platform.pyhailort.pyhailort.HailoRTException[source]
Bases: Exception
class hailo_platform.pyhailort.pyhailort.UdpRecvError[source]
Bases: hailo_platform.pyhailort.pyhailort.HailoRTException
class hailo_platform.pyhailort.pyhailort.InvalidProtocolVersionException[source]
Bases: hailo_platform.pyhailort.pyhailort.HailoRTException
class hailo_platform.pyhailort.pyhailort.HailoRTFirmwareControlFailedException[source]
Bases: hailo_platform.pyhailort.pyhailort.HailoRTException
class hailo_platform.pyhailort.pyhailort.HailoRTInvalidFrameException[source]
Bases: hailo_platform.pyhailort.pyhailort.HailoRTException
class hailo_platform.pyhailort.pyhailort.HailoRTUnsupportedOpcodeException[source]
Bases: hailo_platform.pyhailort.pyhailort.HailoRTException
class hailo_platform.pyhailort.pyhailort.HailoRTTimeout[source]
Bases: hailo_platform.pyhailort.pyhailort.HailoRTException
class hailo_platform.pyhailort.pyhailort.HailoRTStreamAborted[source]
Bases: hailo_platform.pyhailort.pyhailort.HailoRTException
class hailo_platform.pyhailort.pyhailort.HailoRTStreamAbortedByUser[source]
Bases: hailo_platform.pyhailort.pyhailort.HailoRTException
class hailo_platform.pyhailort.pyhailort.HEF(hef_source)[source]
Bases: object
Python representation of the Hailo Executable Format, which contains one or more compiled models.
__init__(hef_source)[source]
Constructor for the HEF class.
Parameters
hef_source (str or bytes) The source from which the HEF object will be created. If the source type is str, it is treated as a path to an hef file. If the source type is bytes, it is treated as a buffer. Any other type will raise a ValueError.
get_networks_names(network_group_name=None)[source]
Gets the names of all networks in a specific network group.
Parameters
network_group_name (str, optional) The name of the network group to access. If not given, first network_group is addressed.
Returns
The names of the networks.
Return type
list of str
property path
HEF file path.
get_network_group_names()[source]
Get the names of the network groups in this HEF.
get_network_groups_infos()[source]
Get information about the network groups in this HEF.
get_input_vstream_infos(name=None)[source]
Get input vstreams information.
Parameters
name (str, optional) The name of the network or network_group to access. In case network_group name is given, Address all networks of the given network_group. In case not given, first network_group is addressed.
Returns
with all the information objects of all input vstreams.
Return type
list of hailo_platform.pyhailort._pyhailort.VStreamInfo
get_output_vstream_infos(name=None)[source]
Get output vstreams information.
Parameters
name (str, optional) The name of the network or network_group to access. In case network_group name is given, Address all networks of the given network_group. In case not given, first network_group is addressed.
Returns
with all the information objects of all output vstreams
Return type
list of hailo_platform.pyhailort._pyhailort.VStreamInfo
get_all_vstream_infos(name=None)[source]
Get input and output vstreams information.
Parameters
name (str, optional) The name of the network or network_group to access. In case network_group name is given, Address all networks of the given network_group. In case not given, first network_group is addressed.
Returns
with all the information objects of all input and output vstreams
Return type
list of hailo_platform.pyhailort._pyhailort.VStreamInfo
get_input_stream_infos(name=None)[source]
Get the input low-level streams information.
Parameters
name (str, optional) The name of the network or network_group to access. In case network_group name is given, Address all networks of the given network_group. In case not given, first network_group is addressed.
Returns
with information objects of all input low-level streams.
Return type
List of hailo_platform.pyhailort._pyhailort.StreamInfo
get_output_stream_infos(name=None)[source]
Get the output low-level streams information of a specific network group.
Parameters
name (str, optional) The name of the network or network_group to access. In case network_group name is given, Address all networks of the given network_group. In case not given, first network_group is addressed.
Returns
with information objects of all output low-level streams.
Return type
List of hailo_platform.pyhailort._pyhailort.StreamInfo
get_all_stream_infos(name=None)[source]
Get input and output streams information of a specific network group.
Parameters
name (str, optional) The name of the network or network_group to access. In case network_group name is given, Address all networks of the given network_group. In case not given, first network_group is addressed.
Returns
with all the information objects of all input and output streams
Return type
list of hailo_platform.pyhailort._pyhailort.StreamInfo
get_sorted_output_names(network_group_name=None)[source]
Get the names of the outputs in a network group. The order of names is determined by the SDK. If the network group is not given, the first one is used.
get_vstream_name_from_original_name(original_name, network_group_name=None)[source]
Get vstream name from original layer name for a specific network group.
Parameters
original_name (str) The original layer name.
network_group_name (str, optional) The name of the network group to access. If not given, first network_group is addressed.
Returns
the matching vstream name for the provided original name.
Return type
str
get_original_names_from_vstream_name(vstream_name, network_group_name=None)[source]
Get original names list from vstream name for a specific network group.
Parameters
vstream_name (str) The stream name.
network_group_name (str, optional) The name of the network group to access. If not given, first network_group is addressed.
Returns
all the matching original layers names for the provided vstream name.
Return type
list of str
get_vstream_names_from_stream_name(stream_name, network_group_name=None)[source]
Get vstream names list from their underlying stream name for a specific network group.
Parameters
stream_name (str) The underlying stream name.
network_group_name (str, optional) The name of the network group to access. If not given, first network_group is addressed.
Returns
All the matching vstream names for the provided stream name.
Return type
list of str
get_stream_names_from_vstream_name(vstream_name, network_group_name=None)[source]
Get stream name from vstream name for a specific network group.
Parameters
vstream_name (str) The name of the vstreams.
network_group_name (str, optional) The name of the network group to access. If not given, first network_group is addressed.
Returns
All the underlying streams names for the provided vstream name.
Return type
list of str
class hailo_platform.pyhailort.pyhailort.PcieDeviceInfo(bus, device, func, domain=None)[source]
Bases: hailo_platform.pyhailort._pyhailort.PcieDeviceInfo
Represents pcie device info, includeing domain, bus, device and function.
BOARD_LOCATION_HELP_STRING = 'Board location in the format of the command: "lspci -d 1e60: | cut -d\' \' -f1" ([<domain>]:<bus>:<device>.<func>). If not specified the first board is taken.'
__init__(self: hailo_platform.pyhailort._pyhailort.PcieDeviceInfo) → None[source]
classmethod from_string(board_location_str)[source]
Parse pcie device info BDF from string. The format is [<domain>]:<bus>:<device>.<func>
classmethod argument_type(board_location_str)[source]
PcieDeviceInfo Argument type for argparse parsers
class hailo_platform.pyhailort.pyhailort.ConfiguredNetwork(configured_network)[source]
Bases: object
Represents a network group loaded to the device.
__init__(configured_network)[source]
get_networks_names()[source]
activate(network_group_params=None)[source]
Activate this network group in order to infer data through it.
Parameters
network_group_params (hailo_platform.pyhailort._pyhailort.ActivateNetworkGroupParams, optional) Network group activation params. If not given, default params will be applied,
Returns
Context manager that returns the activated network group.
Return type
ActivatedNetworkContextManager
Note
Usage of activate when scheduler enabled is deprecated. On this case, this function will return None and print deprecation warning.
wait_for_activation(timeout_ms=None)[source]
Block until activated, or until timeout_ms is passed.
Parameters
timeout_ms (int, optional) Timeout value in milliseconds to wait for activation. Defaults to HAILO_INFINITE.
Raises
HailoRTTimeout In case of timeout.
static create_params()[source]
Create activation params for network_group.
Returns
hailo_platform.pyhailort._pyhailort.ActivateNetworkGroupParams.
property name
get_output_shapes()[source]
get_sorted_output_names()[source]
get_input_vstream_infos(network_name=None)[source]
Get input vstreams information.
Parameters
network_name (str, optional) The name of the network to access. In case not given, all the networks in the network group will be addressed.
Returns
with all the information objects of all input vstreams
Return type
list of hailo_platform.pyhailort._pyhailort.VStreamInfo
get_output_vstream_infos(network_name=None)[source]
Get output vstreams information.
Parameters
network_name (str, optional) The name of the network to access. In case not given, all the networks in the network group will be addressed.
Returns
with all the information objects of all output vstreams
Return type
list of hailo_platform.pyhailort._pyhailort.VStreamInfo
get_all_vstream_infos(network_name=None)[source]
Get input and output vstreams information.
Parameters
network_name (str, optional) The name of the network to access. In case not given, all the networks in the network group will be addressed.
Returns
with all the information objects of all input and output vstreams
Return type
list of hailo_platform.pyhailort._pyhailort.VStreamInfo
get_input_stream_infos(network_name=None)[source]
Get the input low-level streams information of a specific network group.
Parameters
network_name (str, optional) The name of the network to access. In case not given, all the networks in the network group will be addressed.
Returns
with information objects of all input low-level streams.
Return type
List of hailo_platform.pyhailort._pyhailort.StreamInfo
get_output_stream_infos(network_name=None)[source]
Get the output low-level streams information of a specific network group.
Parameters
network_name (str, optional) The name of the network to access. In case not given, all the networks in the network group will be addressed.
Returns
with information objects of all output low-level streams.
Return type
List of hailo_platform.pyhailort._pyhailort.StreamInfo
get_all_stream_infos(network_name=None)[source]
Get input and output streams information of a specific network group.
Parameters
network_name (str, optional) The name of the network to access. In case not given, all the networks in the network group will be addressed.
Returns
with all the information objects of all input and output streams
Return type
list of hailo_platform.pyhailort._pyhailort.StreamInfo
get_udp_rates_dict(fps, max_supported_rate_bytes)[source]
get_stream_names_from_vstream_name(vstream_name)[source]
Get stream name from vstream name for a specific network group.
Parameters
vstream_name (str) The name of the vstreams.
Returns
All the underlying streams names for the provided vstream name.
Return type
list of str
get_vstream_names_from_stream_name(stream_name)[source]
Get vstream names list from their underlying stream name for a specific network group.
Parameters
stream_name (str) The underlying stream name.
Returns
All the matching vstream names for the provided stream name.
Return type
list of str
set_scheduler_timeout(timeout_ms, network_name=None)[source]
Sets the maximum time period that may pass before receiving run time from the scheduler.
This will occur providing at least one send request has been sent, there is no minimum requirement for send requests, (e.g. threshold - see ConfiguredNetwork.set_scheduler_threshold()).
Parameters
timeout_ms (int) Timeout in milliseconds.
set_scheduler_threshold(threshold)[source]
Sets the minimum number of send requests required before the network is considered ready to get run time from the scheduler.
If at least one send request has been sent, but the threshold is not reached within a set time period (e.g. timeout - see ConfiguredNetwork.set_scheduler_timeout()), the scheduler will consider the network ready regardless.
Parameters
threshold (int) Threshold in number of frames.
set_scheduler_priority(priority)[source]
Sets the priority of the network.
When the model scheduler will choose the next network, networks with higher priority will be prioritized in the selection. bigger number represent higher priority.
Parameters
priority (int) Priority as a number between HAILO_SCHEDULER_PRIORITY_MIN - HAILO_SCHEDULER_PRIORITY_MAX.
init_cache(read_offset)[source]
update_cache_offset(offset_delta_entries)[source]
get_cache_ids() → List[int][source]
read_cache_buffer(cache_id: int) → bytes[source]
write_cache_buffer(cache_id: int, buffer: bytes)[source]
class hailo_platform.pyhailort.pyhailort.ActivatedNetworkContextManager(configured_network, activated_network)[source]
Bases: object
A context manager that returns the activated network group upon enter.
__init__(configured_network, activated_network)[source]
class hailo_platform.pyhailort.pyhailort.ActivatedNetwork(configured_network, activated_network)[source]
Bases: object
The network group that is currently activated for inference.
__init__(configured_network, activated_network)[source]
get_number_of_invalid_frames(clear=True)[source]
Returns number of invalid frames.
Parameters
clear (bool) If set, the returned value will be the number of invalid frames read since the last call to this function.
Returns
Number of invalid frames.
Return type
int
validate_all_frames_are_valid()[source]
Validates that all of the frames so far are valid (no invalid frames).
class hailo_platform.pyhailort.pyhailort.FormatType
Bases: pybind11_builtins.pybind11_object
Data formats accepted by HailoRT.
Members:
AUTO : Chosen automatically to match the format expected by the device, usually UINT8.
UINT8
UINT16
FLOAT32
AUTO = <FormatType.AUTO: 0>
FLOAT32 = <FormatType.FLOAT32: 3>
UINT16 = <FormatType.UINT16: 2>
UINT8 = <FormatType.UINT8: 1>
__init__(self: hailo_platform.pyhailort._pyhailort.FormatType, value: int) → None
property name
property value
class hailo_platform.pyhailort.pyhailort.PowerMeasurementData
Bases: pybind11_builtins.pybind11_object
__init__(*args, **kwargs)
property average_time_value_milliseconds
float, Average time in milliseconds between sampels
property average_value
float, The average value of the samples that were sampled
equals(self: hailo_platform.pyhailort._pyhailort.PowerMeasurementData, arg0: hailo_platform.pyhailort._pyhailort.PowerMeasurementData) → bool
property max_value
float, The maximun value of the samples that were sampled
property min_value
float, The minimum value of the samples that were sampled
property total_number_of_samples
uint, The number of samples that were sampled
class hailo_platform.pyhailort.pyhailort.MeasurementBufferIndex
Bases: pybind11_builtins.pybind11_object
Enum-like class representing all FW buffers for power measurements storing.
Members:
MEASUREMENT_BUFFER_INDEX_0
MEASUREMENT_BUFFER_INDEX_1
MEASUREMENT_BUFFER_INDEX_2
MEASUREMENT_BUFFER_INDEX_3
MEASUREMENT_BUFFER_INDEX_0 = <MeasurementBufferIndex.MEASUREMENT_BUFFER_INDEX_0: 0>
MEASUREMENT_BUFFER_INDEX_1 = <MeasurementBufferIndex.MEASUREMENT_BUFFER_INDEX_1: 1>
MEASUREMENT_BUFFER_INDEX_2 = <MeasurementBufferIndex.MEASUREMENT_BUFFER_INDEX_2: 2>
MEASUREMENT_BUFFER_INDEX_3 = <MeasurementBufferIndex.MEASUREMENT_BUFFER_INDEX_3: 3>
__init__(self: hailo_platform.pyhailort._pyhailort.MeasurementBufferIndex, value: int) → None
property name
property value
class hailo_platform.pyhailort.pyhailort.PowerMeasurementTypes
Bases: pybind11_builtins.pybind11_object
Enum-like class representing the different power measurement types. This determines what would be measured on the device.
Members:
AUTO : Choose the default value according to the supported features.
SHUNT_VOLTAGE : Measure the shunt voltage. Unit is mV
BUS_VOLTAGE : Measure the bus voltage. Unit is mV
POWER : Measure the power. Unit is W
CURRENT : Measure the current. Unit is mA
AUTO = <PowerMeasurementTypes.AUTO: 2147483647>
BUS_VOLTAGE = <PowerMeasurementTypes.BUS_VOLTAGE: 1>
CURRENT = <PowerMeasurementTypes.CURRENT: 3>
POWER = <PowerMeasurementTypes.POWER: 2>
SHUNT_VOLTAGE = <PowerMeasurementTypes.SHUNT_VOLTAGE: 0>
__init__(self: hailo_platform.pyhailort._pyhailort.PowerMeasurementTypes, value: int) → None
property name
property value
class hailo_platform.pyhailort.pyhailort.DvmTypes
Bases: pybind11_builtins.pybind11_object
Enum-like class representing the different DVMs that can be measured. This determines the device that would be measured.
Members:
AUTO : Choose the default value according to the supported features.
VDD_CORE : Perform measurements over the core. Exists only in Hailo-8 EVB.
VDD_IO : Perform measurements over the IO. Exists only in Hailo-8 EVB.
MIPI_AVDD : Perform measurements over the MIPI avdd. Exists only in Hailo-8 EVB.
MIPI_AVDD_H : Perform measurements over the MIPI avdd_h. Exists only in Hailo-8 EVB.
USB_AVDD_IO : Perform measurements over the IO. Exists only in Hailo-8 EVB.
VDD_TOP : Perform measurements over the top. Exists only in Hailo-8 EVB.
USB_AVDD_IO_HV : Perform measurements over the USB_AVDD_IO_HV. Exists only in Hailo-8 EVB.
AVDD_H : Perform measurements over the AVDD_H. Exists only in Hailo-8 EVB.
SDIO_VDD_IO : Perform measurements over the SDIO_VDDIO. Exists only in Hailo-8 EVB.
OVERCURRENT_PROTECTION : Perform measurements over the OVERCURRENT_PROTECTION dvm. Exists only for Hailo-8 platforms supporting current monitoring (such as M.2 and mPCIe).
AUTO = <DvmTypes.AUTO: 2147483647>
AVDD_H = <DvmTypes.AVDD_H: 7>
MIPI_AVDD = <DvmTypes.MIPI_AVDD: 2>
MIPI_AVDD_H = <DvmTypes.MIPI_AVDD_H: 3>
OVERCURRENT_PROTECTION = <DvmTypes.OVERCURRENT_PROTECTION: 9>
SDIO_VDD_IO = <DvmTypes.SDIO_VDD_IO: 8>
USB_AVDD_IO = <DvmTypes.USB_AVDD_IO: 4>
USB_AVDD_IO_HV = <DvmTypes.USB_AVDD_IO_HV: 6>
VDD_CORE = <DvmTypes.VDD_CORE: 0>
VDD_IO = <DvmTypes.VDD_IO: 1>
VDD_TOP = <DvmTypes.VDD_TOP: 5>
__init__(self: hailo_platform.pyhailort._pyhailort.DvmTypes, value: int) → None
property name
property value
class hailo_platform.pyhailort.pyhailort.SamplingPeriod
Bases: pybind11_builtins.pybind11_object
Enum-like class representing all bit options and related conversion times for each bit setting for Bus Voltage and Shunt Voltage.
Members:
PERIOD_140us : The sensor provides a new sampling every 140us.
PERIOD_204us : The sensor provides a new sampling every 204us.
PERIOD_332us : The sensor provides a new sampling every 332us.
PERIOD_588us : The sensor provides a new sampling every 588us.
PERIOD_1100us : The sensor provides a new sampling every 1100us.
PERIOD_2116us : The sensor provides a new sampling every 2116us.
PERIOD_4156us : The sensor provides a new sampling every 4156us.
PERIOD_8244us : The sensor provides a new sampling every 8244us.
PERIOD_1100us = <SamplingPeriod.PERIOD_1100us: 4>
PERIOD_140us = <SamplingPeriod.PERIOD_140us: 0>
PERIOD_204us = <SamplingPeriod.PERIOD_204us: 1>
PERIOD_2116us = <SamplingPeriod.PERIOD_2116us: 5>
PERIOD_332us = <SamplingPeriod.PERIOD_332us: 2>
PERIOD_4156us = <SamplingPeriod.PERIOD_4156us: 6>
PERIOD_588us = <SamplingPeriod.PERIOD_588us: 3>
PERIOD_8244us = <SamplingPeriod.PERIOD_8244us: 7>
__init__(self: hailo_platform.pyhailort._pyhailort.SamplingPeriod, value: int) → None
property name
property value
class hailo_platform.pyhailort.pyhailort.AveragingFactor
Bases: pybind11_builtins.pybind11_object
Enum-like class representing all the AVG bit settings and related number of averages for each bit setting.
Members:
AVERAGE_1 : Each sample reflects a value of 1 sub-samples.
AVERAGE_4 : Each sample reflects a value of 4 sub-samples.
AVERAGE_16 : Each sample reflects a value of 16 sub-samples.
AVERAGE_64 : Each sample reflects a value of 64 sub-samples.
AVERAGE_128 : Each sample reflects a value of 128 sub-samples.
AVERAGE_256 : Each sample reflects a value of 256 sub-samples.
AVERAGE_512 : Each sample reflects a value of 512 sub-samples.
AVERAGE_1024 : Each sample reflects a value of 1024 sub-samples.
AVERAGE_1 = <AveragingFactor.AVERAGE_1: 0>
AVERAGE_1024 = <AveragingFactor.AVERAGE_1024: 7>
AVERAGE_128 = <AveragingFactor.AVERAGE_128: 4>
AVERAGE_16 = <AveragingFactor.AVERAGE_16: 2>
AVERAGE_256 = <AveragingFactor.AVERAGE_256: 5>
AVERAGE_4 = <AveragingFactor.AVERAGE_4: 1>
AVERAGE_512 = <AveragingFactor.AVERAGE_512: 6>
AVERAGE_64 = <AveragingFactor.AVERAGE_64: 3>
__init__(self: hailo_platform.pyhailort._pyhailort.AveragingFactor, value: int) → None
property name
property value
class hailo_platform.pyhailort.pyhailort.MipiDataTypeRx
Bases: pybind11_builtins.pybind11_object
Members:
RGB_444
RGB_555
RGB_565
RGB_666
RGB_888
RAW_6
RAW_7
RAW_8
RAW_10
RAW_12
RAW_14
RAW_10 = <MipiDataTypeRx.RAW_10: 43>
RAW_12 = <MipiDataTypeRx.RAW_12: 44>
RAW_14 = <MipiDataTypeRx.RAW_14: 45>
RAW_6 = <MipiDataTypeRx.RAW_6: 40>
RAW_7 = <MipiDataTypeRx.RAW_7: 41>
RAW_8 = <MipiDataTypeRx.RAW_8: 42>
RGB_444 = <MipiDataTypeRx.RGB_444: 32>
RGB_555 = <MipiDataTypeRx.RGB_555: 33>
RGB_565 = <MipiDataTypeRx.RGB_565: 34>
RGB_666 = <MipiDataTypeRx.RGB_666: 35>
RGB_888 = <MipiDataTypeRx.RGB_888: 36>
__init__(self: hailo_platform.pyhailort._pyhailort.MipiDataTypeRx, value: int) → None
property name
property value
class hailo_platform.pyhailort.pyhailort.MipiPixelsPerClock
Bases: pybind11_builtins.pybind11_object
Members:
PIXELS_PER_CLOCK_1
PIXELS_PER_CLOCK_2
PIXELS_PER_CLOCK_4
PIXELS_PER_CLOCK_1 = <MipiPixelsPerClock.PIXELS_PER_CLOCK_1: 0>
PIXELS_PER_CLOCK_2 = <MipiPixelsPerClock.PIXELS_PER_CLOCK_2: 1>
PIXELS_PER_CLOCK_4 = <MipiPixelsPerClock.PIXELS_PER_CLOCK_4: 2>
__init__(self: hailo_platform.pyhailort._pyhailort.MipiPixelsPerClock, value: int) → None
property name
property value
class hailo_platform.pyhailort.pyhailort.MipiClockSelection
Bases: pybind11_builtins.pybind11_object
Members:
SELECTION_80_TO_100_MBPS
SELECTION_100_TO_120_MBPS
SELECTION_120_TO_160_MBPS
SELECTION_160_TO_200_MBPS
SELECTION_200_TO_240_MBPS
SELECTION_240_TO_280_MBPS
SELECTION_280_TO_320_MBPS
SELECTION_320_TO_360_MBPS
SELECTION_360_TO_400_MBPS
SELECTION_400_TO_480_MBPS
SELECTION_480_TO_560_MBPS
SELECTION_560_TO_640_MBPS
SELECTION_640_TO_720_MBPS
SELECTION_720_TO_800_MBPS
SELECTION_800_TO_880_MBPS
SELECTION_880_TO_1040_MBPS
SELECTION_1040_TO_1200_MBPS
SELECTION_1200_TO_1350_MBPS
SELECTION_1350_TO_1500_MBPS
SELECTION_1500_TO_1750_MBPS
SELECTION_1750_TO_2000_MBPS
SELECTION_2000_TO_2250_MBPS
SELECTION_2250_TO_2500_MBPS
SELECTION_AUTOMATIC
SELECTION_100_TO_120_MBPS = <MipiClockSelection.SELECTION_100_TO_120_MBPS: 1>
SELECTION_1040_TO_1200_MBPS = <MipiClockSelection.SELECTION_1040_TO_1200_MBPS: 16>
SELECTION_1200_TO_1350_MBPS = <MipiClockSelection.SELECTION_1200_TO_1350_MBPS: 17>
SELECTION_120_TO_160_MBPS = <MipiClockSelection.SELECTION_120_TO_160_MBPS: 2>
SELECTION_1350_TO_1500_MBPS = <MipiClockSelection.SELECTION_1350_TO_1500_MBPS: 18>
SELECTION_1500_TO_1750_MBPS = <MipiClockSelection.SELECTION_1500_TO_1750_MBPS: 19>
SELECTION_160_TO_200_MBPS = <MipiClockSelection.SELECTION_160_TO_200_MBPS: 3>
SELECTION_1750_TO_2000_MBPS = <MipiClockSelection.SELECTION_1750_TO_2000_MBPS: 20>
SELECTION_2000_TO_2250_MBPS = <MipiClockSelection.SELECTION_2000_TO_2250_MBPS: 21>
SELECTION_200_TO_240_MBPS = <MipiClockSelection.SELECTION_200_TO_240_MBPS: 4>
SELECTION_2250_TO_2500_MBPS = <MipiClockSelection.SELECTION_2250_TO_2500_MBPS: 22>
SELECTION_240_TO_280_MBPS = <MipiClockSelection.SELECTION_240_TO_280_MBPS: 5>
SELECTION_280_TO_320_MBPS = <MipiClockSelection.SELECTION_280_TO_320_MBPS: 6>
SELECTION_320_TO_360_MBPS = <MipiClockSelection.SELECTION_320_TO_360_MBPS: 7>
SELECTION_360_TO_400_MBPS = <MipiClockSelection.SELECTION_360_TO_400_MBPS: 8>
SELECTION_400_TO_480_MBPS = <MipiClockSelection.SELECTION_400_TO_480_MBPS: 9>
SELECTION_480_TO_560_MBPS = <MipiClockSelection.SELECTION_480_TO_560_MBPS: 10>
SELECTION_560_TO_640_MBPS = <MipiClockSelection.SELECTION_560_TO_640_MBPS: 11>
SELECTION_640_TO_720_MBPS = <MipiClockSelection.SELECTION_640_TO_720_MBPS: 12>
SELECTION_720_TO_800_MBPS = <MipiClockSelection.SELECTION_720_TO_800_MBPS: 13>
SELECTION_800_TO_880_MBPS = <MipiClockSelection.SELECTION_800_TO_880_MBPS: 14>
SELECTION_80_TO_100_MBPS = <MipiClockSelection.SELECTION_80_TO_100_MBPS: 0>
SELECTION_880_TO_1040_MBPS = <MipiClockSelection.SELECTION_880_TO_1040_MBPS: 15>
SELECTION_AUTOMATIC = <MipiClockSelection.SELECTION_AUTOMATIC: 63>
__init__(self: hailo_platform.pyhailort._pyhailort.MipiClockSelection, value: int) → None
property name
property value
class hailo_platform.pyhailort.pyhailort.MipiIspImageInOrder
Bases: pybind11_builtins.pybind11_object
Members:
B_FIRST
GB_FIRST
GR_FIRST
R_FIRST
B_FIRST = <MipiIspImageInOrder.B_FIRST: 0>
GB_FIRST = <MipiIspImageInOrder.GB_FIRST: 1>
GR_FIRST = <MipiIspImageInOrder.GR_FIRST: 2>
R_FIRST = <MipiIspImageInOrder.R_FIRST: 3>
__init__(self: hailo_platform.pyhailort._pyhailort.MipiIspImageInOrder, value: int) → None
property name
property value
class hailo_platform.pyhailort.pyhailort.MipiIspImageOutDataType
Bases: pybind11_builtins.pybind11_object
Members:
RGB_888
YUV_422
RGB_888 = <MipiIspImageOutDataType.RGB_888: 36>
YUV_422 = <MipiIspImageOutDataType.YUV_422: 30>
__init__(self: hailo_platform.pyhailort._pyhailort.MipiIspImageOutDataType, value: int) → None
property name
property value
class hailo_platform.pyhailort.pyhailort.IspLightFrequency
Bases: pybind11_builtins.pybind11_object
Members:
LIGHT_FREQ_60_HZ
LIGHT_FREQ_50_HZ
LIGHT_FREQ_50_HZ = <IspLightFrequency.LIGHT_FREQ_50_HZ: 1>
LIGHT_FREQ_60_HZ = <IspLightFrequency.LIGHT_FREQ_60_HZ: 0>
__init__(self: hailo_platform.pyhailort._pyhailort.IspLightFrequency, value: int) → None
property name
property value
class hailo_platform.pyhailort.pyhailort.Endianness
Bases: pybind11_builtins.pybind11_object
Members:
BIG_ENDIAN
LITTLE_ENDIAN
BIG_ENDIAN = <Endianness.BIG_ENDIAN: 0>
LITTLE_ENDIAN = <Endianness.LITTLE_ENDIAN: 1>
__init__(self: hailo_platform.pyhailort._pyhailort.Endianness, value: int) → None
property name
property value
class hailo_platform.pyhailort.pyhailort.InputVStreamParams[source]
Bases: object
Parameters of an input virtual stream (host to device).
static make(configured_network, quantized=None, format_type=None, timeout_ms=None, queue_size=None, network_name=None)[source]
Create input virtual stream params from a configured network group. These params determine the format of the data that will be fed into the network group.
Parameters
configured_network (ConfiguredNetwork) The configured network group for which the params are created.
quantized Unused.
format_type (FormatType) The default format type of the data for all input virtual streams. The default is AUTO, which means the data is fed in the same format expected by the device (usually uint8).
timeout_ms (int) The default timeout in milliseconds for all input virtual streams. Defaults to DEFAULT_VSTREAM_TIMEOUT_MS. In case of timeout, HailoRTTimeout will be raised.
queue_size (int) The pipeline queue size. Defaults to DEFAULT_VSTREAM_QUEUE_SIZE.
network_name (str) Network name of the requested virtual stream params. If not passed, all the networks in the network group will be addressed.
Returns
The created virtual streams params. The keys are the vstreams names. The values are the params.
Return type
dict
static make_from_network_group(configured_network, quantized=None, format_type=None, timeout_ms=None, queue_size=None, network_name=None)[source]
Create input virtual stream params from a configured network group. These params determine the format of the data that will be fed into the network group.
Parameters
configured_network (ConfiguredNetwork) The configured network group for which the params are created.
quantized Unused.
format_type (FormatType) The default format type of the data for all input virtual streams. The default is AUTO, which means the data is fed in the same format expected by the device (usually uint8).
timeout_ms (int) The default timeout in milliseconds for all input virtual streams. Defaults to DEFAULT_VSTREAM_TIMEOUT_MS. In case of timeout, HailoRTTimeout will be raised.
queue_size (int) The pipeline queue size. Defaults to DEFAULT_VSTREAM_QUEUE_SIZE.
network_name (str) Network name of the requested virtual stream params. If not passed, all the networks in the network group will be addressed.
Returns
The created virtual streams params. The keys are the vstreams names. The values are the params.
Return type
dict
class hailo_platform.pyhailort.pyhailort.OutputVStreamParams[source]
Bases: object
Parameters of an output virtual stream (device to host).
static make(configured_network, quantized=None, format_type=None, timeout_ms=None, queue_size=None, network_name=None)[source]
Create output virtual stream params from a configured network group. These params determine the format of the data that will be returned from the network group.
Parameters
configured_network (ConfiguredNetwork) The configured network group for which the params are created.
quantized Unused.
format_type (FormatType) The default format type of the data for all output virtual streams. The default is AUTO, which means the returned data is in the same format returned from the device (usually uint8).
timeout_ms (int) The default timeout in milliseconds for all output virtual streams. Defaults to DEFAULT_VSTREAM_TIMEOUT_MS. In case of timeout, HailoRTTimeout will be raised.
queue_size (int) The pipeline queue size. Defaults to DEFAULT_VSTREAM_QUEUE_SIZE.
network_name (str) Network name of the requested virtual stream params. If not passed, all the networks in the network group will be addressed.
Returns
The created virtual streams params. The keys are the vstreams names. The values are the params.
Return type
dict
static make_from_network_group(configured_network, quantized=None, format_type=None, timeout_ms=None, queue_size=None, network_name=None)[source]
Create output virtual stream params from a configured network group. These params determine the format of the data that will be returned from the network group.
Parameters
configured_network (ConfiguredNetwork) The configured network group for which the params are created.
quantized Unused.
format_type (FormatType) The default format type of the data for all output virtual streams. The default is AUTO, which means the returned data is in the same format returned from the device (usually uint8).
timeout_ms (int) The default timeout in milliseconds for all output virtual streams. Defaults to DEFAULT_VSTREAM_TIMEOUT_MS. In case of timeout, HailoRTTimeout will be raised.
queue_size (int) The pipeline queue size. Defaults to DEFAULT_VSTREAM_QUEUE_SIZE.
network_name (str) Network name of the requested virtual stream params. If not passed, all the networks in the network group will be addressed.
Returns
The created virtual streams params. The keys are the vstreams names. The values are the params.
Return type
dict
static make_groups(configured_network, quantized=None, format_type=None, timeout_ms=None, queue_size=None)[source]
Create output virtual stream params from a configured network group. These params determine the format of the data that will be returned from the network group. The params groups are splitted with respect to their underlying streams for multi process usges.
Parameters
configured_network (ConfiguredNetwork) The configured network group for which the params are created.
quantized Unused.
format_type (FormatType) The default format type of the data for all output virtual streams. The default is AUTO, which means the returned data is in the same format returned from the device (usually uint8).
timeout_ms (int) The default timeout in milliseconds for all output virtual streams. Defaults to DEFAULT_VSTREAM_TIMEOUT_MS. In case of timeout, HailoRTTimeout will be raised.
queue_size (int) The pipeline queue size. Defaults to DEFAULT_VSTREAM_QUEUE_SIZE.
Returns
Each element in the list represent a group of params, where the keys are the vstreams names, and the values are the params. The params groups are splitted with respect to their underlying streams for multi process usges.
Return type
list of dicts
class hailo_platform.pyhailort.pyhailort.InputVStreams(configured_network, input_vstreams_params)[source]
Bases: object
Input vstreams pipelines that allows to send data, to be used as a context manager.
__init__(configured_network, input_vstreams_params)[source]
Constructor for the InputVStreams class.
Parameters
configured_network (ConfiguredNetwork) The configured network group for which the pipeline is created.
input_vstreams_params (dict from str to InputVStreamParams) Params for the input vstreams in the pipeline.
get(name=None)[source]
Return a single input vstream by its name.
Parameters
name (str) The vstream name. If name=None and there is a single input vstream, that single (InputVStream) will be returned. Otherwise, if name=None and there are multiple input vstreams, an exception will be thrown.
Returns
The (InputVStream) that corresponds to the given name.
Return type
InputVStream
clear()[source]
Clears the vstreams pipeline buffers.
class hailo_platform.pyhailort.pyhailort.OutputVStreams(configured_network, output_vstreams_params, tf_nms_format=False)[source]
Bases: object
Output virtual streams pipelines that allows to receive data, to be used as a context manager.
__init__(configured_network, output_vstreams_params, tf_nms_format=False)[source]
Constructor for the OutputVStreams class.
Parameters
configured_network (ConfiguredNetwork) The configured network group for which the pipeline is created.
output_vstreams_params (dict from str to OutputVStreamParams) Params for the output vstreams in the pipeline.
tf_nms_format (bool, optional)
indicates whether the returned nms outputs should be in Hailo format or TensorFlow format. Default is False (using Hailo format).
Hailo format list of numpy.ndarray. Each element represents th detections (bboxes) for the class, and its shape is [number_of_detections, BBOX_PARAMS]
TensorFlow format numpy.ndarray of shape [class_count, BBOX_PARAMS, detections_count] padded with empty bboxes.
get(name=None)[source]
Return a single output vstream by its name.
Parameters
name (str) The vstream name. If name=None and there is a single output vstream, that single (OutputVStream) will be returned. Otherwise, if name=None and there are multiple output vstreams, an exception will be thrown.
Returns
The (OutputVStream) that corresponds to the given name.
Return type
OutputVStream
clear()[source]
Clears the vstreams pipeline buffers.
class hailo_platform.pyhailort.pyhailort.InputVStream(send_object)[source]
Bases: object
Represents a single virtual stream in the host to device direction.
__init__(send_object)[source]
property shape
property dtype
property name
property network_name
send(input_data)[source]
Send frames to inference.
Parameters
input_data (numpy.ndarray) Data to run inference on.
flush()[source]
Blocks until there are no buffers in the input VStream pipeline.
property info
class hailo_platform.pyhailort.pyhailort.OutputVStream(configured_network, recv_object, name, tf_nms_format=False, net_group_name='')[source]
Bases: object
Represents a single output virtual stream in the device to host direction.
__init__(configured_network, recv_object, name, tf_nms_format=False, net_group_name='')[source]
property output_order
property shape
property dtype
property name
property network_name
recv()[source]
Receive frames after inference.
Returns
The output of the inference for a single frame. The returned tensor does not include the batch dimension. In case of nms output and tf_nms_format=False, returns list of numpy.ndarray.
Return type
numpy.ndarray
property info
set_nms_score_threshold(threshold)[source]
Set NMS score threshold, used for filtering out candidates. Any box with score<TH is suppressed.
Parameters
threshold (float) NMS score threshold to set.
Note
This function will fail in cases where the output vstream has no NMS operations on the CPU.
set_nms_iou_threshold(threshold)[source]
Set NMS intersection over union overlap Threshold,
used in the NMS iterative elimination process where potential duplicates of detected items are suppressed.
Parameters
threshold (float) NMS IoU threshold to set.
Note
This function will fail in cases where the output vstream has no NMS operations on the CPU.
set_nms_max_proposals_per_class(max_proposals_per_class)[source]
Set a limit for the maximum number of boxes per class.
Parameters
max_proposals_per_class (int) NMS max proposals per class to set.
Note
This function will fail in cases where the output vstream has no NMS operations on the CPU.
set_nms_max_accumulated_mask_size(max_accumulated_mask_size)[source]
Set maximum accumulated mask size for all the detections in a frame.
Used in order to change the output buffer frame size, in cases where the output buffer is too small for all the segmentation detections.
Parameters
max_accumulated_mask_size (int) NMS max accumulated mask size.
Note
This function must be called before starting inference! This function will fail in cases where there is no output with NMS operations on the CPU.
class hailo_platform.pyhailort.pyhailort.InferVStreams(configured_net_group, input_vstreams_params, output_vstreams_params, tf_nms_format=False)[source]
Bases: object
Pipeline that allows to call blocking inference, to be used as a context manager.
__init__(configured_net_group, input_vstreams_params, output_vstreams_params, tf_nms_format=False)[source]
Constructor for the InferVStreams class.
Parameters
configured_net_group (ConfiguredNetwork) The configured network group for which the pipeline is created.
input_vstreams_params (dict from str to InputVStreamParams) Params for the input vstreams in the pipeline. Only members of this dict will take part in the inference.
output_vstreams_params (dict from str to OutputVStreamParams) Params for the output vstreams in the pipeline. Only members of this dict will take part in the inference.
tf_nms_format (bool, optional)
indicates whether the returned nms outputs should be in Hailo format or TensorFlow format. Default is False (using Hailo format).
Hailo format list of numpy.ndarray. Each element represents the detections (bboxes) for the class, and its shape is [number_of_detections, BBOX_PARAMS]
TensorFlow format numpy.ndarray of shape [class_count, BBOX_PARAMS, detections_count] padded with empty bboxes.
infer(input_data)[source]
Run inference on the hardware device.
Parameters
input_data (dict of numpy.ndarray) Where the key is the name of the input_layer, and the value is the data to run inference on.
Returns
Output tensors of all output layers. The keys are outputs names and the values are output data tensors as numpy.ndarray (or list of numpy.ndarray in case of nms output and tf_nms_format=False).
Return type
dict
get_hw_time()[source]
Get the hardware device operation time it took to run inference over the last batch.
Returns
Time in seconds.
Return type
float
get_total_time()[source]
Get the total time it took to run inference over the last batch.
Returns
Time in seconds.
Return type
float
set_nms_score_threshold(threshold)[source]
Set NMS score threshold, used for filtering out candidates. Any box with score<TH is suppressed.
Parameters
threshold (float) NMS score threshold to set.
Note
This function will fail in cases where there is no output with NMS operations on the CPU.
set_nms_iou_threshold(threshold)[source]
Set NMS intersection over union overlap Threshold,
used in the NMS iterative elimination process where potential duplicates of detected items are suppressed.
Parameters
threshold (float) NMS IoU threshold to set.
Note
This function will fail in cases where there is no output with NMS operations on the CPU.
set_nms_max_proposals_per_class(max_proposals_per_class)[source]
Set a limit for the maximum number of boxes per class.
Parameters
max_proposals_per_class (int) NMS max proposals per class to set.
Note
This function must be called before starting inference! This function will fail in cases where there is no output with NMS operations on the CPU.
set_nms_max_accumulated_mask_size(max_accumulated_mask_size)[source]
Set maximum accumulated mask size for all the detections in a frame.
Used in order to change the output buffer frame size, in cases where the output buffer is too small for all the segmentation detections.
Parameters
max_accumulated_mask_size (int) NMS max accumulated mask size.
Note
This function must be called before starting inference! This function will fail in cases where there is no output with NMS operations on the CPU.
class hailo_platform.pyhailort.pyhailort.BoardInformation(protocol_version, fw_version_major, fw_version_minor, fw_version_revision, logger_version, board_name, is_release, extended_context_switch_buffer, device_architecture, serial_number, part_number, product_name)[source]
Bases: object
__init__(protocol_version, fw_version_major, fw_version_minor, fw_version_revision, logger_version, board_name, is_release, extended_context_switch_buffer, device_architecture, serial_number, part_number, product_name)[source]
static get_hw_arch_str(device_arch)[source]
class hailo_platform.pyhailort.pyhailort.CoreInformation(fw_version_major, fw_version_minor, fw_version_revision, is_release, extended_context_switch_buffer)[source]
Bases: object
__init__(fw_version_major, fw_version_minor, fw_version_revision, is_release, extended_context_switch_buffer)[source]
class hailo_platform.pyhailort.pyhailort.ExtendedDeviceInformation(neural_network_core_clock_rate, supported_features, boot_source, lcs, soc_id, eth_mac_address, unit_level_tracking_id, soc_pm_values, gpio_mask)[source]
Bases: object
__init__(neural_network_core_clock_rate, supported_features, boot_source, lcs, soc_id, eth_mac_address, unit_level_tracking_id, soc_pm_values, gpio_mask)[source]
class hailo_platform.pyhailort.pyhailort.TemperatureInfo
Bases: pybind11_builtins.pybind11_object
__init__(*args, **kwargs)
equals(self: hailo_platform.pyhailort._pyhailort.TemperatureInfo, arg0: hailo_platform.pyhailort._pyhailort.TemperatureInfo) → bool
property sample_count
property ts0_temperature
property ts1_temperature
class hailo_platform.pyhailort.pyhailort.Control(device: hailo_platform.pyhailort._pyhailort.Device)[source]
Bases: object
The control object of this device, which implements the control API of the Hailo device. Should be used only from Device.control
WORD_SIZE = 4
__init__(device: hailo_platform.pyhailort._pyhailort.Device)[source]
property device_id
Getter for the device_id.
Returns
A string ID of the device. BDF for PCIe devices, IP address for Ethernet devices, “Integrated” for integrated nnc devices.
Return type
str
open()[source]
Initializes the resources needed for using a control device.
close()[source]
Releases the resources that were allocated for the control device.
chip_reset()[source]
Resets the device (chip reset).
nn_core_reset()[source]
Resets the nn_core.
soft_reset()[source]
reloads the device firmware (soft reset)
forced_soft_reset()[source]
reloads the device firmware (forced soft reset)
read_memory(address, data_length)[source]
Reads memory from the Hailo chip. Byte order isnt changed. The core uses little-endian byte order.
Parameters
address (int) Physical address to read from.
data_length (int) Size to read in bytes.
Returns
Memory read from the chip, each index in the list is a byte
Return type
list of str
write_memory(address, data_buffer)[source]
Write memory to Hailo chip. Byte order isnt changed. The core uses little-endian byte order.
Parameters
address (int) Physical address to write to.
data_buffer (list of str) Data to write.
power_measurement(dvm=<DvmTypes.AUTO: 2147483647>, measurement_type=<PowerMeasurementTypes.AUTO: 2147483647>)[source]
Perform a single power measurement on an Hailo chip. It works with the default settings where the sensor returns a new value every 2.2 ms without averaging the values.
Parameters
dvm (DvmTypes)
Which DVM will be measured. Default (AUTO) will be different according to the board:
Default (AUTO) for EVB is an approximation to the total power consumption of the chip in PCIe setups. It sums VDD_CORE, MIPI_AVDD and AVDD_H. Only POWER can measured with this option.
Default (AUTO) for platforms supporting current monitoring (such as M.2 and mPCIe): OVERCURRENT_PROTECTION
measurement_type (PowerMeasurementTypes): The type of the measurement.
Returns
The measured power.
For PowerMeasurementTypes:
SHUNT_VOLTAGE: Unit is mV.
BUS_VOLTAGE: Unit is mV.
POWER: Unit is W.
CURRENT: Unit is mA.
Return type
float
Note
This function can perform measurements for more than just power. For all supported measurement types, please look at PowerMeasurementTypes.
start_power_measurement(averaging_factor=<AveragingFactor.AVERAGE_256: 5>, sampling_period=<SamplingPeriod.PERIOD_1100us: 4>)[source]
Start performing a long power measurement.
Parameters
averaging_factor (AveragingFactor) Number of samples per time period, sensor configuration value.
sampling_period (SamplingPeriod) Related conversion time, sensor configuration value. The sensor samples the power every sampling_period [ms] and averages every averaging_factor samples. The sensor provides a new value every: 2 * sampling_period * averaging_factor [ms]. The firmware wakes up every delay [ms] and checks the sensor. If there is a new` value to read from the sensor, the firmware reads it. Note that the average calculated by the firmware is “average of averages”, because it averages values that have already been averaged by the sensor.
stop_power_measurement()[source]
Stop performing a long power measurement. Deletes all saved results from the firmware. Calling the function eliminates the start function settings for the averaging the samples, and returns to the default values, so the sensor will return a new value every 2.2 ms without averaging values.
set_power_measurement(buffer_index=<MeasurementBufferIndex.MEASUREMENT_BUFFER_INDEX_0: 0>, dvm=<DvmTypes.AUTO: 2147483647>, measurement_type=<PowerMeasurementTypes.AUTO: 2147483647>)[source]
Set parameters for long power measurement on an Hailo chip.
Parameters
buffer_index (MeasurementBufferIndex) Index of the buffer on the firmware the data would be saved at. Default is MEASUREMENT_BUFFER_INDEX_0
dvm (DvmTypes)
Which DVM will be measured. Default (AUTO) will be different according to the board:
Default (AUTO) for EVB is an approximation to the total power consumption of the chip in PCIe setups. It sums VDD_CORE, MIPI_AVDD and AVDD_H. Only POWER can measured with this option.
Default (AUTO) for platforms supporting current monitoring (such as M.2 and mPCIe): OVERCURRENT_PROTECTION
measurement_type (PowerMeasurementTypes): The type of the measurement.
Note
This function can perform measurements for more than just power. For all supported measurement types view PowerMeasurementTypes
get_power_measurement(buffer_index=<MeasurementBufferIndex.MEASUREMENT_BUFFER_INDEX_0: 0>, should_clear=True)[source]
Read measured power from a long power measurement
Parameters
buffer_index (MeasurementBufferIndex) Index of the buffer on the firmware the data would be saved at. Default is MEASUREMENT_BUFFER_INDEX_0
should_clear (bool) Flag indicating if the results saved at the firmware will be deleted after reading.
Returns
Object containing measurement data
For PowerMeasurementTypes:
SHUNT_VOLTAGE: Unit is mV.
BUS_VOLTAGE: Unit is mV.
POWER: Unit is W.
CURRENT: Unit is mA.
Return type
PowerMeasurementData
Note
This function can perform measurements for more than just power. For all supported measurement types view PowerMeasurementTypes.
read_user_config()[source]
Read the user configuration section as binary data.
Returns
User config as a binary buffer.
Return type
str
write_user_config(configuration)[source]
Write the user configuration.
Parameters
configuration (str) A binary representation of a Hailo device configuration.
read_board_config()[source]
Read the board configuration section as binary data.
Returns
Board config as a binary buffer.
Return type
str
write_board_config(configuration)[source]
Write the static configuration.
Parameters
configuration (str) A binary representation of a Hailo device configuration.
identify()[source]
Gets the Hailo chip identification.
Returns
BoardInformation
core_identify()[source]
Gets the Core Hailo chip identification.
Returns
CoreInformation
set_fw_logger(level, interface_mask)[source]
Configure logger level and interface of sending.
Parameters
level (FwLoggerLevel) The minimum logger level.
interface_mask (int) Output interfaces (mix of FwLoggerInterface).
set_throttling_state(should_activate)[source]
Change throttling state of temperature protection and overcurrent protection components.
In case that change throttling state of temperature protection didnt succeed, the change throttling state of overcurrent protection is executed.
Parameters
should_activate (bool) Should be true to enable or false to disable.
get_throttling_state()[source]
Get the current throttling state of temperature protection and overcurrent protection components.
If any throttling is enabled, the function return true.
Returns
true if temperature or overcurrent protection throttling is enabled, false otherwise.
Return type
bool
i2c_write(slave, register_address, data)[source]
Write data to an I2C slave.
Parameters
slave (hailo_platform.pyhailort.i2c_slaves.I2CSlave) I2C slave configuration.
register_address (int) The address of the register to which the data will be written.
data (str) The data that will be written.
i2c_read(slave, register_address, data_length)[source]
Read data from an I2C slave.
Parameters
slave (hailo_platform.pyhailort.i2c_slaves.I2CSlave) I2C slave configuration.
register_address (int) The address of the register from which the data will be read.
data_length (int) The number of bytes to read.
Returns
Data read from the I2C slave.
Return type
str
read_register(address)[source]
Read the value of a register from a given address.
Parameters
address (int) Address to read register from.
Returns
Value of the register
Return type
int
set_bit(address, bit_index)[source]
Set (turn on) a specific bit at a register from a given address.
Parameters
address (int) Address of the register to modify.
bit_index (int) Index of the bit that would be set.
reset_bit(address, bit_index)[source]
Reset (turn off) a specific bit at a register from a given address.
Parameters
address (int) Address of the register to modify.
bit_index (int) Index of the bit that would be reset.
firmware_update(firmware_binary, should_reset=True)[source]
Update firmware binary on the flash.
Parameters
firmware_binary (bytes) firmware binary stream.
should_reset (bool) Should a reset be performed after the update (to load the new firmware)
second_stage_update(second_stage_binary)[source]
Update second stage binary on the flash
Parameters
second_stage_binary (bytes) second stage binary stream.
store_sensor_config(section_index, reset_data_size, sensor_type, config_file_path, config_height=0, config_width=0, config_fps=0, config_name=None)[source]
Store sensor configuration to Hailo chip flash memory.
Parameters
section_index (int) Flash section index to write to. [0-6]
reset_data_size (int) Size of reset configuration.
sensor_type (SensorConfigTypes) Sensor type.
config_file_path (str) Sensor configuration file path.
config_height (int) Configuration resolution height.
config_width (int) Configuration resolution width.
config_fps (int) Configuration FPS.
config_name (str) Sensor configuration name.
store_isp_config(reset_config_size, isp_static_config_file_path, isp_runtime_config_file_path, config_height=0, config_width=0, config_fps=0, config_name=None)[source]
Store sensor isp configuration to Hailo chip flash memory.
Parameters
reset_config_size (int) Size of reset configuration.
isp_static_config_file_path (str) Sensor isp static configuration file path.
isp_runtime_config_file_path (str) Sensor isp runtime configuration file path.
config_height (int) Configuration resolution height.
config_width (int) Configuration resolution width.
config_fps (int) Configuration FPS.
config_name (str) Sensor configuration name.
get_sensor_sections_info()[source]
Get sensor sections info from Hailo chip flash memory.
Returns
Sensor sections info read from the chip flash memory.
sensor_set_generic_i2c_slave(slave_address, register_address_size, bus_index, should_hold_bus, endianness)[source]
Set a generic I2C slave for sensor usage.
Parameters
sequence (int) Request/response sequence.
slave_address (int) The address of the I2C slave.
register_address_size (int) The size of the offset (in bytes).
bus_index (int) The number of the bus the I2C slave is behind.
should_hold_bus (bool) Hold the bus during the read.
endianness (Endianness) Big or little endian.
set_sensor_i2c_bus_index(sensor_type, i2c_bus_index)[source]
Set the I2C bus to which the sensor of the specified type is connected.
Parameters
sensor_type (SensorConfigTypes) The sensor type.
i2c_bus_index (int) The I2C bus index of the sensor.
load_and_start_sensor(section_index)[source]
Load the configuration with I2C in the section index.
Parameters
section_index (int) Flash section index to load config from. [0-6]
reset_sensor(section_index)[source]
Reset the sensor that is related to the section index config.
Parameters
section_index (int) Flash section index to reset. [0-6]
wd_enable(cpu_id)[source]
Enable firmware watchdog.
Parameters
cpu_id (HailoCpuId) 0 for App CPU, 1 for Core CPU.
wd_disable(cpu_id)[source]
Disable firmware watchdog.
Parameters
cpu_id (HailoCpuId) 0 for App CPU, 1 for Core CPU.
wd_config(cpu_id, wd_cycles, wd_mode)[source]
Configure a firmware watchdog.
Parameters
cpu_id (HailoCpuId) 0 for App CPU, 1 for Core CPU.
wd_cycles (int) number of cycles until watchdog is triggered.
wd_mode (int) 0 - HW/SW mode, 1 - HW only mode
previous_system_state(cpu_id)[source]
Read the FW previous system state.
Parameters
cpu_id (HailoCpuId) 0 for App CPU, 1 for Core CPU.
get_chip_temperature()[source]
Returns the latest temperature measurements from the 2 internal temperature sensors of the Hailo chip.
Returns
Temperature in celsius of the 2 internal temperature sensors (TS), and a sample count (a running 16-bit counter)
Return type
TemperatureInfo
get_extended_device_information()[source]
Returns extended information about the device
Returns
Return type
ExtendedDeviceInformation
set_pause_frames(rx_pause_frames_enable)[source]
Enable/Disable Pause frames.
Parameters
rx_pause_frames_enable (bool) False for disable, True for enable.
test_chip_memories()[source]
test all chip memories using smart BIST
set_notification_callback(callback_func, notification_id, opaque)[source]
Set a callback function to be called when a notification is received.
Parameters
callback_func (function) Callback function with the parameters (device, notification, opaque). Note that throwing exceptions is not supported and will cause the program to terminate with an error!
notification_id (NotificationId) Notification ID to register the callback to.
opauqe (object) User defined data.
Note
The notifications thread is started and closed in the use_device() context, so notifications can only be received there.
remove_notification_callback(notification_id)[source]
Remove a notification callback which was already set.
Parameters
notification_id (NotificationId) Notification ID to remove the callback from.
class hailo_platform.pyhailort.pyhailort.Device(device_id=None)[source]
Bases: object
Hailo device object representation (for inference use VDevice)
classmethod scan()[source]
Scans for all devices on the system.
Returns
list of str, device ids.
__init__(device_id=None)[source]
Create the Hailo device object.
Parameters
device_id (str) Device id string, can represent several device types: [-] for pcie devices - pcie bdf (XXXX:XX:XX.X) [-] for ethernet devices - ip address (xxx.xxx.xxx.xxx)
release()[source]
Release the allocated resources of the device. This function should be called when working with the device not as context-manager.
property device_id
Getter for the device_id.
Returns
A string ID of the device. BDF for PCIe devices, IP address for Ethernet devices, “Integrated” for integrated nnc devices.
Return type
str
property control
Returns
the control object of this device, which implements the control API of the Hailo device.
Return type
Control
Attention
Use the low level control API with care.
read_log(count, cpu_id)[source]
Returns
Returns buffer with debug log data.
Parameters
count (int) bytes count to read
cpu_id (HailoCpuId) cpu id
property loaded_network_groups
Getter for the property _loaded_network_groups.
Returns
List of the the configured network groups loaded on the device.
Return type
list of ConfiguredNetwork
class hailo_platform.pyhailort.pyhailort.VDevice(params=None, *, device_ids=None)[source]
Bases: object
Hailo virtual device representation.
__init__(params=None, *, device_ids=None)[source]
Create the Hailo virtual device object.
Parameters
params (hailo_platform.pyhailort.pyhailort.VDeviceParams, optional) VDevice params, call VDevice.create_params() to get default params. Excludes device_ids.
device_ids (list of str, optional) devices ids to create VDevice from, call Device.scan() to get list of all available devices. Excludes params. Cannot be used together with device_id.
release()[source]
Release the allocated resources of the device. This function should be called when working with the device not as context-manager.
static create_params()[source]
configure(hef, configure_params_by_name={})[source]
Configures target vdevice from HEF object.
Parameters
hef (HEF) HEF to configure the vdevice from
configure_params_by_name (dict, optional) Maps between each net_group_name to configure_params. If not provided, default params will be applied
get_physical_devices()[source]
Gets the underlying physical devices.
Returns
The underlying physical devices.
Return type
list of Device
get_physical_devices_ids()[source]
Gets the physical devices ids.
Returns
The underlying physical devices infos.
Return type
list of str
create_infer_model(hef_source, name='')[source]
Creates the infer model from an hef.
Parameters
hef_source (str or bytes) The source from which the HEF object will be created. If the source type is str, it is treated as a path to an hef file. If the source type is bytes, it is treated as a buffer. Any other type will raise a ValueError.
name (str, optional) The string of the model name.
Returns
The infer model object.
Return type
InferModel
Raises
HailoRTException In case the infer model creation failed.
Note
create_infer_model must be called from the same process the VDevice is created in, otherwise an HailoRTException will be raised.
Note
as long as the InferModel object is alive, the VDevice object is alive as well.
property loaded_network_groups
Getter for the property _loaded_network_groups.
Returns
List of the the configured network groups loaded on the device.
Return type
list of ConfiguredNetwork
class hailo_platform.pyhailort.pyhailort.InferModel(infer_model, hef_path)[source]
Bases: object
Contains all of the necessary information for configuring the network for inference. This class is used to set up the model for inference and includes methods for setting and getting the models parameters. By calling the configure function, the user can create a ConfiguredInferModel object, which is used to run inference.
class InferStream(infer_stream)[source]
Bases: object
Represents the parameters of a stream. In default, the streams parameters are set to the default values of the model. The user can change the streams parameters by calling the setter functions.
__init__(infer_stream)[source]
property name
Returns: name (str): the name of the edge.
property shape
Returns: shape (list[int]): the shape of the edge.
property format
Returns: format (_pyhailort.hailo_format_t): the format of the edge.
set_format_type(type)[source]
Set the format type of the stream.
Parameters
type (_pyhailort.hailo_format_type_t) the format type
set_format_order(order)[source]
Set the format order of the stream.
Parameters
order (_pyhailort.hailo_format_order_t) the format order
property quant_infos
Returns: quant_infos (list[_pyhailort.hailo_quant_info_t]): List of the quantization information of the edge.
property is_nms
Returns: is_nms (bool): whether the stream is NMS.
set_nms_score_threshold(threshold)[source]
Set NMS score threshold, used for filtering out candidates. Any box with score<TH is suppressed.
Parameters
threshold (float) NMS score threshold to set.
Note
This function is invalid in cases where the edge has no NMS operations on the CPU. It will not fail, but make the configure() function fail.
set_nms_iou_threshold(threshold)[source]
Set NMS intersection over union overlap Threshold, used in the NMS iterative elimination process where potential duplicates of detected items are suppressed.
Parameters
threshold (float) NMS IoU threshold to set.
Note
This function is invalid in cases where the edge has no NMS operations on the CPU. It will not fail, but make the configure() function fail.
set_nms_max_proposals_per_class(max_proposals)[source]
Set a limit for the maximum number of boxes per class.
Parameters
max_proposals (int) NMS max proposals per class to set.
Note
This function is invalid in cases where the edge has no NMS operations on the CPU. It will not fail, but make the configure() function fail.
set_nms_max_accumulated_mask_size(max_accumulated_mask_size)[source]
Set maximum accumulated mask size for all the detections in a frame.
Parameters
max_accumalated_mask_size (int) NMS max accumulated mask size.
Note
Used in order to change the output buffer frame size in cases where the output buffer is too small for all the segmentation detections.
Note
This function is invalid in cases where the edge has no NMS operations on the CPU. It will not fail, but make the configure() function fail.
__init__(infer_model, hef_path)[source]
property hef
Returns: HEF: the HEF object of the model
set_batch_size(batch_size)[source]
Sets the batch size of the InferModel. This parameter determines the number of frames to be sent for inference in a single batch. If a scheduler is enabled, this parameter determines the burst size: the max number of frames after which the scheduler will attempt to switch to another model.
Note
The default value is HAILO_DEFAULT_BATCH_SIZE - which means the batch is determined by HailoRT automatically.
Parameters
batch_size (int) The new batch size to be set.
set_power_mode(power_mode)[source]
Sets the power mode of the InferModel
Parameters
power_mode (_pyhailort.hailo_power_mode_t) The power mode to set.
configure()[source]
Configures the InferModel object. Also checks the validity of the configurations formats.
Returns
The configured InferModel object.
Return type
configured_infer_model (ConfiguredInferModel)
Raises
HailoRTException In case the configuration is invalid (example: see InferStream.set_nms_iou_threshold()).
Note
A ConfiguredInferModel should be used inside a context manager, and should not be passed to a different process.
property input_names
Returns: names (list[str]): The input names of the InferModel.
property output_names
Returns: names (list[str]): The output names of the InferModel.
property inputs
Returns: inputs (list[InferStream]): List of input InferModel.InferStream.
property outputs
Returns: outputs (list[InferStream]): List of output InferModel.InferStream.
input(name='')[source]
Gets an inputs InferModel.InferStream.
Parameters
name (str, optional) the name of the input stream. Required in case of multiple inputs.
Returns
ConfiguredInferModel.Bindings.InferStream - the input infer stream of the configured infer model.
Raises
HailoRTNotFoundException
but multiple inputs exist.
output(name='')[source]
Gets an outputs InferModel.InferStream.
Parameters
name (str, optional) the name of the output stream. Required in case of multiple outputs.
Returns
ConfiguredInferModel.Bindings.InferStream - the output infer stream of the configured infer model.
Raises
HailoRTNotFoundException
but multiple outputs exist.
class hailo_platform.pyhailort.pyhailort.ConfiguredInferModel(configured_infer_model, infer_model)[source]
Bases: object
Configured InferModel that can be used to perform an asynchronous inference.
Note
Passing an instance of ConfiguredInferModel to a different process is not supported and would lead to an undefined behavior.
class NmsTransformationInfo(format_order: hailo_platform.pyhailort._pyhailort.FormatOrder, input_height: int, input_width: int, number_of_classes: int, max_bboxes_per_class: int, quant_info: hailo_platform.pyhailort._pyhailort.QuantInfo, output_dtype: numpy.dtype = dtype('float32'))[source]
Bases: object
class for NMS transformation info.
format_order: hailo_platform.pyhailort._pyhailort.FormatOrder
input_height: int
input_width: int
number_of_classes: int
max_bboxes_per_class: int
quant_info: hailo_platform.pyhailort._pyhailort.QuantInfo
output_dtype: numpy.dtype = dtype('float32')
__init__(format_order: hailo_platform.pyhailort._pyhailort.FormatOrder, input_height: int, input_width: int, number_of_classes: int, max_bboxes_per_class: int, quant_info: hailo_platform.pyhailort._pyhailort.QuantInfo, output_dtype: numpy.dtype = dtype('float32')) → None
class NmsHailoTransformationInfo(format_order: hailo_platform.pyhailort._pyhailort.FormatOrder, input_height: int, input_width: int, number_of_classes: int, max_bboxes_per_class: int, quant_info: hailo_platform.pyhailort._pyhailort.QuantInfo, output_dtype: numpy.dtype = dtype('float32'), use_tf_nms_format: bool = False)[source]
Bases: hailo_platform.pyhailort.pyhailort.ConfiguredInferModel.NmsTransformationInfo
class for NMS transformation info when using hailo format
use_tf_nms_format: bool = False
__init__(format_order: hailo_platform.pyhailort._pyhailort.FormatOrder, input_height: int, input_width: int, number_of_classes: int, max_bboxes_per_class: int, quant_info: hailo_platform.pyhailort._pyhailort.QuantInfo, output_dtype: numpy.dtype = dtype('float32'), use_tf_nms_format: bool = False) → None
class NmsTfTransformationInfo(format_order: hailo_platform.pyhailort._pyhailort.FormatOrder, input_height: int, input_width: int, number_of_classes: int, max_bboxes_per_class: int, quant_info: hailo_platform.pyhailort._pyhailort.QuantInfo, output_dtype: numpy.dtype = dtype('float32'), use_tf_nms_format: bool = True)[source]
Bases: hailo_platform.pyhailort.pyhailort.ConfiguredInferModel.NmsTransformationInfo
class for NMS transformation info when using tf format
use_tf_nms_format: bool = True
__init__(format_order: hailo_platform.pyhailort._pyhailort.FormatOrder, input_height: int, input_width: int, number_of_classes: int, max_bboxes_per_class: int, quant_info: hailo_platform.pyhailort._pyhailort.QuantInfo, output_dtype: numpy.dtype = dtype('float32'), use_tf_nms_format: bool = True) → None
class Bindings(bindings, input_names, output_names, nms_infos)[source]
Bases: object
Represents an asynchronous infer request - holds the input and output buffers of the request. A request represents a single frame.
class InferStream(infer_stream, nms_info=None)[source]
Bases: object
Holds the input and output buffers of the Bindings infer request
__init__(infer_stream, nms_info=None)[source]
set_buffer(buffer)[source]
Sets the edges buffer to a new one.
Parameters
buffer (numpy.array) The new buffer to set. The arrays shape should match the edges shape.
get_buffer(tf_format=False)[source]
Gets the edges buffer.
Parameters
tf_format (bool, optional)
Whether the output format is tf or hailo. Relevant for NMS outputs. The output can be re-formatted into two formats (TF, Hailo) and the user through choosing the True/False function parameter, can decide which format to receive. Does not support format order HAILO_NMS_BY_SCORE.
For detection outputs: TF format is an numpy.array with shape [number of classes, bounding box params, max bounding boxes per class] where the 2nd dimension (bounding box params) is of a fixed length of 5 (y_min, x_min, y_max, x_max, score).
hailo HAILO_NMS_BY_CLASS format is a list of numpy.array where each array represents the detections for a specific class: [cls0_detections, cls1_detections, …]. The length of the list is the number of classes. Each numpy.array shape is (number of detections, bounding box params) where the 2nd dimension (bounding box params) is of a fixed length of 5 (y_min, x_min, y_max, x_max, score).
hailo HAILO_NMS_BY_SCORE format is a list of detections where each detection is an Detection object. The detections are sorted decreasingly by score.
For segmentation outputs: TF format is an numpy.array with shape [1, image_size + number_of_params, max bounding boxes per class] where the 2nd dimension (image_size + number_of_params) is calculated as: mask (image_width * image_height) + (y_min, x_min, y_max, x_max, score, class_id). The mask is a binary mask of the segmentation output where the ROI (region of interest) is mapped to 1 and the background is mapped to 0.
Hailo format is a list of detections: [detecion0, detection1, … detection_m] where each detection is an DetectionWithByteMask. The detections are sorted decreasingly by score.
Returns
the buffer of the edge.
Return type
buffer (numpy.array)
__init__(bindings, input_names, output_names, nms_infos)[source]
input(name='')[source]
Gets an inputs InferStream object.
Parameters
name (str, optional) the name of the input stream. Required in case of multiple inputs.
Returns
ConfiguredInferModel.Bindings.InferStream - the input infer stream of the configured infer model.
Raises
HailoRTNotFoundException
but multiple inputs exist.
output(name='')[source]
Gets an outputs InferStream object.
Parameters
name (str, optional) the name of the output stream. Required in cae of multiple outputs.
Returns
ConfiguredInferModel.Bindings.InferStream - the output infer stream of the configured infer model.
Raises
HailoRTNotFoundException
but multiple outputs exist.
get()[source]
Gets the internal bindings object.
Returns
the internal bindings object.
Return type
_bindings (_pyhailort.ConfiguredInferModelBindingsWrapper)
__init__(configured_infer_model, infer_model)[source]
activate()[source]
Activates hailo device inner-resources for inference. Calling this function is invalid in case scheduler is enabled.
Raises
HailoRTException
deactivate()[source]
Deactivates hailo device inner-resources for inference. Calling this function is invalid in case scheduler is enabled.
Raises
HailoRTException
create_bindings(input_buffers=None, output_buffers=None)[source]
Creates a Bindings object.
Parameters
(dict[str (output_buffers) numpy.array], optional): The input buffers for the Bindings object. Keys are the input names, and values are their corresponding buffers. See get_buffer() for more information.
(dict[str numpy.array], optional): The output buffers for the Bindings object. Keys are the output names, and values are their corresponding buffers. See get_buffer() for more information.
Returns
Bindings object
Return type
ConfiguredInferModel.Bindings
Raises
HailoRTException
wait_for_async_ready(timeout_ms=1000, frames_count=1)[source]
The readiness of the model to launch is determined by the ability to push buffers to the asynchronous inference pipeline. If the model is ready, the method will return immediately. If the model is not ready, the method will wait for the model to be ready.
Parameters
timeout_ms (int, optional) Max amount of time to wait until the model is ready in milliseconds. Defaults to 1000
frames_count (int, optional) The number of buffers you intend to infer in the next request. Useful for batch inference. Defaults to 1
Note: Calling this function with frames_count greater than ConfiguredInferModel.get_async_queue_size() will timeout.
Raises
HailoRTTimeout
HailoRTException
run(bindings, timeout)[source]
Launches a synchronous inference operation with the provided bindings.
Parameters
bindings (list of) The bindings for the inputs and outputs of the model. A list with a single binding is valid. Multiple bindings are useful for batch inference.
timeout (int) The timeout in milliseconds.
Raises
HailoRTException
HailoRTTimeout
run_async(bindings, callback=None)[source]
Launches an asynchronous inference operation with the provided bindings.
Parameters
bindings (list of) The bindings for the inputs and outputs of the model. A list with a single binding is valid. Multiple bindings are useful for batch inference.
callback (Callable, optional) A callback that will be called upon completion of the asynchronous inference operation. The function will be called with an info argument (AsyncInferCompletionInfo) holding the information about the async job. If the async job was unsuccessful, the info parameter will hold an exception method that will raise an exception. The callback must accept a completion_info keyword argument
Note
As a standard, callbacks should be executed as quickly as possible. In case of an error, the pipeline will be shut down.
Note
To ensure the inference pipeline can handle new buffers, it is recommended to first call
ConfiguredInferModel.wait_for_async_ready().
Returns
The async inference job object.
Return type
AsyncInferJob
Raises
HailoRTException
set_scheduler_timeout(timeout_ms)[source]
Sets the minimum number of send requests required before the network is considered ready to get run time from the scheduler. Sets the maximum time period that may pass before receiving run time from the scheduler. This will occur providing at least one send request has been sent, there is no minimum requirement for send requests, (e.g. threshold - see ConfiguredInferModel.set_scheduler_threshold()).
The new time period will be measured after the previous time the scheduler allocated run time to this network group. Using this function is only allowed when scheduling_algorithm is not HAILO_SCHEDULING_ALGORITHM_NONE. The default timeout is 0ms.
Parameters
timeout_ms (int) The maximum time to wait for the scheduler to provide run time, in milliseconds.
Raises
HailoRTException
set_scheduler_threshold(threshold)[source]
Sets the minimum number of send requests required before the network is considered ready to get run time from the scheduler.
Parameters
threshold (int) Threshold in number of frames.
Using this function is only allowed when scheduling_algorithm is not HAILO_SCHEDULING_ALGORITHM_NONE. The default threshold is 1. If at least one send request has been sent, but the threshold is not reached within a set time period (e.g. timeout - see ConfiguredInferModel.set_scheduler_timeout()), the scheduler will consider the network ready regardless.
Raises
HailoRTException
set_scheduler_priority(priority)[source]
Sets the priority of the network. When the network group scheduler will choose the next network, networks with higher priority will be prioritized in the selection. bigger number represent higher priority.
Using this function is only allowed when scheduling_algorithm is not HAILO_SCHEDULING_ALGORITHM_NONE. The default priority is HAILO_SCHEDULER_PRIORITY_NORMAL.
Parameters
priority (int) Priority as a number between HAILO_SCHEDULER_PRIORITY_MIN - HAILO_SCHEDULER_PRIORITY_MAX.
Raises
HailoRTException
get_async_queue_size()[source]
Returns Expected of a the number of inferences that can be queued simultaneously for execution.
Returns
the number of inferences that can be queued simultaneously for execution
Return type
size (int)
Raises
HailoRTException
shutdown()[source]
Shuts the inference down. After calling this method, the model is no longer usable.
class hailo_platform.pyhailort.pyhailort.AsyncInferJob(job)[source]
Bases: object
Hailo Asynchronous Inference Job Wrapper. It holds the result of the inference job (once ready), and provides an async poll method to check the job status.
MILLISECOND = 0.001
__init__(job)[source]
wait(timeout_ms)[source]
Waits for the asynchronous inference job to finish. If the async job and its callback have not completed within the given timeout, a HailoRTTimeout exception will be raised.
Parameters
timeout_ms (int) timeout The maximum time to wait.
Raises
HailoRTTimeout
class hailo_platform.pyhailort.pyhailort.AsyncInferCompletionInfo(exception)[source]
Bases: object
Holds information about the async infer job
__init__(exception)[source]
Parameters
exception (HailoRTException) an exception corresponding to the error that happened inside the async infer job.
property exception
Returns the exception that was set on this Infer job. if the job finished succesfully, returns None.
class hailo_platform.pyhailort.pyhailort.HailoRTTransformUtils[source]
Bases: object
static get_dtype(data_bytes)[source]
Get data type from the number of bytes.
static dequantize_output_buffer(src_buffer, dst_buffer, elements_count, quant_info)[source]
De-quantize the data in input buffer src_buffer and output it to the buffer dst_buffer
Parameters
src_buffer (numpy.ndarray) The input buffer containing the data to be de-quantized. The buffers data type is the source data type.
dst_buffer (numpy.ndarray) The buffer that will contain the de-quantized data. The buffers data type is the destination data type.
elements_count (int) The number of elements to de-quantize. This number must not exceed src_buffer or dst_buffer sizes.
quant_info (QuantInfo) The quantization info.
static dequantize_output_buffer_in_place(raw_buffer, dst_dtype, elements_count, quant_info)[source]
De-quantize the output buffer raw_buffer to data type dst_dtype.
Parameters
raw_buffer (numpy.ndarray) The output buffer to be de-quantized. The buffers data type is the source data type.
dst_dtype (numpy.dtype) The data type to de-quantize raw_buffer to.
elements_count (int) The number of elements to de-quantize. This number must not exceed raw_buffer size.
quant_info (QuantInfo) The quantization info.
static quantize_input_buffer(src_buffer, dst_buffer, elements_count, quant_info)[source]
Quantize the data in input buffer src_buffer and output it to the buffer dst_buffer
Parameters
src_buffer (numpy.ndarray) The input buffer containing the data to be quantized. The buffers data type is the source data type.
dst_buffer (numpy.ndarray) The buffer that will contain the quantized data. The buffers data type is the destination data type.
elements_count (int) The number of elements to quantize. This number must not exceed src_buffer or dst_buffer sizes.
quant_info (QuantInfo) The quantization info.