visualize_vggface.py 文件源码

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

项目:faceNet_RealTime 作者: jack55436001 项目源码 文件源码
def main():

    sess = tf.Session()

    t_input = tf.placeholder(np.float32, name='input') # define the input tensor
    image_mean = 117.0
    t_preprocessed = tf.expand_dims(t_input-image_mean, 0)

    # Build the inference graph
    nodes = tmp.vggface16.load('data/vgg_face.mat', t_preprocessed)

    img_noise = np.random.uniform(size=(224,224,3)) + 117.0

    # Picking some internal layer. Note that we use outputs before applying the ReLU nonlinearity
    # to have non-zero gradients for features with negative initial activations.
    layer = 'conv5_3'
    channel = 140 # picking some feature channel to visualize
    img = render_naive(sess, t_input, nodes[layer][:,:,:,channel], img_noise)
    showarray(img)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号