Skip to content
This repository was archived by the owner on Nov 2, 2024. It is now read-only.

Commit d2fc401

Browse files
committed
test(detector): 打印中间结果
1 parent a5a709f commit d2fc401

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

py/car_detector.py

+16
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ def draw_box_with_text(img, rect_list, score_list):
7272
def nms(rect_list, score_list):
7373
"""
7474
非最大抑制
75+
:param rect_list: list,大小为[N, 4]
76+
:param score_list: list,大小为[N]
7577
"""
7678
nms_rects = list()
7779
nms_scores = list()
@@ -141,6 +143,9 @@ def nms(rect_list, score_list):
141143
# 保存正样本边界框以及
142144
score_list = list()
143145
positive_list = list()
146+
147+
# tmp_score_list = list()
148+
# tmp_positive_list = list()
144149
for rect in rects:
145150
xmin, ymin, xmax, ymax = rect
146151
rect_img = img[ymin:ymax, xmin:xmax]
@@ -154,12 +159,23 @@ def nms(rect_list, score_list):
154159
"""
155160
probs = torch.softmax(output, dim=0).cpu().numpy()
156161

162+
# tmp_score_list.append(probs[1])
163+
# tmp_positive_list.append(rect)
164+
157165
if probs[1] >= svm_thresh:
158166
score_list.append(probs[1])
159167
positive_list.append(rect)
160168
# cv2.rectangle(dst, (xmin, ymin), (xmax, ymax), color=(0, 0, 255), thickness=2)
161169
print(rect, output, probs)
162170

171+
# tmp_img2 = copy.deepcopy(dst)
172+
# draw_box_with_text(tmp_img2, tmp_positive_list, tmp_score_list)
173+
# cv2.imshow('tmp', tmp_img2)
174+
#
175+
# tmp_img = copy.deepcopy(dst)
176+
# draw_box_with_text(tmp_img, positive_list, score_list)
177+
# cv2.imshow('tmp2', tmp_img)
178+
163179
nms_rects, nms_scores = nms(positive_list, score_list)
164180
print(nms_rects)
165181
print(nms_scores)

0 commit comments

Comments
 (0)