Change in core as well for Conv_to

Signed-off-by: Omar Shrit <omar@avontech.fr>
This commit is contained in:
Omar Shrit
2024-01-30 22:29:22 +01:00
parent 56827baf15
commit 06c9cbfe3b
3 changed files with 7 additions and 7 deletions
@@ -29,11 +29,11 @@ double ROCAUCScore<PositiveClass>::Evaluate(const arma::Row<size_t>& labels,
}
// Compute labels with "1" for positive class and "0" for the other.
arma::Col<size_t> binaryLabels = arma::conv_to<arma::Col<size_t>>::from(
arma::Col<size_t> binaryLabels = ConvTo<arma::Col<size_t>>::from(
(labels == PositiveClass));
// Converting probability scores of PositiveClass, from row to column vector.
arma::vec colScores = arma::conv_to<arma::vec>::from(scores);
arma::vec colScores = ConvTo<arma::vec>::from(scores);
size_t numberOfTrueLabels = sum(binaryLabels);
size_t numberOfFalseLabels = binaryLabels.n_rows - numberOfTrueLabels;
@@ -69,7 +69,7 @@ double ROCAUCScore<PositiveClass>::Evaluate(const arma::Row<size_t>& labels,
cumulativeSum = cumulativeSum(uniqueScoreIndices);
arma::vec tpr, fpr;
tpr = arma::conv_to<arma::vec>::from(cumulativeSum);
tpr = ConvTo<arma::vec>::from(cumulativeSum);
fpr = 1 + uniqueScoreIndices - tpr;
tpr /= numberOfTrueLabels;
fpr /= numberOfFalseLabels;
+2 -2
View File
@@ -40,7 +40,7 @@ bool Load(const std::string& filename,
return false;
}
matrix = arma::conv_to<arma::Mat<eT>>::from(tempMatrix);
matrix = ConvTo<arma::Mat<eT>>::from(tempMatrix);
Timer::Stop("loading_image");
return true;
}
@@ -86,7 +86,7 @@ bool Load(const std::vector<std::string>& files,
return false;
}
matrix = arma::conv_to<arma::Mat<eT>>::from(tmpMatrix);
matrix = ConvTo<arma::Mat<eT>>::from(tmpMatrix);
return true;
}
+2 -2
View File
@@ -34,7 +34,7 @@ bool Save(const std::string& filename,
const bool fatal)
{
arma::Mat<unsigned char> tmpMatrix =
arma::conv_to<arma::Mat<unsigned char>>::from(matrix);
ConvTo<arma::Mat<unsigned char>>::from(matrix);
return SaveImage(filename, tmpMatrix, info, fatal);
}
@@ -139,7 +139,7 @@ inline bool SaveImage(const std::string& filename,
else if ("hdr" == Extension(filename))
{
// We'll have to convert to float...
arma::fmat tmpImage = arma::conv_to<arma::fmat>::from(image);
arma::fmat tmpImage = ConvTo<arma::fmat>::from(image);
status = stbi_write_hdr(filename.c_str(), info.Width(), info.Height(),
info.Channels(), tmpImage.memptr());
}