tf_utils.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:lung-cancer-detector 作者: YichenGong 项目源码 文件源码
def conv_2d_drop_bn_relu(inp, inp_chan, out_chan, kernel, stride=1, prob=1.0, name="", is_train=True):
    weights = tf.Variable(tf.truncated_normal(
            shape=[kernel, kernel, inp_chan, out_chan],
            mean=0.0,
            stddev=0.3),
        name=name+"_weights")
    bias = tf.Variable(tf.constant(
            shape=[out_chan],
            value=0.0),
        name=name+"_bias")
    conv = tf.nn.conv2d(input=inp,
        filter=weights,
        strides=[1, stride, stride, 1],
        padding='VALID',
        name=name+"_conv")
    drop = tf.nn.dropout(conv, prob, name=name+"_drop")
    out = tf.nn.relu(tf.contrib.layers.batch_norm(drop + bias, is_training=is_train))

    return out, weights, bias
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号