Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 649196d624 | |||
| 41c229a650 |
@@ -1,378 +0,0 @@
|
|||||||
#include "LandslideAssess.h"
|
|
||||||
|
|
||||||
#include <QSettings>
|
|
||||||
|
|
||||||
LandslideAssess::LandslideAssess()
|
|
||||||
{
|
|
||||||
//ui.setupUi(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString LandslideAssess::PannelName()
|
|
||||||
{
|
|
||||||
return QString::fromLocal8Bit("地质模块");
|
|
||||||
}
|
|
||||||
|
|
||||||
QString LandslideAssess::CategoryName()
|
|
||||||
{
|
|
||||||
return QString::fromLocal8Bit("地质模块");
|
|
||||||
}
|
|
||||||
|
|
||||||
QString LandslideAssess::EnglishName()
|
|
||||||
{
|
|
||||||
return QString::fromLocal8Bit("LandslideAssess");
|
|
||||||
}
|
|
||||||
|
|
||||||
QString LandslideAssess::ChineseName()
|
|
||||||
{
|
|
||||||
return QString::fromLocal8Bit("结果评估");
|
|
||||||
}
|
|
||||||
|
|
||||||
QString LandslideAssess::Information()
|
|
||||||
{
|
|
||||||
return QString::fromLocal8Bit("结果评估");
|
|
||||||
}
|
|
||||||
|
|
||||||
QString LandslideAssess::IconPath()
|
|
||||||
{
|
|
||||||
return QString(":/LandslideAssess/resources/assessment.svg");
|
|
||||||
}
|
|
||||||
|
|
||||||
QWidget* LandslideAssess::CenterWidget()
|
|
||||||
{
|
|
||||||
QString gdal_path = qApp->applicationDirPath().toLocal8Bit() + "/share/gdal";
|
|
||||||
QString pro_lib_path = qApp->applicationDirPath().toLocal8Bit() + "/share/proj";
|
|
||||||
qputenv("GDAL_DATA", gdal_path.toLocal8Bit());
|
|
||||||
qputenv("PROJ_LIB", pro_lib_path.toLocal8Bit());
|
|
||||||
|
|
||||||
bool showWin = false;
|
|
||||||
if (myWidget == nullptr)
|
|
||||||
{
|
|
||||||
myWidget = new QDialog();
|
|
||||||
showWin = true;
|
|
||||||
qDebug() << "new QDialog()";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
qDebug() << "already have myWidget";
|
|
||||||
//激活窗口并提升至顶层
|
|
||||||
myWidget->activateWindow();
|
|
||||||
myWidget->raise();
|
|
||||||
return myWidget;
|
|
||||||
}
|
|
||||||
ui.setupUi(myWidget);
|
|
||||||
|
|
||||||
myWidget->setWindowTitle(QString::fromLocal8Bit("结果评估"));
|
|
||||||
myWidget->setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint);
|
|
||||||
myWidget->setWindowIcon(QIcon(":/LandslideAssess/resources/assessment.svg"));
|
|
||||||
myWidget->setAttribute(Qt::WA_QuitOnClose, false);
|
|
||||||
|
|
||||||
myWidget->setAttribute(Qt::WA_DeleteOnClose);
|
|
||||||
connect(myWidget, &QDialog::destroyed, this, [=] {
|
|
||||||
qDebug() << "----Landslide assess window close----";
|
|
||||||
|
|
||||||
QDir pluginsDir = QDir(qApp->applicationDirPath());
|
|
||||||
if (pluginsDir.cd("srsplugins\\SldModel"))
|
|
||||||
{
|
|
||||||
QString strConfigPath = pluginsDir.absoluteFilePath("sld_config.ini");
|
|
||||||
QFile f(strConfigPath);
|
|
||||||
if (f.exists())
|
|
||||||
{
|
|
||||||
WriteConfigPaths(strConfigPath);
|
|
||||||
f.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mWorkThread != nullptr)
|
|
||||||
{
|
|
||||||
mWorkThread->requestInterruption();//请求线程中断
|
|
||||||
mWorkThread->quit();
|
|
||||||
mWorkThread->wait();//调用wait后先调用finished信号对应的槽函数,执行完成后再往下走
|
|
||||||
mWorker->on_cancel();
|
|
||||||
mWorkThread = nullptr;//mWorkThread, &QThread::finished, mWorkThread, &QObject::deleteLater,不需要delete
|
|
||||||
mWorker = nullptr;//mWorkThread, &QThread::finished, mWorker, &QObject::deleteLater
|
|
||||||
}
|
|
||||||
//qDebug() << "--destroyed";
|
|
||||||
myWidget->close();
|
|
||||||
myWidget = nullptr;
|
|
||||||
});
|
|
||||||
connect(ui.pbtInDataset, &QPushButton::clicked, this, &LandslideAssess::choosePredictPath);
|
|
||||||
connect(ui.pbtInLabel, &QPushButton::clicked, this, &LandslideAssess::chooseLabelPath);
|
|
||||||
connect(ui.pbtIndex, &QPushButton::clicked, this, &LandslideAssess::chooseAssessFile);
|
|
||||||
connect(ui.pbtInModel, &QPushButton::clicked, this, &LandslideAssess::chooseModelFile);
|
|
||||||
connect(ui.pbtResult, &QPushButton::clicked, this, &LandslideAssess::chooseResultPath);
|
|
||||||
|
|
||||||
connect(ui.pushButton_ok, &QPushButton::clicked, this, &LandslideAssess::readAndStart);
|
|
||||||
connect(ui.pushButton_cancel, &QPushButton::clicked, this, &LandslideAssess::pbCancel);
|
|
||||||
|
|
||||||
ui.progressBar->setTextVisible(true);
|
|
||||||
ui.progressBar->setRange(0, 100);
|
|
||||||
|
|
||||||
ui.pbtInModel->setFocus();
|
|
||||||
|
|
||||||
QFile qssFile(":/LandslideAssess/LandslideAssess.qss");
|
|
||||||
qssFile.open(QFile::ReadOnly); //以只读方式打开
|
|
||||||
if (qssFile.isOpen())
|
|
||||||
{
|
|
||||||
QString qss = QLatin1String(qssFile.readAll());
|
|
||||||
myWidget->setStyleSheet(qss);
|
|
||||||
qssFile.close();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
qDebug() << "no qssFile";
|
|
||||||
|
|
||||||
QDir pluginsDir = QDir(qApp->applicationDirPath());
|
|
||||||
if (pluginsDir.cd("srsplugins\\SldModel"))
|
|
||||||
{
|
|
||||||
QString strConfigPath = pluginsDir.absoluteFilePath("sld_config.ini");
|
|
||||||
QFile f(strConfigPath);
|
|
||||||
if (f.exists())
|
|
||||||
{
|
|
||||||
ReadConfigHistoryPaths(strConfigPath);
|
|
||||||
f.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (showWin)
|
|
||||||
myWidget->show();
|
|
||||||
|
|
||||||
return myWidget;
|
|
||||||
}
|
|
||||||
|
|
||||||
void LandslideAssess::startWorkThread()
|
|
||||||
{
|
|
||||||
if (mWorker != nullptr)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
mWorkThread = new QThread();
|
|
||||||
mWorker = new WorkObject();
|
|
||||||
mWorker->moveToThread(mWorkThread);
|
|
||||||
connect(mWorkThread, &QThread::finished, mWorkThread, &QObject::deleteLater);
|
|
||||||
connect(mWorkThread, &QThread::finished, mWorker, &QObject::deleteLater);
|
|
||||||
connect(mWorker, &WorkObject::progress, myWidget, [=](int value) {
|
|
||||||
ui.progressBar->setValue(value);
|
|
||||||
if (value == 100)
|
|
||||||
{
|
|
||||||
QString txtDir = ui.lineResult->text() + "/assessment.txt";
|
|
||||||
QFile file(txtDir);
|
|
||||||
QString outLines = "";
|
|
||||||
if (file.open(QIODevice::ReadOnly))
|
|
||||||
{
|
|
||||||
QTextStream stream(&file);
|
|
||||||
// recall 召回率
|
|
||||||
// precision 精确率
|
|
||||||
// mIoU 平均交并比
|
|
||||||
// mAP 平均精度均值
|
|
||||||
// f1_score
|
|
||||||
while (!stream.atEnd())
|
|
||||||
{
|
|
||||||
QString line = stream.readLine();
|
|
||||||
//strs.push_back(line);
|
|
||||||
if (line.contains("===>mIoU"))
|
|
||||||
{
|
|
||||||
//===>mIoU:68.45; mAP: 74.92
|
|
||||||
line.remove("===>");
|
|
||||||
line.replace(QStringLiteral("mAP"), QStringLiteral("平均精度均值mAP"));
|
|
||||||
line.replace(QStringLiteral("mIoU"), QStringLiteral("平均交并比mIoU"));
|
|
||||||
outLines = outLines + line + "\n";
|
|
||||||
}
|
|
||||||
else if (line.contains("===>recall"))
|
|
||||||
{
|
|
||||||
//===>recall:66.62; precision: 51.2
|
|
||||||
line.remove("===>");
|
|
||||||
line.replace(QStringLiteral("recall"), QStringLiteral("召回率recall"));
|
|
||||||
line.replace(QStringLiteral("precision"), QStringLiteral("精确率precision"));
|
|
||||||
outLines = outLines + line + "\n";
|
|
||||||
}
|
|
||||||
else if (line.contains("===>f1_score"))
|
|
||||||
{
|
|
||||||
//===>f1_score:57.9
|
|
||||||
line.remove("===>");
|
|
||||||
line.replace(QStringLiteral("f1_score"), QStringLiteral("F1分数f1_score"));
|
|
||||||
outLines = outLines + line;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
file.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
QMessageBox mess(QMessageBox::Information,
|
|
||||||
QString::fromLocal8Bit("评估结束"),
|
|
||||||
QString::fromLocal8Bit("评价结果:\n") + txtDir + "\n"
|
|
||||||
+ outLines);
|
|
||||||
mess.setWindowFlags(Qt::Drawer);
|
|
||||||
mess.setStandardButtons(QMessageBox::Yes);
|
|
||||||
mess.button(QMessageBox::StandardButton::Yes)->setText(QString::fromLocal8Bit("确认"));
|
|
||||||
int result = mess.exec();
|
|
||||||
pbCancel();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
connect(this, &LandslideAssess::startPreAssessment, mWorker, &WorkObject::runAssessWork);
|
|
||||||
|
|
||||||
mWorkThread->start();
|
|
||||||
}
|
|
||||||
|
|
||||||
void LandslideAssess::ReadConfigHistoryPaths(QString strPath)
|
|
||||||
{
|
|
||||||
QSettings configIni(strPath, QSettings::IniFormat);
|
|
||||||
|
|
||||||
//打开标题为:[DemTrain] 的组,读取DemTrain输出结果TrainResult字段
|
|
||||||
configIni.beginGroup("SldTrain");
|
|
||||||
|
|
||||||
QString strDemTrainResult = configIni.value("TrainResult").toString();
|
|
||||||
QDir srcDir = QDir(strDemTrainResult);
|
|
||||||
//更新评价文件列表
|
|
||||||
if (srcDir.absoluteFilePath("val_list.txt") != "")
|
|
||||||
ui.lineIndex->setText(srcDir.absoluteFilePath("val_list.txt"));
|
|
||||||
//更新输入Images
|
|
||||||
srcDir = QDir(strDemTrainResult);
|
|
||||||
if (srcDir.cd("Images"))
|
|
||||||
ui.lineInDataset->setText(srcDir.absolutePath());
|
|
||||||
//更新输入Labels
|
|
||||||
srcDir = QDir(strDemTrainResult);
|
|
||||||
if (srcDir.cd("Labels"))
|
|
||||||
ui.lineInLabel->setText(srcDir.absolutePath());
|
|
||||||
|
|
||||||
configIni.endGroup();//关闭组
|
|
||||||
|
|
||||||
//打开标题为:[DemAssess] 的组,读取AssessResult字段
|
|
||||||
configIni.beginGroup("SldAssess");
|
|
||||||
//更新评价结果输出
|
|
||||||
ui.lineResult->setText(configIni.value("AssessResult").toString());
|
|
||||||
|
|
||||||
configIni.endGroup();//关闭组
|
|
||||||
}
|
|
||||||
|
|
||||||
void LandslideAssess::WriteConfigPaths(QString strPath)
|
|
||||||
{
|
|
||||||
QSettings configIni(strPath, QSettings::IniFormat);
|
|
||||||
configIni.setIniCodec("utf-8");
|
|
||||||
//打开标题为:[DemAssess] 的组
|
|
||||||
configIni.beginGroup("SldAssess");
|
|
||||||
|
|
||||||
//更新输入模型路径
|
|
||||||
QString temp = ui.lineResult->text();
|
|
||||||
if (temp != "")
|
|
||||||
configIni.setValue("AssessResult", temp);
|
|
||||||
|
|
||||||
configIni.endGroup();//关闭组
|
|
||||||
}
|
|
||||||
|
|
||||||
void LandslideAssess::readAndStart()
|
|
||||||
{
|
|
||||||
QString dirModel = ui.lineInModel->text();
|
|
||||||
QString dirIndex = ui.lineIndex->text();
|
|
||||||
QString dirLabel = ui.lineInLabel->text();
|
|
||||||
QString dirPredict = ui.lineInDataset->text();
|
|
||||||
QString dirResult = ui.lineResult->text();
|
|
||||||
|
|
||||||
ui.progressBar->setValue(0);
|
|
||||||
|
|
||||||
if (dirLabel == "" || dirPredict == "" || dirIndex == "" || dirModel == "" || dirResult == "")
|
|
||||||
{
|
|
||||||
QMessageBox mess(QMessageBox::NoIcon, QString::fromLocal8Bit("错误"), QString::fromLocal8Bit("请检查输入路径"));
|
|
||||||
mess.setWindowFlags(Qt::Drawer);
|
|
||||||
int result = mess.exec();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (mWorkThread == nullptr)
|
|
||||||
{
|
|
||||||
qDebug() << "--startThread";
|
|
||||||
startWorkThread();
|
|
||||||
}
|
|
||||||
emit startPreAssessment(dirModel, dirPredict, dirLabel, dirIndex, dirResult);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LandslideAssess::pbCancel()
|
|
||||||
{
|
|
||||||
qDebug() << "--pbtCancel";
|
|
||||||
delete myWidget;//调起&QDialog::destroyed
|
|
||||||
}
|
|
||||||
|
|
||||||
void LandslideAssess::choosePredictPath()
|
|
||||||
{
|
|
||||||
QString dirInDataset = QFileDialog::getExistingDirectory(ui.pbtInDataset, QString::fromLocal8Bit("选择输入评价文件路径"), "");
|
|
||||||
if (dirInDataset != "")
|
|
||||||
ui.lineInDataset->setText(dirInDataset);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LandslideAssess::chooseLabelPath()
|
|
||||||
{
|
|
||||||
QString dirDom = QFileDialog::getExistingDirectory(ui.pbtInLabel, QString::fromLocal8Bit("选择输入标签文件路径"), "");
|
|
||||||
if (dirDom != "")
|
|
||||||
ui.lineInLabel->setText(dirDom);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LandslideAssess::chooseAssessFile()
|
|
||||||
{
|
|
||||||
QString dirDom = QFileDialog::getOpenFileName(ui.pbtIndex, QString::fromLocal8Bit("选择输入评估文件索引"), "", "*.txt");
|
|
||||||
if (dirDom != "")
|
|
||||||
ui.lineIndex->setText(dirDom);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LandslideAssess::chooseModelFile()
|
|
||||||
{
|
|
||||||
QString fileModel = QFileDialog::getOpenFileName(ui.pbtInModel, QString::fromLocal8Bit("选择输入模型文件"), "", "*.pth");
|
|
||||||
if (fileModel != "")
|
|
||||||
ui.lineInModel->setText(fileModel);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LandslideAssess::chooseResultPath()
|
|
||||||
{
|
|
||||||
QString dirResult = QFileDialog::getExistingDirectory(ui.pbtResult, QString::fromLocal8Bit("选择评估结果输出路径"), "");
|
|
||||||
if (dirResult != "")
|
|
||||||
ui.lineResult->setText(dirResult);
|
|
||||||
}
|
|
||||||
|
|
||||||
void WorkObject::runAssessWork(QString model, QString PRE, QString label, QString index, QString result)
|
|
||||||
{
|
|
||||||
qDebug() << "start work:" << "\npredict: " << PRE << "\nLabel:" << label;
|
|
||||||
QFileInfo file(index);
|
|
||||||
file.absolutePath();
|
|
||||||
assess_txt_path = file.absolutePath() + "/assessment.txt";
|
|
||||||
QDir pluginsDir = QDir(qApp->applicationDirPath());
|
|
||||||
qDebug() << "----" << pluginsDir.currentPath();
|
|
||||||
if (!pluginsDir.cd("models\\envs"))
|
|
||||||
{
|
|
||||||
qDebug() << "no folder models\\envs";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
QString exeDirName = pluginsDir.absoluteFilePath("miou_landslide.exe");
|
|
||||||
QString model_dir = " --model_dir " + model;
|
|
||||||
QString img_data_dir = " --img_data_dir " + PRE + "/";
|
|
||||||
QString label_dir = " --label_dir " + label + "/";
|
|
||||||
QString val_list = " --val_list " + index;
|
|
||||||
QString out_result = " --result_file " + result + "/";
|
|
||||||
QString ss = exeDirName + model_dir + img_data_dir + label_dir + val_list + out_result;
|
|
||||||
qDebug() << ss;
|
|
||||||
QProcess* pProces = new QProcess(this);
|
|
||||||
connect(pProces, SIGNAL(readyReadStandardOutput()), this, SLOT(writeAssessTxt()));
|
|
||||||
pProces->start(ss);
|
|
||||||
|
|
||||||
emit progress(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
void WorkObject::writeAssessTxt()
|
|
||||||
{
|
|
||||||
mProcess = (QProcess*)sender();
|
|
||||||
QString output = QString::fromLocal8Bit(mProcess->readAllStandardOutput());
|
|
||||||
output.chop(2);
|
|
||||||
if (output.toFloat() != 0)
|
|
||||||
{
|
|
||||||
qDebug() << "process:" << output.toFloat();
|
|
||||||
emit progress(output.toFloat());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
qDebug() << "unsolved exe out:" << output;
|
|
||||||
}
|
|
||||||
|
|
||||||
void WorkObject::on_cancel()
|
|
||||||
{
|
|
||||||
if (mProcess == nullptr)
|
|
||||||
qDebug() << "--mProces null";
|
|
||||||
else
|
|
||||||
{
|
|
||||||
QString KillStr = "taskkill /f /im miou_landslide.exe";
|
|
||||||
mProcess->startDetached(KillStr);
|
|
||||||
qDebug() << "--kill Proces";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
<RCC>
|
|
||||||
<qresource prefix="/LandslideAssess">
|
|
||||||
<file>resources/assessment.svg</file>
|
|
||||||
<file>LandslideAssess.qss</file>
|
|
||||||
</qresource>
|
|
||||||
</RCC>
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1652932649746" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2186" width="32" height="32" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><style type="text/css">@font-face { font-family: feedback-iconfont; src: url("//at.alicdn.com/t/font_1031158_u69w8yhxdu.woff2?t=1630033759944") format("woff2"), url("//at.alicdn.com/t/font_1031158_u69w8yhxdu.woff?t=1630033759944") format("woff"), url("//at.alicdn.com/t/font_1031158_u69w8yhxdu.ttf?t=1630033759944") format("truetype"); }
|
|
||||||
</style></defs><path d="M802.3 649c-13.3 0-24 10.7-24 24v163.9c0 17.7-14.4 32.1-32.1 32.1H222.6c-17.7 0-32.1-14.4-32.1-32.1v-656c0-17.7 14.4-32.1 32.1-32.1h523.7c17.7 0 32 14.4 32 32V235c0 13.3 10.7 24 24 24s24-10.7 24-24v-54.2c0-44.1-35.9-80-80-80H222.6c-44.2 0-80.1 35.9-80.1 80.1v656c0 44.2 35.9 80.1 80.1 80.1h523.6c44.2 0 80.1-35.9 80.1-80.1V673c0-13.3-10.7-24-24-24z" fill="#2c2c2c" p-id="2187"></path><path d="M856.6 332.2L827 315.1c-15.2-9.3-31.5-11.1-47-5.2-12.7 4.8-24.3 14.8-33.8 29l-16.4 25.2c-0.8 0.8-1.5 1.7-2.1 2.6-0.7 1-1.2 2.1-1.7 3.2L563 620.5c-8.8 13.2-13.2 29.2-12.6 45.1l-2.2 90.4c-0.1 5.7 5.4 9.7 10.8 7.9l100.8-35.2c15.6-4.6 28.6-14.8 36.8-28.9L866 411.2l0.1-0.1c5.3-9.1 11.7-23.2 12.1-38 0.5-17.5-7.2-32-21.6-40.9z m-50.3 17.1l29.6 17.1c1.4 0.9 2.4 1.7 2.3 5.4-0.1 5-2.6 12-6.7 19.1l-8.5 14.5-50.6-33.3 7.3-11.2c13.1-19.8 22.6-14 26.6-11.6zM662.1 679.5l-0.1 0.1c-3 5.2-8 9-13.8 10.7l-0.5 0.1-51.7 18c-3.2 1.1-6.6-1.3-6.5-4.7l1-38.7v-0.8c-0.4-7.6 1.7-15.4 5.9-21.7l154.2-236.9 52.2 34.3-140.7 239.6zM702.6 256.9c-7.8-7.8-20.5-7.9-28.3-0.1L467.8 462.4l-93.9-98.6c-7-7.4-18.5-8.3-26.6-2.1l-113.1 86.6c-8.8 6.7-10.4 19.3-3.7 28 6.7 8.8 19.3 10.4 28 3.7l98.8-75.7 95.6 100.4c3.7 3.9 8.8 6.1 14.2 6.2h0.3c5.3 0 10.4-2.1 14.1-5.8l221.1-220c7.8-7.7 7.8-20.4 0-28.2zM266.3 647h186.2c11 0 20-9 20-20s-9-20-20-20H266.3c-11 0-20 9-20 20s9 20 20 20zM266.3 775h232.2c11 0 20-9 20-20s-9-20-20-20H266.3c-11 0-20 9-20 20s9 20 20 20z" fill="#2c2c2c" p-id="2188"></path></svg>
|
|
||||||
|
Before Width: | Height: | Size: 2.1 KiB |
@@ -3,20 +3,20 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||||||
# Visual Studio Version 16
|
# Visual Studio Version 16
|
||||||
VisualStudioVersion = 16.0.32630.194
|
VisualStudioVersion = 16.0.32630.194
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LandslideAssess", "LandslideAssess\LandslideAssess.vcxproj", "{AEAE6E5B-D14B-46CB-BF18-3375936B7CD2}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LandslideTrain", "LandslideTrain\LandslideTrain.vcxproj", "{1D23BAC7-1D1A-48BE-9796-93F34E435A5A}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Release|x64 = Release|x64
|
Release|x64 = Release|x64
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{AEAE6E5B-D14B-46CB-BF18-3375936B7CD2}.Release|x64.ActiveCfg = Release|x64
|
{1D23BAC7-1D1A-48BE-9796-93F34E435A5A}.Release|x64.ActiveCfg = Release|x64
|
||||||
{AEAE6E5B-D14B-46CB-BF18-3375936B7CD2}.Release|x64.Build.0 = Release|x64
|
{1D23BAC7-1D1A-48BE-9796-93F34E435A5A}.Release|x64.Build.0 = Release|x64
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {B31E7462-C1A4-4BA3-97F3-704180A5CDB6}
|
SolutionGuid = {9DAFCFF4-8408-40F6-A160-95047A99BB28}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
#include "CProgressBar.h"
|
||||||
|
|
||||||
|
CProgressBar::CProgressBar(QWidget* parent) : QProgressBar(parent)
|
||||||
|
{
|
||||||
|
//this->setStyleSheet(
|
||||||
|
// "QProgressBar {color:black;font-size:12px;font-weight:normal;font-family:'Microsoft YaHei'; text-align:center; }"
|
||||||
|
// "QProgressBar::chunk {background-color: rgb(0, 160, 244);}");
|
||||||
|
}
|
||||||
|
|
||||||
|
void CProgressBar::ShowTips(const QString& strTips)
|
||||||
|
{
|
||||||
|
if (this->isHidden())
|
||||||
|
{
|
||||||
|
this->show();
|
||||||
|
}
|
||||||
|
|
||||||
|
this->resetFormat();
|
||||||
|
this->setRange(0, 100);
|
||||||
|
this->setFormat(strTips);
|
||||||
|
this->setValue(100);
|
||||||
|
}
|
||||||
|
|
||||||
|
double CProgressBar::GetDoubleFormatValue()
|
||||||
|
{
|
||||||
|
double dValue = 0.0;
|
||||||
|
|
||||||
|
QString strFormat = this->format();
|
||||||
|
if (!strFormat.isEmpty())
|
||||||
|
{
|
||||||
|
int nIndex = strFormat.indexOf(":");
|
||||||
|
if (nIndex != -1)
|
||||||
|
{
|
||||||
|
QString strFormatData = strFormat.mid(nIndex + 1, strFormat.length() - nIndex - 2);
|
||||||
|
dValue = strFormatData.toDouble();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return dValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CProgressBar::SetDoubleFormatValue(const QString& strFormat, double dValue)
|
||||||
|
{
|
||||||
|
if (this->isHidden())
|
||||||
|
{
|
||||||
|
this->show();
|
||||||
|
}
|
||||||
|
|
||||||
|
this->setFormat(strFormat + ":" + QString::number(dValue, 'f', 2) + "%");
|
||||||
|
this->setValue(dValue);
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
#pragma once
|
||||||
|
#include<QProgressBar>
|
||||||
|
|
||||||
|
class CProgressBar : public QProgressBar
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
CProgressBar(QWidget* parent = 0);
|
||||||
|
~CProgressBar() {}
|
||||||
|
|
||||||
|
public:
|
||||||
|
void ShowTips(const QString& strTips);
|
||||||
|
|
||||||
|
void SetDoubleFormatValue(const QString& strFormat, double dValue);
|
||||||
|
|
||||||
|
double GetDoubleFormatValue();
|
||||||
|
};
|
||||||
@@ -0,0 +1,455 @@
|
|||||||
|
#include "LandslideTrain.h"
|
||||||
|
|
||||||
|
#include <QSettings>
|
||||||
|
|
||||||
|
LandslideTrain::LandslideTrain()
|
||||||
|
{
|
||||||
|
//ui.setupUi(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString LandslideTrain::PannelName()
|
||||||
|
{
|
||||||
|
return QString::fromLocal8Bit("地质模块");
|
||||||
|
}
|
||||||
|
|
||||||
|
QString LandslideTrain::CategoryName()
|
||||||
|
{
|
||||||
|
return QString::fromLocal8Bit("地质模块");
|
||||||
|
}
|
||||||
|
|
||||||
|
QString LandslideTrain::EnglishName()
|
||||||
|
{
|
||||||
|
return QString::fromLocal8Bit("LandslideTrain");
|
||||||
|
}
|
||||||
|
|
||||||
|
QString LandslideTrain::ChineseName()
|
||||||
|
{
|
||||||
|
return QString::fromLocal8Bit("模型构建");
|
||||||
|
}
|
||||||
|
|
||||||
|
QString LandslideTrain::Information()
|
||||||
|
{
|
||||||
|
return QString::fromLocal8Bit("模型构建");
|
||||||
|
}
|
||||||
|
|
||||||
|
QString LandslideTrain::IconPath()
|
||||||
|
{
|
||||||
|
return ":/LandslideTrain/resources/dem_vec.svg";
|
||||||
|
}
|
||||||
|
|
||||||
|
QWidget* LandslideTrain::CenterWidget()
|
||||||
|
{
|
||||||
|
//QString gdal_path = qApp->applicationDirPath().toLocal8Bit() + "/share/gdal";
|
||||||
|
//QString pro_lib_path = qApp->applicationDirPath().toLocal8Bit() + "/share/proj";
|
||||||
|
//qputenv("GDAL_DATA", gdal_path.toLocal8Bit());
|
||||||
|
//qputenv("PROJ_LIB", pro_lib_path.toLocal8Bit());
|
||||||
|
bool showWin = false;
|
||||||
|
if (myWidget == nullptr)
|
||||||
|
{
|
||||||
|
myWidget = new QDialog();
|
||||||
|
showWin = true;
|
||||||
|
qDebug() << "new QDialog()";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qDebug() << "already have myWidget";
|
||||||
|
//激活窗口并提升至顶层
|
||||||
|
myWidget->activateWindow();
|
||||||
|
myWidget->raise();
|
||||||
|
return myWidget;
|
||||||
|
}
|
||||||
|
ui.setupUi(myWidget);
|
||||||
|
|
||||||
|
myWidget->setWindowTitle(QString::fromLocal8Bit("模型训练"));
|
||||||
|
myWidget->setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint);
|
||||||
|
myWidget->setWindowIcon(QIcon(":/LandslideTrain/resources/dem_vec.svg"));
|
||||||
|
myWidget->setAttribute(Qt::WA_QuitOnClose, false);
|
||||||
|
|
||||||
|
myWidget->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
connect(myWidget, &QDialog::destroyed, this, [=] {
|
||||||
|
qDebug() << "----Landslide train window close----";
|
||||||
|
|
||||||
|
QDir pluginsDir = QDir(qApp->applicationDirPath());
|
||||||
|
if (pluginsDir.cd("srsplugins\\SldModel"))
|
||||||
|
{
|
||||||
|
QString strConfigPath = pluginsDir.absoluteFilePath("sld_config.ini");
|
||||||
|
QFile f(strConfigPath);
|
||||||
|
if (f.exists())
|
||||||
|
{
|
||||||
|
WriteConfigPaths(strConfigPath);
|
||||||
|
f.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mWorkThread != nullptr)
|
||||||
|
{
|
||||||
|
mWorkThread->requestInterruption();
|
||||||
|
mWorkThread->quit();
|
||||||
|
mWorkThread->wait();//调用wait后先调用finished信号对应的槽函数,执行完成后再往下走
|
||||||
|
mWorkObject->on_cancel();
|
||||||
|
mWorkThread = nullptr;//mWorkThread, &QThread::finished, mWorkThread, &QObject::deleteLater,不需要delete
|
||||||
|
mWorkObject = nullptr;//mWorkThread, &QThread::finished, mWorker, &QObject::deleteLater
|
||||||
|
}
|
||||||
|
|
||||||
|
myWidget->close();
|
||||||
|
myWidget = nullptr;
|
||||||
|
});
|
||||||
|
connect(ui.pbtInModel, &QPushButton::clicked, this, &LandslideTrain::chooseInModel);
|
||||||
|
connect(ui.pbtInDataset, &QPushButton::clicked, this, &LandslideTrain::chooseInDataset);
|
||||||
|
connect(ui.pbtInLabel, &QPushButton::clicked, this, &LandslideTrain::chooseInLabel);
|
||||||
|
connect(ui.pbtOutResult, &QPushButton::clicked, this, &LandslideTrain::chooseResultPath);
|
||||||
|
|
||||||
|
connect(ui.pushButton_ok, &QPushButton::clicked, this, &LandslideTrain::readAndStart);
|
||||||
|
connect(ui.pushButton_cancel, &QPushButton::clicked, this, &LandslideTrain::pbCancel);
|
||||||
|
|
||||||
|
ui.lineEpoch1->setValidator(new QIntValidator(0, 999, this));
|
||||||
|
ui.lineEpoch2->setValidator(new QIntValidator(0, 999, this));
|
||||||
|
ui.lineEpoch1->setText("100");
|
||||||
|
ui.lineEpoch2->setText("100");
|
||||||
|
|
||||||
|
ui.pbtInModel->setFocus();
|
||||||
|
|
||||||
|
connect(ui.checkBoxGenData, &QCheckBox::clicked, this, [=](bool checked) {
|
||||||
|
executeGenData = checked;
|
||||||
|
if (!executeGenData && !executeTrain)
|
||||||
|
ui.pushButton_ok->setEnabled(false);
|
||||||
|
else
|
||||||
|
ui.pushButton_ok->setEnabled(true);
|
||||||
|
});
|
||||||
|
connect(ui.checkBoxTrain, &QCheckBox::clicked, this, [=](bool checked) {
|
||||||
|
executeTrain = checked;
|
||||||
|
if (!executeGenData && !executeTrain)
|
||||||
|
ui.pushButton_ok->setEnabled(false);
|
||||||
|
else
|
||||||
|
ui.pushButton_ok->setEnabled(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
ui.progressBar->setTextVisible(true);
|
||||||
|
ui.progressBar->setRange(0, 100);
|
||||||
|
|
||||||
|
QFile qssFile(":/LandslideTrain/LandslideTrain.qss");
|
||||||
|
qssFile.open(QFile::ReadOnly); //以只读方式打开
|
||||||
|
if (qssFile.isOpen())
|
||||||
|
{
|
||||||
|
QString qss = QLatin1String(qssFile.readAll());
|
||||||
|
myWidget->setStyleSheet(qss);
|
||||||
|
qssFile.close();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
qDebug() << "-- no qssFile";
|
||||||
|
|
||||||
|
QDir pluginsDir = QDir(qApp->applicationDirPath());
|
||||||
|
if (pluginsDir.cd("srsplugins\\SldModel"))
|
||||||
|
{
|
||||||
|
QString strConfigPath = pluginsDir.absoluteFilePath("sld_config.ini");
|
||||||
|
QFile f(strConfigPath);
|
||||||
|
if (f.exists())
|
||||||
|
{
|
||||||
|
ReadConfigHistoryPaths(strConfigPath);
|
||||||
|
f.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (showWin)
|
||||||
|
myWidget->show();
|
||||||
|
|
||||||
|
return myWidget;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LandslideTrain::startWorkThread()
|
||||||
|
{
|
||||||
|
if (mWorkObject != nullptr)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mWorkThread = new QThread();
|
||||||
|
mWorkObject = new WorkObject();
|
||||||
|
mWorkObject->moveToThread(mWorkThread);
|
||||||
|
connect(mWorkThread, &QThread::finished, mWorkThread, &QObject::deleteLater);
|
||||||
|
connect(mWorkThread, &QThread::finished, mWorkObject, &QObject::deleteLater);
|
||||||
|
connect(mWorkObject, &WorkObject::progress, myWidget, [=](double val) {ui.progressBar->SetDoubleFormatValue(QString::fromLocal8Bit("进度"), val); });
|
||||||
|
connect(mWorkObject, &WorkObject::trainFinished, this, &LandslideTrain::finished);
|
||||||
|
|
||||||
|
connect(this, &LandslideTrain::start, mWorkObject, &WorkObject::runTrainWork);
|
||||||
|
mWorkThread->start();
|
||||||
|
}
|
||||||
|
|
||||||
|
void LandslideTrain::ReadConfigHistoryPaths(QString strPath)
|
||||||
|
{
|
||||||
|
QSettings configIni(strPath, QSettings::IniFormat);
|
||||||
|
|
||||||
|
//打开标题为:[SldTrain] 的组,并读取出port字段的值
|
||||||
|
configIni.beginGroup("SldTrain");
|
||||||
|
|
||||||
|
ui.lineInModel->setText(configIni.value("RetrainModel").toString());
|
||||||
|
ui.lineInDataset->setText(configIni.value("SrcDom").toString());
|
||||||
|
ui.lineInLabel->setText(configIni.value("SrcLabel").toString());
|
||||||
|
ui.lineOutResult->setText(configIni.value("TrainResult").toString());
|
||||||
|
|
||||||
|
configIni.endGroup();//关闭组
|
||||||
|
}
|
||||||
|
|
||||||
|
void LandslideTrain::WriteConfigPaths(QString strPath)
|
||||||
|
{
|
||||||
|
QSettings configIni(strPath, QSettings::IniFormat);
|
||||||
|
configIni.setIniCodec("utf-8");
|
||||||
|
//打开标题为:[SldTrain] 的组
|
||||||
|
configIni.beginGroup("SldTrain");
|
||||||
|
|
||||||
|
//更新输入模型路径
|
||||||
|
QString temp = ui.lineInModel->text();
|
||||||
|
if (temp != "")
|
||||||
|
configIni.setValue("RetrainModel", temp);
|
||||||
|
//更新输入DOM路径
|
||||||
|
temp = ui.lineInDataset->text();
|
||||||
|
if (temp != "")
|
||||||
|
configIni.setValue("SrcDom", temp);
|
||||||
|
//更新输入Label路径
|
||||||
|
temp = ui.lineInLabel->text();
|
||||||
|
if (temp != "")
|
||||||
|
configIni.setValue("SrcLabel", temp);
|
||||||
|
//更新输出结果路径
|
||||||
|
temp = ui.lineOutResult->text();
|
||||||
|
if (temp != "")
|
||||||
|
configIni.setValue("TrainResult", temp);
|
||||||
|
|
||||||
|
configIni.endGroup();//关闭组
|
||||||
|
}
|
||||||
|
|
||||||
|
void LandslideTrain::readAndStart()
|
||||||
|
{
|
||||||
|
QString inDataset = ui.lineInDataset->text();
|
||||||
|
QString inLabel=ui.lineInLabel->text();
|
||||||
|
QString inModel=ui.lineInModel->text();
|
||||||
|
QString outResult=ui.lineOutResult->text();
|
||||||
|
|
||||||
|
if (inDataset == "" || inLabel == "" || inModel == "" || outResult == "")
|
||||||
|
{
|
||||||
|
QMessageBox mess(QMessageBox::NoIcon, QString::fromLocal8Bit("错误"), QString::fromLocal8Bit("请检查输入输出路径"));
|
||||||
|
mess.setWindowFlags(Qt::Drawer);
|
||||||
|
int result = mess.exec();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ui.progressBar->SetDoubleFormatValue(QString::fromLocal8Bit("进度"), 0);
|
||||||
|
|
||||||
|
QDir inDatasetDir(inDataset);
|
||||||
|
if (!inDatasetDir.exists())
|
||||||
|
{
|
||||||
|
QMessageBox mess(QMessageBox::NoIcon, QString::fromLocal8Bit("错误"), QString::fromLocal8Bit("训练数据文件夹不存在"));
|
||||||
|
mess.setWindowFlags(Qt::Drawer);
|
||||||
|
int result = mess.exec();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QDir inLabelDir(inLabel);
|
||||||
|
if (!inLabelDir.exists())
|
||||||
|
{
|
||||||
|
QMessageBox mess(QMessageBox::NoIcon, QString::fromLocal8Bit("错误"), QString::fromLocal8Bit("标签数据文件夹不存在"));
|
||||||
|
mess.setWindowFlags(Qt::Drawer);
|
||||||
|
int result = mess.exec();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QDir outModelDir(outResult);
|
||||||
|
if (!outModelDir.exists())
|
||||||
|
{
|
||||||
|
QMessageBox mess(QMessageBox::NoIcon, QString::fromLocal8Bit("错误"), QString::fromLocal8Bit("模型输出文件夹不存在"));
|
||||||
|
mess.setWindowFlags(Qt::Drawer);
|
||||||
|
int result = mess.exec();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (executeGenData && executeTrain)
|
||||||
|
qDebug() << "executeGenData & executeTrain";
|
||||||
|
if (executeGenData && (!executeTrain))
|
||||||
|
qDebug() << "executeGenData, not executeTrain";
|
||||||
|
if ((!executeGenData) && executeTrain)
|
||||||
|
{
|
||||||
|
//判断train文件夹下有无训练集文件夹
|
||||||
|
QDir dirImage(outResult + "/Images");
|
||||||
|
QDir dirLabel(outResult + "/Labels");
|
||||||
|
if (!dirImage.exists() || !dirLabel.exists())
|
||||||
|
{
|
||||||
|
QMessageBox mess(QMessageBox::NoIcon, QString::fromLocal8Bit("错误"),
|
||||||
|
QString::fromLocal8Bit("未找到训练集文件夹\n确保Images和Labels在以下路径中: \n") + outResult);
|
||||||
|
mess.setWindowFlags(Qt::Drawer);
|
||||||
|
int result = mess.exec();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//判断文件是否匹配
|
||||||
|
QStringList imgList = getAllFiles(outResult + "/Images", "tif");
|
||||||
|
QStringList labelList = getAllFiles(outResult + "/Labels", "tif");
|
||||||
|
if (imgList.size() == 0 || labelList.size() == 0)
|
||||||
|
{
|
||||||
|
QMessageBox mess(QMessageBox::NoIcon, QString::fromLocal8Bit("错误"),
|
||||||
|
QString::fromLocal8Bit("训练集文件夹内为空"));
|
||||||
|
mess.setWindowFlags(Qt::Drawer);
|
||||||
|
int result = mess.exec();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (imgList.size() != labelList.size())
|
||||||
|
{
|
||||||
|
QMessageBox mess(QMessageBox::NoIcon, QString::fromLocal8Bit("错误"),
|
||||||
|
QString::fromLocal8Bit("训练集Images、Labels文件夹内文件不匹配"));
|
||||||
|
mess.setWindowFlags(Qt::Drawer);
|
||||||
|
int result = mess.exec();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ui.lineEpoch1->text() == "" || ui.lineEpoch2->text() == "")
|
||||||
|
{
|
||||||
|
QMessageBox mess(QMessageBox::NoIcon, QString::fromLocal8Bit("错误"), QString::fromLocal8Bit("请输入正确的训练轮数"));
|
||||||
|
mess.setWindowFlags(Qt::Drawer);
|
||||||
|
int result = mess.exec();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QString epoch1 = ui.lineEpoch1->text();
|
||||||
|
QString epoch2 = ui.lineEpoch2->text();
|
||||||
|
|
||||||
|
if (mWorkThread == nullptr)
|
||||||
|
{
|
||||||
|
qDebug() << "--startThread";
|
||||||
|
startWorkThread();
|
||||||
|
}
|
||||||
|
|
||||||
|
emit start(inModel, inDataset, inLabel, outResult, executeGenData, executeTrain, epoch1, epoch2);
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList LandslideTrain::getAllFiles(QString path, QString fileType)
|
||||||
|
{
|
||||||
|
QDir dir(path);
|
||||||
|
if (!dir.exists())
|
||||||
|
return QStringList();
|
||||||
|
dir.setFilter(QDir::Files | QDir::NoSymLinks);
|
||||||
|
QFileInfoList list = dir.entryInfoList();
|
||||||
|
|
||||||
|
int file_count = list.count();
|
||||||
|
if (file_count <= 0)
|
||||||
|
return QStringList();
|
||||||
|
QStringList files;
|
||||||
|
for (int i = 0; i < file_count; i++)
|
||||||
|
{
|
||||||
|
QFileInfo file_info = list.at(i);
|
||||||
|
QString suffix = file_info.suffix();
|
||||||
|
if (QString::compare(suffix, QString(fileType), Qt::CaseInsensitive) == 0)
|
||||||
|
{
|
||||||
|
QString absolute_file_path = file_info.absoluteFilePath();
|
||||||
|
files.append(absolute_file_path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return files;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LandslideTrain::finished()
|
||||||
|
{
|
||||||
|
QMessageBox mess(QMessageBox::NoIcon,
|
||||||
|
QString::fromLocal8Bit("运行结束"),
|
||||||
|
QString::fromLocal8Bit("结果文件生成路径\n") + ui.lineOutResult->text(),
|
||||||
|
QMessageBox::Ok, NULL);
|
||||||
|
mess.setWindowFlags(Qt::Drawer);
|
||||||
|
mess.setButtonText(QMessageBox::Ok, QString::fromLocal8Bit("确认"));
|
||||||
|
int result = mess.exec();
|
||||||
|
|
||||||
|
pbCancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
void LandslideTrain::pbCancel()
|
||||||
|
{
|
||||||
|
//qDebug() << "--pbtCancel";
|
||||||
|
delete myWidget;//调起&QDialog::destroyed
|
||||||
|
}
|
||||||
|
|
||||||
|
void LandslideTrain::chooseInModel()
|
||||||
|
{
|
||||||
|
QString dirModel = QFileDialog::getOpenFileName(ui.pbtInModel, QString::fromLocal8Bit("选择输入初始训练模型文件"), "", "*.pth");
|
||||||
|
if (dirModel != "")
|
||||||
|
ui.lineInModel->setText(dirModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LandslideTrain::chooseInDataset()
|
||||||
|
{
|
||||||
|
QString dirDataset = QFileDialog::getExistingDirectory(ui.pbtInDataset, QString::fromLocal8Bit("选择输入训练数据路径"), "");
|
||||||
|
if (dirDataset != "")
|
||||||
|
ui.lineInDataset->setText(dirDataset);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LandslideTrain::chooseInLabel()
|
||||||
|
{
|
||||||
|
QString dirLabel = QFileDialog::getExistingDirectory(ui.pbtInLabel, QString::fromLocal8Bit("选择输入标签数据路径"), "");
|
||||||
|
if (dirLabel != "")
|
||||||
|
ui.lineInLabel->setText(dirLabel);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LandslideTrain::chooseResultPath()
|
||||||
|
{
|
||||||
|
QString dirResult = QFileDialog::getExistingDirectory(ui.pbtOutResult, QString::fromLocal8Bit("选择输出模型文件路径"), "");
|
||||||
|
if (dirResult != "")
|
||||||
|
ui.lineOutResult->setText(dirResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
void WorkObject::runTrainWork(QString inModel, QString dataset, QString label, QString outModel, bool gen, bool train, QString epoch1, QString epoch2)
|
||||||
|
{
|
||||||
|
QDir pluginsDir = QDir(qApp->applicationDirPath());
|
||||||
|
if (!pluginsDir.cd("models\\envs"))
|
||||||
|
{
|
||||||
|
qDebug() << "no folder models\\envs";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QString exeDirName = pluginsDir.absoluteFilePath("train_3c_landslide.exe");
|
||||||
|
|
||||||
|
QString inDom = " --dom_path " + dataset + "/";
|
||||||
|
QString inLabel = " --label_path " + label + "/";
|
||||||
|
QString trainedModel = " --retrained_model " + inModel;
|
||||||
|
QString save_model = " --save_model " + outModel + "/";
|
||||||
|
QString strMid, strTrain;
|
||||||
|
if (gen)
|
||||||
|
strMid = " --exe_mid True ";
|
||||||
|
else
|
||||||
|
strMid = " --exe_mid False ";
|
||||||
|
if (train)
|
||||||
|
strTrain = " --exe_train True";
|
||||||
|
else
|
||||||
|
strTrain = " --exe_train False";
|
||||||
|
QString strEpoch1, strEpoch2;
|
||||||
|
strEpoch1 = " --epoch1 " + epoch1;
|
||||||
|
strEpoch2 = " --epoch2 " + epoch2;
|
||||||
|
|
||||||
|
QString ss = exeDirName + inDom + inLabel + trainedModel + save_model + strMid + strTrain + strEpoch1 + strEpoch2;
|
||||||
|
qDebug() << ss;
|
||||||
|
QProcess* pProces = new QProcess(this);
|
||||||
|
connect(pProces, SIGNAL(readyReadStandardOutput()), this, SLOT(on_read()));
|
||||||
|
|
||||||
|
pProces->start(ss);
|
||||||
|
}
|
||||||
|
|
||||||
|
void WorkObject::on_read()
|
||||||
|
{
|
||||||
|
mProcess = (QProcess*)sender();
|
||||||
|
QString output = QString::fromLocal8Bit(mProcess->readAllStandardOutput());
|
||||||
|
if (output.toDouble() > 0)
|
||||||
|
{
|
||||||
|
qDebug() << "exe out:" << output.toDouble();
|
||||||
|
emit progress(output.toDouble());
|
||||||
|
if (output.toDouble() == 100.0)
|
||||||
|
{
|
||||||
|
delete mProcess;
|
||||||
|
mProcess = nullptr;
|
||||||
|
emit trainFinished();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
qDebug() << "Unresolved exe out:" << output;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WorkObject::on_cancel()
|
||||||
|
{
|
||||||
|
if (mProcess == nullptr)
|
||||||
|
{
|
||||||
|
qDebug() << "--mProcess null";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QString KillStr = "taskkill /f /im train_3c_landslide.exe";
|
||||||
|
mProcess->startDetached(KillStr);
|
||||||
|
qDebug() << "--kill Process";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QtWidgets/QDialog>
|
#include <QtWidgets/QDialog>
|
||||||
#include "ui_LandslideAssess.h"
|
#include "ui_LandslideTrain.h"
|
||||||
|
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
@@ -11,9 +11,15 @@
|
|||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
#include <QIntValidator>
|
||||||
|
|
||||||
#include "SrsMainPluginInterFace.h"
|
#include "SrsMainPluginInterFace.h"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
|
||||||
class WorkObject :public QObject
|
class WorkObject :public QObject
|
||||||
{
|
{
|
||||||
@@ -22,26 +28,27 @@ class WorkObject :public QObject
|
|||||||
public:
|
public:
|
||||||
void on_cancel();
|
void on_cancel();
|
||||||
|
|
||||||
signals:
|
|
||||||
void progress(int value);
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void runAssessWork(QString model, QString PRE, QString label, QString index, QString result);
|
void runTrainWork(QString inModel, QString inDataset, QString label, QString outModel, bool gen, bool train, QString epoch1, QString epoch2);
|
||||||
void writeAssessTxt();
|
void on_read();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void progress(double value);
|
||||||
|
void trainFinished();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QProcess* mProcess = nullptr;
|
QProcess* mProcess = nullptr;
|
||||||
QString assess_txt_path;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class LandslideAssess : public SrsMainInterface
|
class LandslideTrain : public SrsMainInterface
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_INTERFACES(SrsMainInterface)
|
Q_INTERFACES(SrsMainInterface)
|
||||||
Q_PLUGIN_METADATA(IID MainInterface_iid)
|
Q_PLUGIN_METADATA(IID MainInterface_iid)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LandslideAssess();
|
LandslideTrain();
|
||||||
|
|
||||||
virtual QString PannelName() override;
|
virtual QString PannelName() override;
|
||||||
virtual QString CategoryName() override;
|
virtual QString CategoryName() override;
|
||||||
@@ -54,31 +61,36 @@ public:
|
|||||||
|
|
||||||
void startWorkThread();
|
void startWorkThread();
|
||||||
|
|
||||||
|
QStringList getAllFiles(QString path, QString fileType);
|
||||||
|
|
||||||
//读json文件,获取历史存储的路径
|
//读json文件,获取历史存储的路径
|
||||||
void ReadConfigHistoryPaths(QString strPath);
|
void ReadConfigHistoryPaths(QString strPath);
|
||||||
//保存本次打开的路径到json文件
|
//保存本次打开的路径到json文件
|
||||||
void WriteConfigPaths(QString strPath);
|
void WriteConfigPaths(QString strPath);
|
||||||
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void startPreAssessment(QString model, QString prefile, QString label, QString index, QString result);
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void readAndStart();
|
void readAndStart();
|
||||||
void pbCancel();
|
void pbCancel();
|
||||||
|
|
||||||
void choosePredictPath();
|
void chooseInModel();
|
||||||
void chooseLabelPath();
|
void chooseInDataset();
|
||||||
void chooseAssessFile();
|
void chooseInLabel();
|
||||||
void chooseModelFile();
|
|
||||||
void chooseResultPath();
|
void chooseResultPath();
|
||||||
|
|
||||||
|
void finished();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void start(QString inModel, QString inDataset, QString label, QString outModel, bool gen, bool train, QString epoch1, QString epoch2);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::LandslideAssessClass ui;
|
Ui::LandslideTrainClass ui;
|
||||||
|
|
||||||
QDialog* myWidget = nullptr;
|
QDialog* myWidget = nullptr;
|
||||||
|
|
||||||
WorkObject* mWorker = nullptr;
|
|
||||||
QThread* mWorkThread = nullptr;
|
QThread* mWorkThread = nullptr;
|
||||||
|
WorkObject* mWorkObject = nullptr;
|
||||||
|
|
||||||
|
bool executeGenData = true;
|
||||||
|
bool executeTrain = true;
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<RCC>
|
||||||
|
<qresource prefix="/LandslideTrain">
|
||||||
|
<file>resources/dem_vec.svg</file>
|
||||||
|
<file>LandslideTrain.qss</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
||||||
@@ -22,7 +22,7 @@ QLabel{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*----QPushButtonÑùʽ±í*/
|
/*----QPushButtonÑùʽ±í*/
|
||||||
#pushButton_ok, #pushButton_cancel, #pbtInDataset, #pbtInLabel, #pbtInModel, #pbtIndex,#pbtResult{
|
#pushButton_ok, #pushButton_cancel, #pbtInModel, #pbtInDataset, #pbtInDsm, #pbtInLabel, #pbtOutResult{
|
||||||
font-family:'Microsoft YaHei';
|
font-family:'Microsoft YaHei';
|
||||||
font-size:12px;
|
font-size:12px;
|
||||||
background-color: #ffffff;
|
background-color: #ffffff;
|
||||||
@@ -34,35 +34,35 @@ QLabel{
|
|||||||
#pushButton_ok, #pushButton_cancel{
|
#pushButton_ok, #pushButton_cancel{
|
||||||
min-width:36px;
|
min-width:36px;
|
||||||
}
|
}
|
||||||
#pushButton_ok:hover, #pushButton_cancel:hover, #pbtInDataset:hover, #pbtInLabel:hover, #pbtInModel:hover, #pbtIndex:hover,#pbtResult:hover{
|
#pushButton_ok:hover, #pushButton_cancel:hover, #pbtInModel:hover, #pbtInDataset:hover, #pbtInLabel:hover,#pbtOutResult:hover{
|
||||||
background-color: #ecf5ff;
|
background-color: #ecf5ff;
|
||||||
color: #409eff;
|
color: #409eff;
|
||||||
}
|
}
|
||||||
#pushButton_ok:pressed, #pushButton_cancel:pressed, #pbtInDataset:pressed, #pbtInLabel:pressed, #pbtInModel:pressed, #pbtIndex:pressed,#pbtResult:pressed{
|
#pushButton_ok:pressed, #pushButton_cancel:pressed, #pbtInModel:pressed, #pbtInDataset:pressed, #pbtInLabel:pressed,#pbtOutResult:pressed{
|
||||||
border: 1px solid #3a8ee6;
|
border: 1px solid #3a8ee6;
|
||||||
color: #409eff;
|
color: #409eff;
|
||||||
}
|
}
|
||||||
#pushButton_ok:checked, #pushButton_cancel:checked, #pbtInDataset:checked, #pbtInLabel:checked, #pbtInModel:checked, #pbtIndex:checked,#pbtResult:checked{
|
#pushButton_ok:checked, #pushButton_cancel:checked, #pbtInModel:checked, #pbtInDataset:checked, #pbtInLabel:checked,#pbtOutResult:checked{
|
||||||
border: 1px solid #3a8ee6;
|
border: 1px solid #3a8ee6;
|
||||||
color: #409eff;
|
color: #409eff;
|
||||||
}
|
}
|
||||||
#pushButton_ok:focus, #pushButton_cancel:focus, #pbtInDataset:focus, #pbtInLabel:focus, #pbtInModel:focus, #pbtIndex:focus,#pbtResult:focus{
|
#pushButton_ok:focus, #pushButton_cancel:focus, #pbtInModel:focus, #pbtInDataset:focus, #pbtInLabel:focus,#pbtOutResult:focus{
|
||||||
border: 1px solid #3a8ee6;
|
border: 1px solid #3a8ee6;
|
||||||
color: #409eff;
|
color: #409eff;
|
||||||
outline: none;
|
outline: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*----QLineEditÑùʽ*/
|
/*----QLineEditÑùʽ*/
|
||||||
#lineInDataset, #lineInLabel, #lineInModel, #lineIndex, #lineResult{
|
#lineInModel, #lineInDataset, #lineOutResult, #lineInLabel, #lineEpoch1, #lineEpoch2{
|
||||||
border:0px;
|
border:0px;
|
||||||
border-bottom: 1px solid #B3B3B3;
|
border-bottom: 1px solid #B3B3B3;
|
||||||
font-family:'Microsoft YaHei';
|
font-family:'Microsoft YaHei';
|
||||||
font-size:12px;
|
font-size:12px;
|
||||||
background-color:transparent;
|
background-color:transparent;
|
||||||
}
|
}
|
||||||
#lineInDataset:hover, #lineInLabel:hover, #lineInModel:hover, #lineIndex:hover, #lineResult:hover{
|
#lineInModel:hover, #lineInDataset:hover, #lineOutResult:hover, #lineInLabel:hover, #lineEpoch1:hover, #lineEpoch2:hover{
|
||||||
border-bottom: 2px solid #66A3FF;
|
border-bottom: 2px solid #66A3FF;
|
||||||
}
|
}
|
||||||
#lineInDataset:focus, #lineInLabel:focus, #lineInModel:focus, #lineIndex:focus, #lineResult:focus{
|
#lineInModel:focus, #lineInDataset:focus, #lineOutResult:focus, #lineInLabel:focus, #lineEpoch1:focus, #lineEpoch2:focus{
|
||||||
border-bottom: 2px solid #7666FF;
|
border-bottom: 2px solid #7666FF;
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>LandslideAssessClass</class>
|
<class>LandslideTrainClass</class>
|
||||||
<widget class="QDialog" name="LandslideAssessClass">
|
<widget class="QDialog" name="LandslideTrainClass">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
@@ -10,14 +10,32 @@
|
|||||||
<height>300</height>
|
<height>300</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>500</width>
|
||||||
|
<height>300</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>500</width>
|
||||||
|
<height>300</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>LandslideAssess</string>
|
<string>LandslideTrain</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="0" column="0">
|
<item row="3" column="1">
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLineEdit" name="lineOutResult"/>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLineEdit" name="lineInModel"/>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
@@ -25,12 +43,31 @@
|
|||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>输入模型文件路径</string>
|
<string>输入训练数据路径</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="1" column="1">
|
||||||
<widget class="QLineEdit" name="lineInModel"/>
|
<widget class="QLineEdit" name="lineInDataset"/>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="2">
|
||||||
|
<widget class="QPushButton" name="pbtInLabel">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>75</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>75</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>打开文件夹</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2">
|
<item row="0" column="2">
|
||||||
<widget class="QPushButton" name="pbtInModel">
|
<widget class="QPushButton" name="pbtInModel">
|
||||||
@@ -47,12 +84,12 @@
|
|||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>选择文件</string>
|
<string>打开文件</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="label">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
@@ -60,34 +97,12 @@
|
|||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>输入验证文件索引</string>
|
<string>输入初始训练模型路径</string>
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QLineEdit" name="lineIndex"/>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="2">
|
|
||||||
<widget class="QPushButton" name="pbtIndex">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>75</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>75</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>选择文件</string>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="2" column="0">
|
||||||
<widget class="QLabel" name="label_5">
|
<widget class="QLabel" name="label_3">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
@@ -95,14 +110,24 @@
|
|||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>输入验证文件路径</string>
|
<string>输入标签数据路径</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<item row="3" column="0">
|
||||||
<widget class="QLineEdit" name="lineInDataset"/>
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>输出模型文件路径</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="2">
|
<item row="1" column="2">
|
||||||
<widget class="QPushButton" name="pbtInDataset">
|
<widget class="QPushButton" name="pbtInDataset">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
@@ -117,28 +142,15 @@
|
|||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>选择文件夹</string>
|
<string>打开文件夹</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="2" column="1">
|
||||||
<widget class="QLabel" name="label_3">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>输入标签文件路径</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="1">
|
|
||||||
<widget class="QLineEdit" name="lineInLabel"/>
|
<widget class="QLineEdit" name="lineInLabel"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="2">
|
<item row="3" column="2">
|
||||||
<widget class="QPushButton" name="pbtInLabel">
|
<widget class="QPushButton" name="pbtOutResult">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>75</width>
|
<width>75</width>
|
||||||
@@ -152,42 +164,51 @@
|
|||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>选择文件夹</string>
|
<string>打开文件夹</string>
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="0">
|
|
||||||
<widget class="QLabel" name="label_4">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>评估结果输出路径</string>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="1">
|
<item row="4" column="1">
|
||||||
<widget class="QLineEdit" name="lineResult"/>
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
</item>
|
<item>
|
||||||
<item row="4" column="2">
|
<widget class="QLineEdit" name="lineEpoch1">
|
||||||
<widget class="QPushButton" name="pbtResult">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>75</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>75</width>
|
<width>80</width>
|
||||||
<height>16777215</height>
|
<height>16777215</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_6">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>选择文件夹</string>
|
<string>解冻训练次数</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEpoch2">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>80</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="text">
|
||||||
|
<string>冻结训练次数</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -195,14 +216,37 @@
|
|||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>40</number>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer_2">
|
<widget class="QCheckBox" name="checkBoxGenData">
|
||||||
|
<property name="text">
|
||||||
|
<string>生成训练集、验证集</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBoxTrain">
|
||||||
|
<property name="text">
|
||||||
|
<string>模型训练</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>133</width>
|
<width>40</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
@@ -216,7 +260,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer">
|
<spacer name="horizontalSpacer_2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
@@ -241,7 +285,7 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="2" column="0">
|
||||||
<widget class="QProgressBar" name="progressBar">
|
<widget class="CProgressBar" name="progressBar">
|
||||||
<property name="value">
|
<property name="value">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
@@ -250,22 +294,31 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>CProgressBar</class>
|
||||||
|
<extends>QProgressBar</extends>
|
||||||
|
<header>CProgressBar.h</header>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>lineInModel</tabstop>
|
<tabstop>lineInModel</tabstop>
|
||||||
<tabstop>pbtInModel</tabstop>
|
<tabstop>pbtInModel</tabstop>
|
||||||
<tabstop>lineIndex</tabstop>
|
|
||||||
<tabstop>pbtIndex</tabstop>
|
|
||||||
<tabstop>lineInDataset</tabstop>
|
<tabstop>lineInDataset</tabstop>
|
||||||
<tabstop>pbtInDataset</tabstop>
|
<tabstop>pbtInDataset</tabstop>
|
||||||
<tabstop>lineInLabel</tabstop>
|
<tabstop>lineInLabel</tabstop>
|
||||||
<tabstop>pbtInLabel</tabstop>
|
<tabstop>pbtInLabel</tabstop>
|
||||||
<tabstop>lineResult</tabstop>
|
<tabstop>lineOutResult</tabstop>
|
||||||
<tabstop>pbtResult</tabstop>
|
<tabstop>pbtOutResult</tabstop>
|
||||||
|
<tabstop>lineEpoch1</tabstop>
|
||||||
|
<tabstop>lineEpoch2</tabstop>
|
||||||
|
<tabstop>checkBoxGenData</tabstop>
|
||||||
|
<tabstop>checkBoxTrain</tabstop>
|
||||||
<tabstop>pushButton_ok</tabstop>
|
<tabstop>pushButton_ok</tabstop>
|
||||||
<tabstop>pushButton_cancel</tabstop>
|
<tabstop>pushButton_cancel</tabstop>
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="LandslideAssess.qrc"/>
|
<include location="LandslideTrain.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<ProjectGuid>{AEAE6E5B-D14B-46CB-BF18-3375936B7CD2}</ProjectGuid>
|
<ProjectGuid>{1D23BAC7-1D1A-48BE-9796-93F34E435A5A}</ProjectGuid>
|
||||||
<Keyword>QtVS_v304</Keyword>
|
<Keyword>QtVS_v304</Keyword>
|
||||||
<WindowsTargetPlatformVersion Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">10.0</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">10.0</WindowsTargetPlatformVersion>
|
||||||
<QtMsBuild Condition="'$(QtMsBuild)'=='' OR !Exists('$(QtMsBuild)\qt.targets')">$(MSBuildProjectDirectory)\QtMsBuild</QtMsBuild>
|
<QtMsBuild Condition="'$(QtMsBuild)'=='' OR !Exists('$(QtMsBuild)\qt.targets')">$(MSBuildProjectDirectory)\QtMsBuild</QtMsBuild>
|
||||||
@@ -37,9 +37,9 @@
|
|||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||||
<TargetName>landslide2_assess</TargetName>
|
|
||||||
<IncludePath>D:\qgis\osgeo4w\include;D:\qgis\osgeo4w\apps\Qt5\include;$(IncludePath)</IncludePath>
|
<IncludePath>D:\qgis\osgeo4w\include;D:\qgis\osgeo4w\apps\Qt5\include;$(IncludePath)</IncludePath>
|
||||||
<LibraryPath>D:\qgis\osgeo4w\lib;D:\qgis\osgeo4w\apps\Qt5\lib;$(LibraryPath)</LibraryPath>
|
<LibraryPath>D:\qgis\osgeo4w\lib;D:\qgis\osgeo4w\apps\Qt5\lib;$(LibraryPath)</LibraryPath>
|
||||||
|
<TargetName>landslide1_train</TargetName>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'" Label="Configuration">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'" Label="Configuration">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
@@ -55,20 +55,22 @@
|
|||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<QtRcc Include="LandslideAssess.qrc" />
|
<QtRcc Include="LandslideTrain.qrc" />
|
||||||
<QtUic Include="LandslideAssess.ui" />
|
<QtUic Include="LandslideTrain.ui" />
|
||||||
<QtMoc Include="LandslideAssess.h" />
|
<QtMoc Include="LandslideTrain.h" />
|
||||||
<ClCompile Include="LandslideAssess.cpp" />
|
<ClCompile Include="CProgressBar.cpp" />
|
||||||
|
<ClCompile Include="LandslideTrain.cpp" />
|
||||||
<ClCompile Include="main.cpp" />
|
<ClCompile Include="main.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<QtMoc Include="SrsMainPluginInterFace.h" />
|
<QtMoc Include="SrsMainPluginInterFace.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="x64\Release\uic\ui_LandslideAssess.h" />
|
<QtMoc Include="CProgressBar.h" />
|
||||||
|
<ClInclude Include="x64\Release\uic\ui_LandslideTrain.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="LandslideAssess.qss" />
|
<None Include="LandslideTrain.qss" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')">
|
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')">
|
||||||
+12
-6
@@ -23,16 +23,16 @@
|
|||||||
</Filter>
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<QtRcc Include="LandslideAssess.qrc">
|
<QtRcc Include="LandslideTrain.qrc">
|
||||||
<Filter>Resource Files</Filter>
|
<Filter>Resource Files</Filter>
|
||||||
</QtRcc>
|
</QtRcc>
|
||||||
<QtUic Include="LandslideAssess.ui">
|
<QtUic Include="LandslideTrain.ui">
|
||||||
<Filter>Form Files</Filter>
|
<Filter>Form Files</Filter>
|
||||||
</QtUic>
|
</QtUic>
|
||||||
<QtMoc Include="LandslideAssess.h">
|
<QtMoc Include="LandslideTrain.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</QtMoc>
|
</QtMoc>
|
||||||
<ClCompile Include="LandslideAssess.cpp">
|
<ClCompile Include="LandslideTrain.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
@@ -40,19 +40,25 @@
|
|||||||
<ClCompile Include="main.cpp">
|
<ClCompile Include="main.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="CProgressBar.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<QtMoc Include="SrsMainPluginInterFace.h">
|
<QtMoc Include="SrsMainPluginInterFace.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</QtMoc>
|
</QtMoc>
|
||||||
|
<QtMoc Include="CProgressBar.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</QtMoc>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="x64\Release\uic\ui_LandslideAssess.h">
|
<ClInclude Include="x64\Release\uic\ui_LandslideTrain.h">
|
||||||
<Filter>Form Files</Filter>
|
<Filter>Form Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="LandslideAssess.qss">
|
<None Include="LandslideTrain.qss">
|
||||||
<Filter>Resource Files</Filter>
|
<Filter>Resource Files</Filter>
|
||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
#include "LandslideAssess.h"
|
#include "LandslideTrain.h"
|
||||||
#include <QtWidgets/QApplication>
|
#include <QtWidgets/QApplication>
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
LandslideAssess w;
|
LandslideTrain w;
|
||||||
w.CenterWidget()->show();
|
w.CenterWidget()->show();
|
||||||
return a.exec();
|
return a.exec();
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1650520802998" class="icon" viewBox="0 0 1132 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5053" width="28.7421875" height="26" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><style type="text/css">@font-face { font-family: feedback-iconfont; src: url("//at.alicdn.com/t/font_1031158_u69w8yhxdu.woff2?t=1630033759944") format("woff2"), url("//at.alicdn.com/t/font_1031158_u69w8yhxdu.woff?t=1630033759944") format("woff"), url("//at.alicdn.com/t/font_1031158_u69w8yhxdu.ttf?t=1630033759944") format("truetype"); }
|
||||||
|
</style></defs><path d="M1131.403629 583.018705c1.939725-47.361608-39.010016-64.495842-39.010017-64.495842l-226.408963-105.391702s0.538812-182.926804 0-232.120374a73.440128 73.440128 0 0 0-40.949741-66.651092S645.82591 35.80085 592.645128 6.974387c-27.694956-15.086747-56.5753 0-56.5753 0S367.529315 89.035513 315.480039 112.312208c-47.577133 21.229208-46.876677 66.651092-46.876677 66.651092V411.891892S120.160551 482.476314 57.873839 509.524696C-1.71881 535.333809 0.005389 589.592216 0.005389 589.592216s0.538812 185.890272 0 234.275623c-0.538812 52.264801 42.350653 68.806341 42.350654 68.806342s143.862906 80.06752 212.669247 114.713156c50.91777 25.539707 83.946969 0.646575 83.946969 0.646575l226.085675-122.525936s178.777948 92.67573 220.859195 121.879361c48.816402 33.729655 82.007245 5.65753 82.007245 5.65753s199.198938-111.156994 230.288412-126.836435c33.298605-16.703184 33.298605-58.030094 33.298605-58.030094s-2.047487-197.905788-0.107762-245.159633zM299.85448 675.371147l-206.903955-99.895816 206.903955-99.949696 210.783404 98.925953-210.783404 100.919559z m232.282018 148.335049l-199.091175 109.594438v-195.696657l199.091175-94.561573v180.663792z m32.705911-537.357589L340.911983 181.010787l223.930426-108.840101 232.766949 108.840101-232.766949 105.391702z m35.66938 64.38808l197.043688-94.561573v159.057415L600.511789 512.110995V350.790568z m235.137723 324.63446l-205.82633-99.895816 197.151451-99.949696 214.662853 99.949696-205.987974 99.895816z m227.378825 154.800797l-195.211725 103.12869v-195.696657l195.211725-94.561573v187.12954z" p-id="5054" fill="#2c2c2c"></path></svg>
|
||||||
|
After Width: | Height: | Size: 2.2 KiB |
Reference in New Issue
Block a user