当前位置:网站首页>NMS reduction box
NMS reduction box
2022-06-25 20:06:00 【Orange cedar】
import numpy as np
def NMS(nums, threshold):
x1 = nums[:, 0]
y1 = nums[:, 1]
x2 = nums[:, 2]
y2 = nums[:, 3]
area = (x2 - x1) * (y2 - y1)
score = nums[:, 4]
score = np.argsort(score)[::-1]
# The function is to x The elements in are arranged from small to large , Extract the corresponding index( Indexes ), Then output to argsort()
keep = []
while score.size > 0:
#print("score=",score)
keep.append(score[0])
# Calculation times greater than score All the frames with the largest score Of IOU
xx1 = np.maximum(x1[score[0]], x1[score[1:]]) # Be careful : Here is an iterator for
yy1 = np.maximum(y1[score[0]], y1[score[1:]])
xx2 = np.minimum(x2[score[0]], x2[score[1:]])
yy2 = np.minimum(y2[score[0]], y2[score[1:]])
w = np.maximum(0.0, xx2 - xx1)
h = np.maximum(0.0, yy2 - yy1)
# IOU
overlap = w * h
iou = overlap/(area[score[0]] + area[score[1:]] - overlap)
# print("iou=",iou)
iou_low = np.where(iou <= threshold)[0] # Returns all and maximum score Compared with <threshold The subscript
# print(" Find the rectangle index whose overlap is not higher than the threshold :",iou_low)
score = score[iou_low + 1]
return keep
边栏推荐
- Yum command
- Go language installation and uninstallation
- Browser performance optimization (19)
- 200 OK (from memory cache) and 200 OK (from disk cache)
- Bindgetuserinfo will not pop up
- 2.5 find the sum of the first n terms of the square root sequence
- CG kit explore high performance rendering on mobile terminal
- 打新债网上开户安全吗,需要注意什么
- JS mobile phone and computer open different websites
- Is it safe to open a new bond securities account
猜你喜欢

Huawei HMS core launched a new member conversion & retention prediction model

Redis core article: the secret that can only be broken quickly

wooyun-2014-065513

Principles of MySQL clustered index and non clustered index

2.3 partial sum of square and reciprocal sequences

Now meditation: crash service and performance service help improve application quality

Wechat applet cloud function does not have dependency option installed

PAT B1086

Avoid material "minefields"! Play super high conversion rate

Vulnhub range - correlation:2
随机推荐
PAT B1064
Convert word to PDF through libreoffice
Now meditation: crash service and performance service help improve application quality
PHP FPM, workman, spoole, golang simple performance test
Log in to Huawei game with a minor account, and pop up anti addiction prompt after startup
Some pictures of real machine preview development and debugging are not shown
手机开户股票安全吗,买股票在哪开户?
6. exception handling
JQ implements tab switching
Force wechat page font size to be 100%
DARKHOLE 2
Install spoole
Mysql database design suggestions
PAT B1081
PAT B1063
The native JS mobile phone sends SMS cases. After clicking the button, the mobile phone number verification code is sent. The button needs to be disabled and re enabled after 60 seconds
Dependency injection in PHP reflection implementation framework
二、HikariCP獲取連接流程源碼分析二
Simple native JS tab bar switching
JS mobile phone and computer open different websites