Advertisement
Guest User

Untitled

a guest
Aug 20th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. class LogisticModel(BaseModel):
  2. """Logistic model with L2 regularization."""
  3.  
  4. def create_model(self, model_input, num_classes=10, l2_penalty=1e-8, **unused_params):
  5.  
  6.  
  7.  
  8. with slim.arg_scope([slim.conv2d, slim.fully_connected],
  9. activation_fn=tf.nn.relu,
  10. weights_initializer=tf.truncated_normal_initializer(0.0, 0.01),
  11. weights_regularizer=slim.l2_regularizer(0.0005)):
  12. net = slim.repeat(model_input, 1, slim.conv2d, 32, [5, 5], scope='conv1')
  13. net = slim.max_pool2d(net, [2, 2], scope='pool1')
  14. net = slim.repeat(net, 2, slim.conv2d, 64, [3, 3], scope='conv2')
  15. net = slim.max_pool2d(net, [2, 2], scope='pool2')
  16. net = slim.repeat(net, 2, slim.conv2d, 128, [3, 3], scope='conv3')
  17. net = slim.max_pool2d(net, [2, 2], scope='pool3')
  18.  
  19.  
  20.  
  21. net = slim.flatten(net)
  22.  
  23. net = slim.fully_connected(net, 1024, scope='fc8')
  24. net = slim.dropout(net, 0.5, scope='dropout8')
  25.  
  26. output = slim.fully_connected(
  27. net, num_classes, activation_fn=None,
  28. weights_regularizer=slim.l2_regularizer(l2_penalty))
  29. #output = slim.dropout(net, 0.5, scope='dropoutlast')
  30. return {"predictions": output}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement