forked from andrewbalan/Neural-network-Qt-C-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
readmnist.cpp
44 lines (35 loc) · 922 Bytes
/
readmnist.cpp
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
43
44
#include "readmnist.h"
#include "ui_readmnist.h"
ReadMNIST::ReadMNIST(QWidget *parent) :
QWidget(parent),
ui(new Ui::ReadMNIST)
{
label = 0;
ui->setupUi(this);
}
ReadMNIST::~ReadMNIST()
{
delete ui;
}
void ReadMNIST::setDataSrc(DataSource *value)
{
p_dataSource = value;
}
int ReadMNIST::getCurrentNum() const
{
return ui->spinBox->value();
}
void ReadMNIST::readData(int param)
{
ui->digitViewer->changeData(p_dataSource->getData(param));
label = (unsigned char) p_dataSource->getLabel(param);
QString str = "Count: " + QString::number(param) + " | Digit: " + QString::number(label);
ui->statusLbl->setText(str);
}
void ReadMNIST::setCurrentNum(int param)
{
if(param > p_dataSource->getTrainingExampleAmount()) {
qFatal("ReadMNIST:setCurrentNum(): param out of index");
}
ui->spinBox->setValue(param);
}