# 行列式相乘可以有循环遍历的效果 import tensorflow as tf import numpy as np def compute_overlaps(boxes): """Computes IoU overlaps between two sets of boxes. boxes1, boxes2: [N, (x1, x2)]. For better performance, pass the largest set first and the smaller second. """ b1_x1, b1_x2 = \ tf.expand_dims(boxes[:, 0],axis=-2), \ tf.expand_dims(boxes[:, 1],axis=-2), b2_x1, b2_x2 = \ tf.expand_dims(boxes[:, 0],axis=-1),\ tf.expand_dims(boxes[:, 1],axis=-1), # get the corrdinates of the intersection inter_rect_x1 = tf.maximum(b1_x1, b2_x1) inter_rect_x2 = tf.minimum(b1_x2, b2_x2) # Intersection area inter_area = tf.abs(inter_rect_x2 - inter_rect_x1 + 1) # Union Area b1_area = tf.abs((b1_x2 - b1_x1 + 1)) b2_area = tf.abs((b2_x2 - b2_x1 + 1)) iou = inter_area / (b1_area + b2_a
tensorflow利用矩阵计算实现一维数据的NMS用于TimeSerialDectection
最新推荐文章于 2020-03-26 00:06:52 发布
本文详细介绍了如何使用TensorFlow库在一维数据上应用非极大值抑制(NMS)技术,以进行高效的目标检测,特别适用于时序数据的检测任务。
摘要由CSDN通过智能技术生成