This commit is contained in:
Paul Leroy
2023-01-17 16:43:57 +01:00
parent 22e97f43b8
commit 83e08660ee
6 changed files with 24 additions and 20 deletions
+13 -8
View File
@@ -82,20 +82,13 @@
<string notr="true">color:red;</string>
</property>
<property name="text">
<string>Assign each role to the right cloud, and select the role of the cloud to be classified</string>
<string>Assign each label to the right cloud</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_trainOrClassify">
<property name="text">
<string>CLASSIFY</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="testLabel">
<property name="text">
@@ -170,6 +163,18 @@
</property>
</widget>
</item>
<item row="7" column="2">
<widget class="QLabel" name="label_trainOrClassify">
<property name="font">
<font>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>CLASSIFY</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
+2 -2
View File
@@ -157,7 +157,7 @@
<bool>false</bool>
</property>
<property name="text">
<string>Save</string>
<string>Save classifier</string>
</property>
</widget>
</item>
@@ -231,7 +231,7 @@
<item row="3" column="0">
<widget class="QToolButton" name="exportToolButton">
<property name="text">
<string>export</string>
<string>Export feature list</string>
</property>
</widget>
</item>
+2 -4
View File
@@ -9,11 +9,12 @@
#include <QBrush>
ConfusionMatrix::ConfusionMatrix(QWidget *parent) :
ConfusionMatrix::ConfusionMatrix(std::vector<ScalarType> &actual, std::vector<ScalarType> &predicted, QWidget *parent) :
QWidget(parent),
ui(new Ui::ConfusionMatrix)
{
ui->setupUi(this);
compute(actual, predicted);
}
ConfusionMatrix::~ConfusionMatrix()
@@ -215,9 +216,6 @@ void ConfusionMatrix::compute(std::vector<ScalarType>& actual, std::vector<Scala
this->ui->tableWidget->setItem(2 + realIdx, 2 + nbClasses + F1_SCORE, newItem);
}
// this->ui->tableWidget->horizontalHeader()->sectionResizeMode(QHeaderView::ResizeToContents);
// this->ui->tableWidget->verticalHeader()->sectionResizeMode(QHeaderView::ResizeToContents);
this->show();
this->setMinimumSize(this->ui->tableWidget->sizeHint());
}
+1 -1
View File
@@ -23,7 +23,7 @@ public:
F1_SCORE = 2
};
explicit ConfusionMatrix(QWidget *parent = nullptr);
explicit ConfusionMatrix(std::vector<ScalarType>& actual, std::vector<ScalarType>& predicted, QWidget *parent = nullptr);
~ConfusionMatrix();
void computePrecisionRecallF1Score(cv::Mat& matrix, cv::Mat& precisionRecallF1Score);
+3 -3
View File
@@ -138,7 +138,7 @@ void q3DMASCPlugin::doClassifyAction()
//now show a dialog where the user will be able to set the cloud roles
Classify3DMASCDialog classifDlg(m_app);
classifDlg.setCloudRoles(cloudLabels, corePointsLabel);
classifDlg.label_trainOrClassify->setText("CLASSIFY " + corePointsLabel);
classifDlg.label_trainOrClassify->setText(corePointsLabel + " will be classified");
classifDlg.classifierFileLineEdit->setText(inputFilename);
static bool s_keepAttributes = false;
classifDlg.keepAttributesCheckBox->setChecked(s_keepAttributes);
@@ -274,7 +274,7 @@ void q3DMASCPlugin::doTrainAction()
Classify3DMASCDialog classifDlg(m_app, true);
classifDlg.setWindowTitle("3DMASC Train");
classifDlg.setCloudRoles(cloudLabels, corePointsLabel);
classifDlg.label_trainOrClassify->setText("TRAIN on " + corePointsLabel);
classifDlg.label_trainOrClassify->setText("The classifier will be trained on " + corePointsLabel);
classifDlg.classifierFileLineEdit->setText(inputFilename);
classifDlg.keepAttributesCheckBox->setChecked(s_keepAttributes);
if (!classifDlg.exec())
@@ -672,7 +672,7 @@ void q3DMASCPlugin::doTrainAction()
}
//now wait for the user input
while (true)
while (true) // ew!
{
if (!trainDlg.exec())
{
+3 -2
View File
@@ -274,8 +274,7 @@ bool Classifier::classify( const Feature::Source::Set& featureSources,
QCoreApplication::processEvents();
}
ConfusionMatrix *confusionMatrix = new ConfusionMatrix();
confusionMatrix->compute(*classifSFBackup, *classificationSF);
ConfusionMatrix *confusionMatrix = new ConfusionMatrix(*classifSFBackup, *classificationSF);
return success;
}
@@ -435,6 +434,8 @@ bool Classifier::evaluate(const Feature::Source::Set& featureSources,
metrics.ratio = static_cast<float>(metrics.goodGuess) / metrics.sampleCount;
}
ConfusionMatrix *confusionMatrix = new ConfusionMatrix(*classifSF, *outputSF);
return true;
}