mirror of
https://github.com/dgirardeau/q3DMASC.git
synced 2026-08-29 08:34:48 +08:00
save / looad TrainParameters, OpenCV parameters tooltips
This commit is contained in:
+1
-1
@@ -8,7 +8,7 @@ if (INSTALL_Q3DMASC_PLUGIN)
|
||||
project( Q3DMASC_PLUGIN )
|
||||
|
||||
AddPlugin( NAME ${PROJECT_NAME} )
|
||||
set(Q3DMASC_PLUGIN_VERSION "0.1")
|
||||
set(Q3DMASC_PLUGIN_VERSION "0.1+")
|
||||
|
||||
include( CMakePolicies NO_POLICY_SCOPE )
|
||||
|
||||
|
||||
@@ -22,6 +22,9 @@
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>OpenCV parameter</p><p>The maximum possible depth of the tree. That is the training algorithms attempts to split a node while its depth is less than maxDepth. The root node has zero depth. The actual depth may be smaller if the other termination criteria are met, and/or if the tree is pruned.</p><p>[default 25]</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>max depth</string>
|
||||
</property>
|
||||
@@ -42,6 +45,9 @@
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>OpenCV parameter</p><p>The number of trees in the forest!</p><p>[default 100]</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>max tree count</string>
|
||||
</property>
|
||||
@@ -68,6 +74,9 @@
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>OpenCV parameter</p><p>The size of the randomly selected subset of features at each tree node and that are used to find the best split(s). If you set it to 0 then the size will be set to the square root of the total number of features.</p><p>[default 0]</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>active var count</string>
|
||||
</property>
|
||||
@@ -82,6 +91,9 @@
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>OpenCV parameter</p><p>If the number of samples in a node is less than this parameter then the node will not be split.</p><p>[default 10]</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>min sample count</string>
|
||||
</property>
|
||||
@@ -95,6 +107,9 @@
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>10</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
||||
+21
@@ -35,6 +35,7 @@
|
||||
#include <QApplication>
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
#include <QSettings>
|
||||
|
||||
q3DMASCPlugin::q3DMASCPlugin(QObject* parent/*=0*/)
|
||||
: QObject(parent)
|
||||
@@ -219,6 +220,24 @@ struct FeatureSelection
|
||||
float importance = std::numeric_limits<float>::quiet_NaN();
|
||||
};
|
||||
|
||||
void q3DMASCPlugin::saveTrainParameters(const masc::TrainParameters& params)
|
||||
{
|
||||
QSettings settings("OSUR", "q3DMASC");
|
||||
settings.setValue("TrainParameters/maxDepth", params.rt.maxDepth);
|
||||
settings.setValue("TrainParameters/minSampleCount", params.rt.minSampleCount);
|
||||
settings.setValue("TrainParameters/activeVarCount", params.rt.activeVarCount);
|
||||
settings.setValue("TrainParameters/maxTreeCount", params.rt.maxTreeCount);
|
||||
}
|
||||
|
||||
void q3DMASCPlugin::loadTrainParameters(masc::TrainParameters& params)
|
||||
{
|
||||
QSettings settings("OSUR", "q3DMASC");
|
||||
params.rt.maxDepth = settings.value("TrainParameters/maxDepth", 25).toInt();
|
||||
params.rt.minSampleCount = settings.value("TrainParameters/minSampleCount", 10).toInt();
|
||||
params.rt.activeVarCount = settings.value("TrainParameters/activeVarCount", 0).toInt();
|
||||
params.rt.maxTreeCount = settings.value("TrainParameters/maxTreeCount", 100).toInt();
|
||||
}
|
||||
|
||||
void q3DMASCPlugin::doTrainAction()
|
||||
{
|
||||
//disclaimer accepted?
|
||||
@@ -291,6 +310,7 @@ void q3DMASCPlugin::doTrainAction()
|
||||
}
|
||||
|
||||
static masc::TrainParameters s_params;
|
||||
loadTrainParameters(s_params); // load the saved parameters or the default values if any
|
||||
masc::Feature::Set features;
|
||||
std::vector<double> scales;
|
||||
if (!masc::Tools:: LoadTrainingFile(inputFilename, features, scales, loadedClouds, s_params, &corePoints, m_app->getMainWindow()))
|
||||
@@ -676,6 +696,7 @@ void q3DMASCPlugin::doTrainAction()
|
||||
{
|
||||
if (!trainDlg.exec())
|
||||
{
|
||||
saveTrainParameters(s_params);
|
||||
//the dialog can be closed
|
||||
generatedScalarFields.releaseSFs(s_keepAttributes);
|
||||
generatedScalarFieldsTest.releaseSFs(s_keepAttributes);
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
//qCC
|
||||
#include <ccStdPluginInterface.h>
|
||||
|
||||
#include "Parameters.h"
|
||||
|
||||
//! 3DMASC plugin
|
||||
/** 3D Multi-cloud, multi-Attribute, multi-Scale, multi-Class classification
|
||||
**/
|
||||
@@ -43,6 +45,8 @@ public:
|
||||
protected slots:
|
||||
|
||||
void doClassifyAction();
|
||||
void saveTrainParameters(const masc::TrainParameters& params);
|
||||
void loadTrainParameters(masc::TrainParameters& params);
|
||||
void doTrainAction();
|
||||
|
||||
protected:
|
||||
|
||||
Reference in New Issue
Block a user