#include <NNData.hpp>
Public Member Functions | |
std::vector< std::string > | getAllLayerNames () const |
std::vector< TensorInfo > | getAllLayers () const |
std::vector< float > | getFirstLayerFp16 () const |
std::vector< std::int32_t > | getFirstLayerInt32 () const |
std::vector< std::uint8_t > | getFirstLayerUInt8 () const |
bool | getLayer (const std::string &name, TensorInfo &tensor) const |
bool | getLayerDatatype (const std::string &name, TensorInfo::DataType &datatype) const |
std::vector< float > | getLayerFp16 (const std::string &name) const |
std::vector< std::int32_t > | getLayerInt32 (const std::string &name) const |
std::vector< std::uint8_t > | getLayerUInt8 (const std::string &name) const |
bool | hasLayer (const std::string &name) const |
NNData () | |
NNData (std::shared_ptr< RawNNData > ptr) | |
NNData & | setLayer (const std::string &name, const std::vector< int > &data) |
NNData & | setLayer (const std::string &name, std::vector< double > data) |
NNData & | setLayer (const std::string &name, std::vector< float > data) |
NNData & | setLayer (const std::string &name, std::vector< std::uint8_t > data) |
NNData & | setSequenceNum (int64_t sequenceNum) |
NNData & | setTimestamp (std::chrono::time_point< std::chrono::steady_clock, std::chrono::steady_clock::duration > timestamp) |
NNData & | setTimestampDevice (std::chrono::time_point< std::chrono::steady_clock, std::chrono::steady_clock::duration > timestamp) |
virtual | ~NNData ()=default |
![]() | |
Buffer () | |
Creates Buffer message. More... | |
Buffer (std::shared_ptr< dai::RawBuffer > ptr) | |
std::vector< std::uint8_t > & | getData () const |
Get non-owning reference to internal buffer. More... | |
int64_t | getSequenceNum () const |
std::chrono::time_point< std::chrono::steady_clock, std::chrono::steady_clock::duration > | getTimestamp () const |
std::chrono::time_point< std::chrono::steady_clock, std::chrono::steady_clock::duration > | getTimestampDevice () const |
void | setData (const std::vector< std::uint8_t > &data) |
void | setData (std::vector< std::uint8_t > &&data) |
Buffer & | setSequenceNum (int64_t sequenceNum) |
Buffer & | setTimestamp (std::chrono::time_point< std::chrono::steady_clock, std::chrono::steady_clock::duration > timestamp) |
Buffer & | setTimestampDevice (std::chrono::time_point< std::chrono::steady_clock, std::chrono::steady_clock::duration > timestamp) |
virtual | ~Buffer ()=default |
![]() | |
ADatatype (std::shared_ptr< RawBuffer > r) | |
std::shared_ptr< RawBuffer > | getRaw () const |
virtual | ~ADatatype ()=default |
Private Member Functions | |
std::shared_ptr< RawBuffer > | serialize () const override |
Private Attributes | |
std::unordered_map< std::string, std::vector< std::uint16_t > > | fp16Data |
RawNNData & | rawNn |
std::unordered_map< std::string, std::vector< std::uint8_t > > | u8Data |
Static Private Attributes | |
static constexpr int | DATA_ALIGNMENT = 64 |
Additional Inherited Members | |
![]() | |
std::shared_ptr< RawBuffer > | raw |
NNData message. Carries tensors and their metadata
Definition at line 16 of file NNData.hpp.
dai::NNData::NNData | ( | ) |
Construct NNData message.
Definition at line 14 of file NNData.cpp.
|
explicit |
Definition at line 15 of file NNData.cpp.
|
virtualdefault |
std::vector< std::string > dai::NNData::getAllLayerNames | ( | ) | const |
Definition at line 139 of file NNData.cpp.
std::vector< TensorInfo > dai::NNData::getAllLayers | ( | ) | const |
Definition at line 147 of file NNData.cpp.
std::vector< float > dai::NNData::getFirstLayerFp16 | ( | ) | const |
Convenience function to retrieve float values from first layers FP16 tensor
Definition at line 255 of file NNData.cpp.
std::vector< std::int32_t > dai::NNData::getFirstLayerInt32 | ( | ) | const |
Convenience function to retrieve INT32 values from first layers tensor
Definition at line 264 of file NNData.cpp.
std::vector< std::uint8_t > dai::NNData::getFirstLayerUInt8 | ( | ) | const |
Convenience function to retrieve U8 data from first layer
Definition at line 245 of file NNData.cpp.
bool dai::NNData::getLayer | ( | const std::string & | name, |
TensorInfo & | tensor | ||
) | const |
Retrieve layers tensor information
name | Name of the layer | |
[out] | tensor | Outputs tensor information of that layer |
Definition at line 151 of file NNData.cpp.
bool dai::NNData::getLayerDatatype | ( | const std::string & | name, |
TensorInfo::DataType & | datatype | ||
) | const |
Retrieve datatype of a layers tensor
name | Name of the layer | |
[out] | datatype | Datatype of layers tensor |
Definition at line 168 of file NNData.cpp.
std::vector< float > dai::NNData::getLayerFp16 | ( | const std::string & | name | ) | const |
Convenience function to retrieve float values from layers FP16 tensor
name | Name of the layer |
Definition at line 221 of file NNData.cpp.
std::vector< std::int32_t > dai::NNData::getLayerInt32 | ( | const std::string & | name | ) | const |
Convenience function to retrieve INT32 values from layers tensor
name | Name of the layer |
Definition at line 197 of file NNData.cpp.
std::vector< std::uint8_t > dai::NNData::getLayerUInt8 | ( | const std::string & | name | ) | const |
Convenience function to retrieve U8 data from layer
name | Name of the layer |
Definition at line 178 of file NNData.cpp.
bool dai::NNData::hasLayer | ( | const std::string & | name | ) | const |
Checks if given layer exists
name | Name of the layer |
Definition at line 161 of file NNData.cpp.
|
overrideprivatevirtual |
Reimplemented from dai::Buffer.
Definition at line 40 of file NNData.cpp.
NNData & dai::NNData::setLayer | ( | const std::string & | name, |
const std::vector< int > & | data | ||
) |
Set a layer with datatype U8. Integers are cast to bytes.
name | Name of the layer |
data | Data to store |
Definition at line 114 of file NNData.cpp.
NNData & dai::NNData::setLayer | ( | const std::string & | name, |
std::vector< double > | data | ||
) |
Set a layer with datatype FP16. Double values are converted to FP16.
name | Name of the layer |
data | Data to store |
Definition at line 130 of file NNData.cpp.
NNData & dai::NNData::setLayer | ( | const std::string & | name, |
std::vector< float > | data | ||
) |
Set a layer with datatype FP16. Float values are converted to FP16.
name | Name of the layer |
data | Data to store |
Definition at line 123 of file NNData.cpp.
NNData & dai::NNData::setLayer | ( | const std::string & | name, |
std::vector< std::uint8_t > | data | ||
) |
Set a layer with datatype U8.
name | Name of the layer |
data | Data to store |
Definition at line 110 of file NNData.cpp.
NNData & dai::NNData::setSequenceNum | ( | int64_t | sequenceNum | ) |
Retrieves image sequence number
Definition at line 281 of file NNData.cpp.
NNData & dai::NNData::setTimestamp | ( | std::chrono::time_point< std::chrono::steady_clock, std::chrono::steady_clock::duration > | timestamp | ) |
Sets image timestamp related to dai::Clock::now()
Definition at line 273 of file NNData.cpp.
NNData & dai::NNData::setTimestampDevice | ( | std::chrono::time_point< std::chrono::steady_clock, std::chrono::steady_clock::duration > | timestamp | ) |
Sets image timestamp related to dai::Clock::now()
Definition at line 277 of file NNData.cpp.
|
staticconstexprprivate |
Definition at line 17 of file NNData.hpp.
|
private |
Definition at line 25 of file NNData.hpp.
|
private |
Definition at line 19 of file NNData.hpp.
|
private |
Definition at line 23 of file NNData.hpp.