Skip to content
Snippets Groups Projects
Commit 50cae842 authored by dingjian's avatar dingjian
Browse files

update

parent d3f8da45
No related branches found
No related tags found
No related merge requests found
...@@ -59,6 +59,61 @@ def py_cpu_nms_poly(dets, thresh): ...@@ -59,6 +59,61 @@ def py_cpu_nms_poly(dets, thresh):
return keep return keep
def py_cpu_nms_poly_fast(dets, thresh, h_thresh):
# TODO: test it
obbs = dets[:, 0:-1]
x1 = np.min(obbs[:, 0::2], axis=1)
y1 = np.min(obbs[:, 1::2], axis=1)
x2 = np.max(obbs[:, 0::2], axis=1)
y2 = np.max(obbs[:, 1::2], axis=1)
scores = dets[:, 8]
areas = (x2 - x1 + 1) * (y2 - y1 + 1)
polys = []
areas = []
for i in range(len(dets)):
tm_polygon = polyiou.VectorDouble([dets[i][0], dets[i][1],
dets[i][2], dets[i][3],
dets[i][4], dets[i][5],
dets[i][6], dets[i][7]])
polys.append(tm_polygon)
order = scores.argsort()[::-1]
keep = []
while order.size > 0:
ovr = []
i = order[0]
keep.append(i)
xx1 = np.maximum(x1[i], x1[order[1:]])
yy1 = np.maximum(y1[i], y1[order[1:]])
xx2 = np.minimum(x2[i], x2[order[1:]])
yy2 = np.minimum(y2[i], y2[order[1:]])
w = np.maximum(0.0, xx2 - xx1 + 1)
h = np.maximum(0.0, yy2 - yy1 + 1)
hbb_inter = w * h
hbb_ovr = hbb_inter / (areas[i] + areas[order[1:]] - hbb_inter)
h_inds = np.where(hbb_ovr <= h_thresh)[0]
tmp_order = order[h_inds + 1]
for j in range(tmp_order.size):
iou = polyiou.iou_poly(polys[i], polys[order[j]])
ovr.append(iou)
ovr = np.array(ovr)
# print('ovr: ', ovr)
# print('thresh: ', thresh)
try:
if math.isnan(ovr[0]):
pdb.set_trace()
except:
pass
inds = np.where(ovr <= thresh)[0]
# print('inds: ', inds)
order = order[inds + 1]
return keep
def py_cpu_nms(dets, thresh): def py_cpu_nms(dets, thresh):
"""Pure Python NMS baseline.""" """Pure Python NMS baseline."""
#print('dets:', dets) #print('dets:', dets)
......
...@@ -34,7 +34,7 @@ For the detail of <strong style="color:blue"> DOTA-v1.0</strong>, you can refer ...@@ -34,7 +34,7 @@ For the detail of <strong style="color:blue"> DOTA-v1.0</strong>, you can refer
### What is DOAI? ### What is DOAI?
[DOAI2019](https://captain-whu.github.io/DOAI2019) is a contest of Detecting Objects in Aerial Images on [CVPR'2019]("http://cvpr2019.thecvf.com/"). It is based on DOTA-v2 (Coming soon). [DOAI2019](https://captain-whu.github.io/DOAI2019) is a contest of Detecting Objects in Aerial Images on [CVPR'2019]("http://cvpr2019.thecvf.com/"). It is based on DOTA-v1.5.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment