[4f54f1]: / model_definition / baseline.py

Download this file

68 lines (60 with data), 2.0 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
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
import tensorflow as tf
import config
from model_utils import calculate_conv_output_size
n_x = config.IMAGE_PXL_SIZE_X
n_y = config.IMAGE_PXL_SIZE_Y
n_z = config.SLICES
# This handles padding in both convolution and pooling layers
strides = [[1, 1, 1],
[2, 4, 4],
[1, 1, 1],
[2, 2, 2],
[1, 1, 1],
[2, 2, 2]]
filters = [[3, 5, 5],
[3, 5, 5],
[3, 3, 3],
[3, 3, 3],
[3, 3, 3],
[3, 3, 3]]
padding_types = ['VALID'] * 6
baseline_config = {
'weights': [
# Convolution layers
('wc1', tf.truncated_normal([3, 5, 5, config.NUM_CHANNELS, 16], stddev=0.01)),
('wc2', tf.truncated_normal([3, 3, 3, 16, 32], stddev=0.01)),
('wc3', tf.truncated_normal([3, 3, 3, 32, 32], stddev=0.01)),
# Fully connected layers
('wd1', tf.truncated_normal([calculate_conv_output_size(n_x, n_y, n_z,
strides,
filters,
padding_types,
32),
100], stddev=0.01)),
('wout', tf.truncated_normal([100, config.N_CLASSES], stddev=0.01))
],
'biases': [
# Convolution layers
('bc1', tf.zeros([16])),
('bc2', tf.constant(1.0, shape=[32])),
('bc3', tf.zeros([32])),
# Fully connected layers
('bd1', tf.constant(1.0, shape=[100])),
('bout', tf.constant(1.0, shape=[config.N_CLASSES]))
],
'pool_strides': [
[1, 2, 4, 4, 1],
[1, 2, 2, 2, 1],
[1, 2, 2, 2, 1],
],
'pool_windows': [
[1, 3, 5, 5, 1],
[1, 3, 3, 3, 1],
[1, 3, 3, 3, 1],
],
'strides': [
[1, 1, 1, 1, 1],
[1, 1, 1, 1, 1],
[1, 1, 1, 1, 1],
]
}