playground.py 文件源码

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

项目:densecap-tensorflow 作者: rampage644 项目源码 文件源码
def run(proposals, gt, device='/cpu:0'):

    with tf.device(device):
        proposals = tf.expand_dims(proposals, axis=1)
        proposals = tf.tile(proposals, [1, M, 1])

        gt = tf.expand_dims(gt, axis=0)
        gt = tf.tile(gt, [N, 1, 1])

        proposals = tf.reshape(proposals, (N*M, d))
        gt = tf.reshape(gt, (N*M, d))

        # shape is N*M x 1
        iou_metric = tf.map_fn(model.iou, tf.stack([proposals, gt], axis=1))
        iou_metric = tf.reshape(iou_metric, [N, M])

    with tf.Session() as sess:
        sess.run(tf.global_variables_initializer())
        sess.run(iou_metric)

# result is 2min48s
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号