本文整理匯總了Python中TensorflowUtils.local_response_norm方法的典型用法代碼示例。如果您正苦於以下問題:Python TensorflowUtils.local_response_norm方法的具體用法?Python TensorflowUtils.local_response_norm怎麽用?Python TensorflowUtils.local_response_norm使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類TensorflowUtils
的用法示例。
在下文中一共展示了TensorflowUtils.local_response_norm方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: inference
# 需要導入模塊: import TensorflowUtils [as 別名]
# 或者: from TensorflowUtils import local_response_norm [as 別名]
def inference(dataset):
with tf.name_scope("conv1") as scope:
W1 = utils.weight_variable([5, 5, 1, 32], name="W1")
b1 = utils.bias_variable([32], name="b1")
tf.histogram_summary("W1", W1)
tf.histogram_summary("b1", b1)
h_conv1 = utils.conv2d_basic(dataset, W1, b1)
h_norm1 = utils.local_response_norm(h_conv1)
h_1 = tf.nn.relu(h_norm1, name="conv1")
h_pool1 = utils.max_pool_2x2(h_1)
with tf.name_scope("conv2") as scope:
W2 = utils.weight_variable([3, 3, 32, 64], name="W2")
b2 = utils.bias_variable([64], name="b2")
tf.histogram_summary("W2", W2)
tf.histogram_summary("b2", b2)
h_conv2 = utils.conv2d_basic(h_pool1, W2, b2)
h_norm2 = utils.local_response_norm(h_conv2)
h_2 = tf.nn.relu(h_norm2, name="conv2")
h_pool2 = utils.max_pool_2x2(h_2)
with tf.name_scope("conv3") as scope:
W3 = utils.weight_variable([3, 3, 64, 128], name="W3")
b3 = utils.bias_variable([128], name="b3")
tf.histogram_summary("W3", W3)
tf.histogram_summary("b3", b3)
h_conv3 = utils.conv2d_basic(h_pool2, W3, b3)
h_norm3 = utils.local_response_norm(h_conv3)
h_3 = tf.nn.relu(h_norm3, name="conv3")
h_pool3 = utils.max_pool_2x2(h_3)
with tf.name_scope("conv4") as scope:
W4 = utils.weight_variable([3, 3, 128, 256], name="W4")
b4 = utils.bias_variable([256], name="b4")
tf.histogram_summary("W4", W4)
tf.histogram_summary("b4", b4)
h_conv4 = utils.conv2d_basic(h_pool3, W4, b4)
h_norm4 = utils.local_response_norm(h_conv4)
h_4 = tf.nn.relu(h_norm4, name="conv4")
with tf.name_scope("fc1") as scope:
image_size = IMAGE_SIZE // 8
h_flat = tf.reshape(h_4, [-1, image_size * image_size * 256])
W_fc1 = utils.weight_variable([image_size * image_size * 256, 512], name="W_fc1")
b_fc1 = utils.bias_variable([512], name="b_fc1")
tf.histogram_summary("W_fc1", W_fc1)
tf.histogram_summary("b_fc1", b_fc1)
h_fc1 = tf.nn.relu(tf.matmul(h_flat, W_fc1) + b_fc1)
with tf.name_scope("fc2") as scope:
W_fc2 = utils.weight_variable([512, NUM_LABELS], name="W_fc2")
b_fc2 = utils.bias_variable([NUM_LABELS], name="b_fc2")
tf.histogram_summary("W_fc2", W_fc2)
tf.histogram_summary("b_fc2", b_fc2)
pred = tf.matmul(h_fc1, W_fc2) + b_fc2
return pred
示例2: inference_res
# 需要導入模塊: import TensorflowUtils [as 別名]
# 或者: from TensorflowUtils import local_response_norm [as 別名]
def inference_res(input_image):
W1 = utils.weight_variable([3, 3, 3, 32])
b1 = utils.bias_variable([32])
hconv_1 = tf.nn.relu(utils.conv2d_basic(input_image, W1, b1))
h_norm = utils.local_response_norm(hconv_1)
bottleneck_1 = utils.bottleneck_unit(h_norm, 16, 16, down_stride=True, name="res_1")
bottleneck_2 = utils.bottleneck_unit(bottleneck_1, 8, 8, down_stride=True, name="res_2")
bottleneck_3 = utils.bottleneck_unit(bottleneck_2, 16, 16, up_stride=True, name="res_3")
bottleneck_4 = utils.bottleneck_unit(bottleneck_3, 32, 32, up_stride=True, name="res_4")
W5 = utils.weight_variable([3, 3, 32, 3])
b5 = utils.bias_variable([3])
out = tf.nn.tanh(utils.conv2d_basic(bottleneck_4, W5, b5))
return out