-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwidget.cpp
More file actions
42 lines (34 loc) · 1.11 KB
/
widget.cpp
File metadata and controls
42 lines (34 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "widget.h"
#include <QtWidgets/QFileDialog>
#include "mmod.h"
#include "ui_widget.h"
Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget) {
ui->setupUi(this);
}
Widget::~Widget() { delete ui; }
void Widget::setObjectPixmap(QPixmap pixmap) {
ui->objectPixmap->setPixmap(pixmap);
}
void Widget::setMMOD(Annotator::Plugins::MMOD *mmod) { this->mmod = mmod; }
void Widget::setProgress(int percent) { ui->progressBar->setValue(percent); }
void Widget::on_trainButton_clicked() {
if (training) {
training = false;
ui->trainButton->setText(tr("Train"));
this->mmod->stop();
} else {
ui->trainButton->setText(tr("Stop Training"));
training = true;
this->mmod->train();
}
}
void Widget::on_saveButton_clicked() {
QString fileName = QFileDialog::getSaveFileName(
this, tr("Save Trained File"), "", tr("dnn Net Data (*.dat)"));
mmod->saveNet(fileName.toStdString());
}
void Widget::on_loadButton_clicked() {
QString fileName = QFileDialog::getOpenFileName(
this, tr("Load Trained File"), "", tr("dnn Net Data (*.dat)"));
mmod->loadNet(fileName.toStdString());
}