4 #include <cuv/ndarray.hpp>
7 #include "random_forest_image.h"
28 data(), normalized(false) {
35 data(other.data.copy()), normalized(other.normalized), ignoredLabels(other.ignoredLabels) {
42 data(numClasses, numClasses), normalized(false) {
43 assert(numClasses > 0);
50 explicit ConfusionMatrix(
size_t numClasses, std::vector<LabelType> ignoredLabels) :
51 data(numClasses, numClasses), normalized(false), ignoredLabels(ignoredLabels) {
52 assert(numClasses > 0);
60 data = other.data.
copy();
61 normalized = other.normalized;
62 ignoredLabels = other.ignoredLabels;
76 void resize(
unsigned int numClasses);
96 return data(label, prediction);
103 return data(label, prediction);
112 throw std::runtime_error(
"confusion matrix is already normalized");
116 (data(label, prediction))++;
123 assert(data.
ndim() == 2);
125 return data.
shape(0);
143 std::vector<LabelType> ignoredLabels;
152 double calculatePixelAccuracy(
const LabelImage& prediction,
const LabelImage& groundTruth,
153 const bool includeVoid =
true,
const std::vector<LabelType> ignoredLabels = NULL, ConfusionMatrix* confusionMatrix = 0);
164 void test(RandomForestImage& randomForest,
const std::string& folderTesting,
165 const std::string& folderPrediction,
const bool useDepthFilling,
166 const bool writeProbabilityImages);