-
Notifications
You must be signed in to change notification settings - Fork 4
/
mainwindow.h
81 lines (60 loc) · 2.87 KB
/
mainwindow.h
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*
Copyright (C) 2012 Martin Klapetek <[email protected]>
Based on C++ implementation by Chesnokov Yuriy, Copyright (C) 2008
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QtGui/QMainWindow>
#include <QGraphicsScene>
#include "race-client.h"
class RaceClient;
class Network;
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
void loadFile(QString filename);
public slots:
void train(); ///Trains the net with data loaded from file
void run(); ///Gets net output for the loaded run set
void reset(); ///Resets everything
void openFileDialog(); ///Opens file dialog
void netParamsChanged(); ///Slot for updating net params
void connectToServer(); ///Connects to the race server
void recognizeNumber(); ///Runs the net on the bitmap raster
void paintNumber(); ///Paints the selected number on the bitmap raster
void handleRaceStateChange(RaceClient::ClientState state); ///Slot for race client state changes
void toggleDisplaySegment(int row, int column); ///Controls the bitmap raster
protected:
void changeEvent(QEvent *e);
private:
Ui::MainWindow *ui;
int m_iteration; ///Current iteration (increases after the whole train.set has been processed)
QList<QStringList> m_inputsList; ///Names of inputs
QList<int> m_neuronsInLayersList; ///Number of neurons in layers
QList<QString> m_outputsList; ///Names of the outputs
QList<QList<float> > m_trainingSet; ///The training set from the file
QList<QList<float> > m_normTrainingSet; ///Normalized traning set
QList<QList<float> > m_expectedOutputs; ///Expected net outputs read from the file
QList<QList<float> > m_runSet; ///Run set loaded from file
QList<QList<float> > m_normRunSet; ///Normalized run set
QWeakPointer<Network> m_network; ///The net itself
RaceClient *m_raceClient; ///Race client
bool m_netForRecognition; ///True if the net was trained for number recognition
};
#endif // MAINWINDOW_H