97 lines
1.9 KiB
C++
97 lines
1.9 KiB
C++
#pragma once
|
||
|
||
#include <QtWidgets/QDialog>
|
||
#include "ui_LandslideTrain.h"
|
||
|
||
#include <QProcess>
|
||
#include <QThread>
|
||
#include <QFile>
|
||
#include <QIcon>
|
||
#include <QDebug>
|
||
#include <QMessageBox>
|
||
#include <QFileDialog>
|
||
#include <QStringList>
|
||
#include <QIntValidator>
|
||
|
||
#include "SrsMainPluginInterFace.h"
|
||
|
||
#include <string>
|
||
#include <iostream>
|
||
|
||
using namespace std;
|
||
|
||
|
||
class WorkObject :public QObject
|
||
{
|
||
Q_OBJECT
|
||
|
||
public:
|
||
void on_cancel();
|
||
|
||
public slots:
|
||
void runTrainWork(QString inModel, QString inDataset, QString label, QString outModel, bool gen, bool train, QString epoch1, QString epoch2);
|
||
void on_read();
|
||
|
||
signals:
|
||
void progress(double value);
|
||
void trainFinished();
|
||
|
||
private:
|
||
QProcess* mProcess = nullptr;
|
||
|
||
};
|
||
|
||
class LandslideTrain : public SrsMainInterface
|
||
{
|
||
Q_OBJECT
|
||
Q_INTERFACES(SrsMainInterface)
|
||
Q_PLUGIN_METADATA(IID MainInterface_iid)
|
||
|
||
public:
|
||
LandslideTrain();
|
||
|
||
virtual QString PannelName() override;
|
||
virtual QString CategoryName() override;
|
||
|
||
virtual QString EnglishName() override;
|
||
virtual QString ChineseName() override;
|
||
virtual QString Information() override;
|
||
virtual QString IconPath() override;
|
||
virtual QWidget* CenterWidget() override;
|
||
|
||
void startWorkThread();
|
||
|
||
QStringList getAllFiles(QString path, QString fileType);
|
||
|
||
//读json文件,获取历史存储的路径
|
||
void ReadConfigHistoryPaths(QString strPath);
|
||
//保存本次打开的路径到json文件
|
||
void WriteConfigPaths(QString strPath);
|
||
|
||
public slots:
|
||
void readAndStart();
|
||
void pbCancel();
|
||
|
||
void chooseInModel();
|
||
void chooseInDataset();
|
||
void chooseInLabel();
|
||
void chooseResultPath();
|
||
|
||
void finished();
|
||
|
||
signals:
|
||
void start(QString inModel, QString inDataset, QString label, QString outModel, bool gen, bool train, QString epoch1, QString epoch2);
|
||
|
||
private:
|
||
Ui::LandslideTrainClass ui;
|
||
|
||
QDialog* myWidget = nullptr;
|
||
|
||
QThread* mWorkThread = nullptr;
|
||
WorkObject* mWorkObject = nullptr;
|
||
|
||
bool executeGenData = true;
|
||
bool executeTrain = true;
|
||
|
||
};
|