-
Notifications
You must be signed in to change notification settings - Fork 1
/
dataset.h
80 lines (65 loc) · 2.65 KB
/
dataset.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
#ifndef _DATASET_H_
#define _DATASET_H_
/*
* Comment this next line to use the data below instead of official MNIST frames
* If you choose to use MNIST, you will have to import into the project the
* MNIST data arrays frames and labels and give weights.
* Make sure that the configuration matches with the hardware.
*/
#define MNIST
#ifndef MNIST
/*
* User defined configuration
* If you change FSIZE, NEU1 and NEU2, they have to be changed in the hardware
* aswell.
*/
#define FRAMES_NB 2
#define FSIZE 64
#define NEU1 4
#define NEU2 3
// Weights for neurons layer 1
const int16_t config_neu1[NEU1][FSIZE] = {
{1, -50, 10541, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -20},
{2, 50, -1152, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -444},
{3, 514, 453, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 666},
{4, 1248, 14000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 777}
};
// Constants for recode after layer 1
const int16_t config_recode1[NEU1] = {1, 2, 3, 4};
// Weights for neurons layer 2
const int16_t config_neu2[NEU2][NEU1] = {
{ 3, 1, 1, 1},
{ 2, 1, 1, 1},
{ 1, 1, 1, 1}
};
// Constants for recode after layer 2
const int16_t config_recode2[NEU2] = {0, 0, 0};
// Frames to send
const uint8_t data_frames[FRAMES_NB][FSIZE] = {
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}
};
#else
/*
* MNIST data
*/
#define FRAMES_NB 1000
#define FSIZE 784
#define NEU1 100
#define NEU2 10
/*
* Extern declarations of weights and constants.
* They are in file net.c
*/
extern int16_t w1[NEU1][FSIZE];
extern int16_t w2[NEU2][NEU1];
extern int16_t b1[NEU1];
extern int16_t b2[NEU2];
/*
* Extern declarations of frames and labels.
* They are in file frames.c
*/
extern uint8_t frames[FRAMES_NB][FSIZE];
extern uint8_t labels[FRAMES_NB];
#endif
#endif /* _DATASET_H_ */