Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/algorithm/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何使我的非最大抑制实现更快?_Python_Algorithm_Deep Learning_Computer Vision - Fatal编程技术网

Python 如何使我的非最大抑制实现更快?

Python 如何使我的非最大抑制实现更快?,python,algorithm,deep-learning,computer-vision,Python,Algorithm,Deep Learning,Computer Vision,我实现了如下所示,并遇到了一个运行时问题。该算法的最坏情况时间复杂度为O(N^2) 有没有办法做得更快?我有100000-200000次呼叫的数据帧 def NMS(df,K=0.6): all_boxes = [] for _,row in df.iterrows(): all_boxes.append(Box(row.x1,row.y1,row.x2,row.y2,row.probability)) all_boxes.sort(key=lambda

我实现了如下所示,并遇到了一个运行时问题。该算法的最坏情况时间复杂度为
O(N^2)

有没有办法做得更快?我有
100000-200000次呼叫的数据帧

def NMS(df,K=0.6):
    all_boxes = []
    for _,row in df.iterrows():
        all_boxes.append(Box(row.x1,row.y1,row.x2,row.y2,row.probability))
    all_boxes.sort(key=lambda x: x.prob, reverse=True)
    N=len(all_boxes)
    B=[i for i in range(N)]
    D=[]
    while len(B)>0:
        highest_box_idx = B.pop(0)
        highest_box     = all_boxes[highest_box_idx]
        D.append(highest_box_idx)
        for b_idx in B:
            other_box = all_boxes[b_idx]
            if highest_box.IoU(other_box)>K:
                B.remove(b_idx)
    return df.iloc[D,:]
您可以使用

我读到了这篇文章,作为寻求

让我们知道它是如何为你工作的

计算机视觉岩石!在上面做笔记。

您可以使用

我读到了这篇文章,作为寻求

让我们知道它是如何为你工作的

计算机视觉岩石!记下来