mobilenetdet_test.py 文件源码

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

项目:MobileNet 作者: Zehaos 项目源码 文件源码
def test_batch_iou(self):
    with self.test_session() as sess:
      anchors = set_anchors(img_shape=[config.IMG_HEIGHT, config.IMG_WIDTH],
                            fea_shape=[config.FEA_HEIGHT, config.FEA_WIDTH])
      anchors_shape = anchors.get_shape().as_list()
      fea_h = anchors_shape[0]
      fea_w = anchors_shape[1]
      num_anchors = anchors_shape[2] * fea_h * fea_w
      anchors = tf.reshape(anchors, [num_anchors, 4])  # reshape anchors
      anchors = xywh_to_yxyx(anchors)
      bbox = tf.constant([0.75, 0.75, 0.2, 0.2], dtype=tf.float32)
      bbox = xywh_to_yxyx(bbox)
      iou = batch_iou(anchors, bbox)
      anchor_idx = tf.arg_max(iou, dimension=0)
      anchors, output, anchor_idx = sess.run([anchors, iou, anchor_idx])
      print(anchors)
      print(output)
      print(anchor_idx)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号