优化人群计数人数显示及边界设置

This commit is contained in:
th 2025-07-26 10:05:31 +08:00
parent 585a7a05f7
commit b46182d68e
2 changed files with 13 additions and 7 deletions

View File

@ -979,7 +979,9 @@ class ModelType(Enum):
'eos_coef': '0.5',
'set_cost_class': 1,
'set_cost_point': 0.05,
'backbone': 'vgg16_bn'
'backbone': 'vgg16_bn',
'expend': 10,
'psize': 2,
},
}],
})
@ -1033,7 +1035,9 @@ class ModelType(Enum):
'eos_coef': '0.5',
'set_cost_class': 1,
'set_cost_point': 0.05,
'backbone': 'vgg16_bn'
'backbone': 'vgg16_bn',
'expend': 10,
'psize': 5
},
}],
})

View File

@ -317,20 +317,22 @@ def plot_one_box_auto(box, img, color=None, line_thickness=2, label_array=None):
return img, box
def draw_name_crowd(dets, img, color, line_thickness=2, outfontsize=20):
def draw_name_crowd(dets, img, color, outfontsize=20):
font = ImageFont.truetype(FONT_PATH, outfontsize, encoding='utf-8')
if len(dets) == 1:
if len(dets) == 2:
label = '当前人数:%d'%len(dets[0])
detP = dets[0]
line = dets[1]
for p in detP:
img = cv2.circle(img, (int(p[0]), int(p[1])), line_thickness, color, -1)
img = cv2.circle(img, (int(p[0]), int(p[1])), line, color, -1)
label_arr = get_label_array(color, label, font, outfontsize)
lh, lw = label_arr.shape[0:2]
img[0:lh, 0:lw, :] = label_arr
elif len(dets) == 2:
elif len(dets) == 3:
detP = dets[1]
line = dets[2]
for p in detP:
img = cv2.circle(img, (int(p[0]), int(p[1])), line_thickness, color, -1)
img = cv2.circle(img, (int(p[0]), int(p[1])), line, color, -1)
detM = dets[0]
h, w = img.shape[:2]