Class NNArchive

Class Documentation

class NNArchive

Public Functions

NNArchive(const std::filesystem::path &archivePath, NNArchiveOptions options = {})

Construct a new NNArchive object - a container holding a model and its configuration.

Parameters:
  • archivePath – Path to the archive file

  • options – Archive options such as compression, number of shaves, etc. See NNArchiveOptions.

std::optional<OpenVINO::Blob> getBlob() const

Return a SuperVINO::Blob from the archive if getModelType() returns BLOB, nothing otherwise.

Returns:

std::optional<OpenVINO::Blob>: Model blob

std::optional<OpenVINO::SuperBlob> getSuperBlob() const

Return a SuperVINO::SuperBlob from the archive if getModelType() returns SUPERBLOB, nothing otherwise.

Returns:

std::optional<OpenVINO::SuperBlob>: Model superblob

std::optional<std::filesystem::path> getModelPath() const

Return a path to the model inside the archive if getModelType() returns OTHER or DLC, nothing otherwise.

Returns:

std::optional<Path>: Model path

const NNArchiveVersionedConfig &getVersionedConfig() const

Get NNArchive config wrapper.

Returns:

NNArchiveVersionedConfig: Archive config

std::optional<std::pair<uint32_t, uint32_t>> getInputSize(uint32_t index = 0) const

Get inputSize of the model.

Note

this function is only valid for models with NCHW and NHWC input formats

Parameters:

index – Index of input

Returns:

std::vector<std::pair<int, int>>: inputSize

std::optional<uint32_t> getInputWidth(uint32_t index = 0) const

Get inputWidth of the model.

Parameters:

index – Index of input

Returns:

int: inputWidth

std::optional<uint32_t> getInputHeight(uint32_t index = 0) const

Get inputHeight of the model.

Parameters:

index – Index of input

Returns:

int: inputHeight

std::vector<dai::Platform> getSupportedPlatforms() const

Get supported platforms.

Returns:

std::vector<dai::Platform>: Supported platforms

template<typename T>
inline const T &getConfig() const

Get NNArchive config.

Template Parameters:

T – Type of config to get

Returns:

const T&: Config

model::ModelType getModelType() const

Get type of model contained in NNArchive.

Returns:

model::ModelType: type of model in archive