Lens AI Profiler Cpp
Public Member Functions | Public Attributes | List of all members
ModelProfile Class Reference

Class for computing and managing various model statistics. More...

Public Member Functions

 ModelProfile (std::string model_id, std::string conf_path, int save_interval, int top_classes)
 Constructor to initialize ModelProfile object. More...
 
int log_classification_model_stats (float inference_latency, const ClassificationResults &results)
 Logs statistics for a classification model. More...
 
int log_embeddings (const std::vector< float > &embeddings)
 Logs model embeddings from the model. More...
 
int log_embeddings (const std::vector< float > &embeddings, int cls)
 Logs Class wise model embeddings. More...
 
int getNumDistributionBoxes () const
 
const distributionBoxgetDistributionBox (unsigned int index) const
 
void registerStatistics ()
 

Public Attributes

frequent_class_sketchsketch1
 

Detailed Description

Class for computing and managing various model statistics.

Constructor & Destructor Documentation

◆ ModelProfile()

ModelProfile::ModelProfile ( std::string  model_id,
std::string  conf_path,
int  save_interval,
int  top_classes 
)

Constructor to initialize ModelProfile object.

ModelProfile class constructor.

Parameters
model_idUnique identifier for the model
no_of_classesNumber of classes the model predicts
saverReference to a Saver object used for saving model statistics

Member Function Documentation

◆ log_classification_model_stats()

int ModelProfile::log_classification_model_stats ( float  inference_latency,
const ClassificationResults &  results 
)

Logs statistics for a classification model.

Logs classification model statistics.

Parameters
inference_latencyTime taken for model inference
resultsReference to the classification results
Returns
0 on success, negative value on error
Parameters
inference_latencyTime taken for model inference
resultsReference to the classification results
Returns
0 on success, negative value on error

This function iterates through the provided results and logs statistics for the most frequent classes. It updates the model_classes_stat map with scores for each class.

◆ log_embeddings() [1/2]

int ModelProfile::log_embeddings ( const std::vector< float > &  embeddings)

Logs model embeddings from the model.

Logs embeddings.

Parameters
vectorof embeddings return 0 on sucess, negative value on error

◆ log_embeddings() [2/2]

int ModelProfile::log_embeddings ( const std::vector< float > &  embeddings,
int  cls 
)

Logs Class wise model embeddings.

Computes and logs selected image statistics.

Parameters
vectorof embeddings
classid return 0 on success , negative value on error
imgOpenCV image matrix
save_sampleFlag indicating whether to save samples exceeding thresholds
Returns
1 on success, error code on failure

The documentation for this class was generated from the following files: