-
Notifications
You must be signed in to change notification settings - Fork 2
/
_2MiddLevelFeatureNet.py
34 lines (21 loc) · 1.12 KB
/
_2MiddLevelFeatureNet.py
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
from Utilities import *
class MidLevelFeatureNet:
Mid_weights = None
Mid_biases = None
def __init__(self):
with tf.variable_scope("MidLvFeatNet"):
# Init the model.
self._init_model()
def _init_model(self):
self.Mid_weights = {'W_conv1':tf.Variable(tf.truncated_normal([3,3,512,512], stddev=0.001)),
'W_conv2':tf.Variable(tf.truncated_normal([3,3,512,256], stddev=0.001))}
self.Mid_biases = {'b_conv1':tf.Variable(tf.truncated_normal([512], stddev=0.001)),
'b_conv2':tf.Variable(tf.truncated_normal([256], stddev=0.001))}
def build(self, input_tensor):
#region Mid level Net
#print("# Intialize Mid level Net #")
MidLev_layer1 = tf.nn.relu(Conv2d(input_tensor, self.Mid_weights['W_conv1'], 1) + self.Mid_biases['b_conv1'])
MidLev_layer2 = tf.nn.relu(Conv2d(MidLev_layer1, self.Mid_weights['W_conv2'], 1) + self.Mid_biases['b_conv2'])
#endregion
output = MidLev_layer2
return output