Advertisement

软NMS在目标检测中的一个难点 + Python变量赋值问题 + 函数引用传递机制

阅读量:

以下为soft-nms的代码实现:

复制代码
    def soft_nms(np.ndarray[float, ndim=2] boxes, float sigma=0.5, float Nt=0.3, float threshold=0.001, unsigned int method=0):
    cdef unsigned int N = boxes.shape[0]
    cdef float iw, ih, box_area
    cdef float ua
    cdef int pos = 0
    cdef float maxscore = 0
    cdef int maxpos = 0
    cdef float x1,x2,y1,y2,tx1,tx2,ty1,ty2,ts,area,weight,ov
    
    for i in range(N):
        maxscore = boxes[i, 4]
        maxpos = i
    
        tx1 = boxes[i,0]
        ty1 = boxes[i,1]
        tx2 = boxes[i,2]
        ty2 = boxes[i,3]
        ts = boxes[i,4]
    
        pos 

全部评论 (0)

还没有任何评论哟~