Skip to content

Commit 8ff7cfe

Browse files
committed
Increased maximal number of detections during NMS to 30,000
1 parent 9be0539 commit 8ff7cfe

3 files changed

Lines changed: 5 additions & 3 deletions

File tree

partinet/DynamicDet/models/yolo.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,11 +240,12 @@ def forward_once(self, x, profile=False):
240240
self.get_score = False
241241
if self.get_score:
242242
return score
243-
print(f"This micrograph has difficulty score {score} for threshold {self.dy_thres}")
243+
print(f"This micrograph has difficulty score {score[:, 0][0]} for threshold {self.dy_thres}\n")
244244
need_second = self.training or (not self.dynamic) or score[:, 0] < self.dy_thres
245245
need_first_head = self.training or (self.dynamic and score[:, 0] >= self.dy_thres)
246246

247247
if need_second:
248+
print(f"This micrograph has used both detectors\n")
248249
for m in self.model_b2:
249250
if m.f == 'input':
250251
x = input_x
@@ -267,6 +268,7 @@ def forward_once(self, x, profile=False):
267268
y.append(x if m.i in self.save_b2 else None) # save output
268269

269270
if need_first_head:
271+
print(f"This micrograph has used only one detector\n")
270272
for m in self.model_h:
271273
if m.f != -1: # if not from previous layer
272274
x = y[m.f] if isinstance(m.f, int) else [x if j == -1 else y[j] for j in m.f] # from earlier layers

partinet/DynamicDet/utils/general.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ def non_max_suppression(prediction, conf_thres=0.25, iou_thres=0.45, classes=Non
613613

614614
# Settings
615615
min_wh, max_wh = 2, 4096 # (pixels) minimum and maximum box width and height
616-
max_det = 1000 # maximum number of detections per image
616+
max_det = 30000 # maximum number of detections per image
617617
max_nms = 30000 # maximum number of boxes into torchvision.ops.nms()
618618
time_limit = 10.0 # seconds to quit after
619619
redundant = True # require redundant detections

partinet/DynamicDet/utils/plots.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def hex2rgb(h):
3434
return [hex2rgb(h) for h in matplotlib.colors.TABLEAU_COLORS.values()] # or BASE_ (8), CSS4_ (148), XKCD_ (949)
3535

3636

37-
def plot_one_box(x, img, color=None, label=None, line_thickness=3):
37+
def plot_one_box(x, img, color=None, label=None, line_thickness=6):
3838
# Plots one bounding box on image img
3939
tl = line_thickness or round(0.002 * (img.shape[0] + img.shape[1]) / 2) + 1 # line/font thickness
4040
color = color or [random.randint(0, 255) for _ in range(3)]

0 commit comments

Comments
 (0)