Class for selecting uncertain image samples for further analysis based on various confidence metrics.
More...
#include <imagesampler.h>
|
| ImageSampler (const std::string &conf_path, int save_interval, const std::string &model_type) |
| Constructor to initialize ImageSampler object with configuration file path. More...
|
|
int | sample (const void *raw_output, cv::Mat &img, bool save_sample) |
| Selects uncertain image samples based on configured criteria. More...
|
|
float | margin_confidence (std::vector< float > &prob_dist, bool sorted) |
| Calculates margin confidence (difference between top two probabilities) More...
|
|
float | least_confidence (std::vector< float > &prob_dist, bool sorted) |
| Calculates least confidence (normalized maximum probability) More...
|
|
float | ratio_confidence (std::vector< float > &prob_dist, bool sorted) |
| Calculates ratio confidence (ratio of top two probabilities) More...
|
|
float | entropy_confidence (std::vector< float > &prob_dist) |
| Calculates entropy-based confidence. More...
|
|
|
std::string | statSavepath |
|
std::string | dataSavepath |
|
Class for selecting uncertain image samples for further analysis based on various confidence metrics.
Class for selecting uncertain image samples for further analysis.
◆ ImageSampler()
ImageSampler::ImageSampler |
( |
const std::string & |
conf_path, |
|
|
int |
save_interval, |
|
|
const std::string & |
model_type |
|
) |
| |
Constructor to initialize ImageSampler object with configuration file path.
Constructor to initialize ImageSampler object.
- Parameters
-
configFilePath | Path to the configuration file |
conf_path | Path to configuration file |
saver | Saver object for saving sampling statistics |
◆ entropy_confidence()
float ImageSampler::entropy_confidence |
( |
std::vector< float > & |
prob_dist | ) |
|
Calculates entropy-based confidence.
Calculates entropy based confidence.
- Parameters
-
probabilityDistribution | Vector of class probabilities |
- Returns
- Entropy-based confidence score
- Parameters
-
prob_dist | Vector of class probabilities |
sorted | Flag indicating if probabilities are already sorted (default: false) |
- Returns
- Entropy confidence score
◆ least_confidence()
float ImageSampler::least_confidence |
( |
std::vector< float > & |
prob_dist, |
|
|
bool |
sorted = false |
|
) |
| |
Calculates least confidence (normalized maximum probability)
Calculates least confidence.
- Parameters
-
probabilityDistribution | Vector of class probabilities |
sorted | Flag indicating if probabilities are already sorted (default: false) |
- Returns
- Least confidence score
- Parameters
-
prob_dist | Vector of class probabilities |
sorted | Flag indicating if probabilities are already sorted (default: false) |
- Returns
- least confidence score
◆ margin_confidence()
float ImageSampler::margin_confidence |
( |
std::vector< float > & |
prob_dist, |
|
|
bool |
sorted = false |
|
) |
| |
Calculates margin confidence (difference between top two probabilities)
- Parameters
-
probabilityDistribution | Vector of class probabilities |
sorted | Flag indicating if probabilities are already sorted (default: false) |
- Returns
- Margin confidence score
- Parameters
-
prob_dist | Vector of class probabilities |
sorted | Flag indicating if probabilities are already sorted (default: false) |
- Returns
- Margin confidence score
◆ ratio_confidence()
float ImageSampler::ratio_confidence |
( |
std::vector< float > & |
prob_dist, |
|
|
bool |
sorted = false |
|
) |
| |
Calculates ratio confidence (ratio of top two probabilities)
Calculates ratio confidence (difference between top two probabilities)
- Parameters
-
probabilityDistribution | Vector of class probabilities |
sorted | Flag indicating if probabilities are already sorted (default: false) |
- Returns
- Ratio confidence score
- Parameters
-
prob_dist | Vector of class probabilities |
sorted | Flag indicating if probabilities are already sorted (default: false) |
- Returns
- Margin confidence score
◆ sample()
int ImageSampler::sample |
( |
const void * |
raw_output, |
|
|
cv::Mat & |
img, |
|
|
bool |
save_sample |
|
) |
| |
Selects uncertain image samples based on configured criteria.
- Parameters
-
classificationResults | Vector of confidence scores for each image prediction |
image | OpenCV image matrix |
saveSample | Flag indicating whether to save sampled images |
results | Vector of confidence scores for each image prediction |
uncertainty_sampling | Vector indicating uncertainty criteria for each sample |
img | OpenCV image matrix |
save_sample | Flag indicating whether to save sampled images |
- Returns
- 1 on success, error code on failure
The documentation for this class was generated from the following files: