(self, x, num_targets=6, is_training=True)
| 6 | class Net(object): |
| 7 | """AlexNet architecture with modified final fully-connected layers regressed on driving control outputs (steering, throttle, etc...)""" |
| 8 | def __init__(self, x, num_targets=6, is_training=True): |
| 9 | self.x = x |
| 10 | |
| 11 | # phase = tf.placeholder(tf.bool, name='phase') # Used for batch norm |
| 12 | |
| 13 | conv1 = tf.nn.relu(conv2d(x, "conv1", 96, 11, 4, 1)) |
| 14 | lrn1 = lrn(conv1) |
| 15 | maxpool1 = max_pool_2x2(lrn1) |
| 16 | conv2 = tf.nn.relu(conv2d(maxpool1, "conv2", 256, 5, 1, 2)) |
| 17 | lrn2 = lrn(conv2) |
| 18 | maxpool2 = max_pool_2x2(lrn2) |
| 19 | conv3 = tf.nn.relu(conv2d(maxpool2, "conv3", 384, 3, 1, 1)) # Not sure why this isn't 2 groups, but pretrained net was trained like this so we're going with it. |
| 20 | |
| 21 | # Avoid diverging from pretrained weights with things like batch norm for now. |
| 22 | # Perhaps try a modern small net like Inception V1, ResNet 18, or Resnet 50 |
| 23 | # conv3 = tf.contrib.layers.batch_norm(conv3, scope='batchnorm3', is_training=phase, |
| 24 | # # fused=True, |
| 25 | # # data_format='NCHW', |
| 26 | # # renorm=True |
| 27 | # ) |
| 28 | |
| 29 | conv4 = tf.nn.relu(conv2d(conv3, "conv4", 384, 3, 1, 2)) |
| 30 | conv5 = tf.nn.relu(conv2d(conv4, "conv5", 256, 3, 1, 2)) |
| 31 | maxpool5 = max_pool_2x2(conv5) |
| 32 | fc6 = tf.nn.relu(linear(maxpool5, "fc6", 4096)) |
| 33 | if is_training: |
| 34 | fc6 = tf.nn.dropout(fc6, 0.5) |
| 35 | else: |
| 36 | fc6 = tf.nn.dropout(fc6, 1.0) |
| 37 | |
| 38 | fc7 = tf.nn.relu(linear(fc6, "fc7", 4096)) |
| 39 | # fc7 = tf.contrib.layers.batch_norm(fc7, scope='batchnorm7', is_training=phase) |
| 40 | if is_training: |
| 41 | fc7 = tf.nn.dropout(fc7, 0.95) |
| 42 | else: |
| 43 | fc7 = tf.nn.dropout(fc7, 1.0) |
| 44 | |
| 45 | fc8 = linear(fc7, "fc8", num_targets) |
| 46 | self.p = fc8 |
| 47 | self.global_step = tf.get_variable("global_step", [], tf.int32, initializer=tf.zeros_initializer, |
| 48 | trainable=False) |
nothing calls this directly
no test coverage detected