NNData
最后更新
保存和加载
NNData 消息可以使用 save() 保存到文件,并使用 load() 读取。保存的文件是二进制 protobuf 封装。有关用法,请参阅 消息 save 和 load 函数。创建 NNData
input。参考
class
dai::NNData
variable
std::vector< TensorInfo > tensors
variable
unsigned int batchSize
variable
std::optional< ImgTransformation > transformation
function
NNData()function
NNData(size_t size)function
~NNData()function
std::vector< std::string > getAllLayerNames()Returns
Names of all layers added
function
std::vector< TensorInfo > getAllLayers()Returns
All layers and their information
function
std::optional< TensorInfo > getTensorInfo(const std::string & name)Retrieve tensor information
Parameters
- name: Name of the tensor
Returns
Tensor information
function
bool getLayer(const std::string & name, TensorInfo & tensor)Retrieve layers tensor information
Parameters
- name: Name of the layer
- tensor: Outputs tensor information of that layer
Returns
True if layer exists, false otherwise
function
bool hasLayer(const std::string & name)Checks if given layer exists
Parameters
- name: Name of the layer
Returns
True if layer exists, false otherwise
function
bool getLayerDatatype(const std::string & name, TensorInfo::DataType & datatype)Retrieve datatype of a layers tensor
Parameters
- name: Name of the layer
- datatype: Datatype of layers tensor
Returns
True if layer exists, false otherwise
function
TensorInfo::DataType getTensorDatatype(const std::string & name)Get the datatype of a given tensor
Returns
TensorInfo::DataType tensor datatype
function
TensorInfo::DataType getFirstTensorDatatype()Get the datatype of the first tensor
Returns
TensorInfo::DataType tensor datatype
function
span< std::uint8_t > emplaceTensor(TensorInfo & tensor)Emplace a tensor This function allocates memory for the tensor and return over the said memory. It is up to the caller to fill the memory out with meaningful data.
Returns
Span over the allocated memory
function
void serialize(std::vector< std::uint8_t > & metadata, DatatypeEnum & datatype)inline function
DatatypeEnum getDatatype()Get the datatype of this specific message.
Returns
DatatypeEnum
function
DEPTHAI_SERIALIZE(NNData, Buffer::sequenceNum, Buffer::ts, Buffer::tsDevice, Buffer::tsSystem, tensors, batchSize, transformation)需要帮助?
请访问讨论论坛以获取技术支持或您可能有的任何其他问题。