centernet-keras icon indicating copy to clipboard operation
centernet-keras copied to clipboard

经过draw_gaussian函数处理 batch_hms值没有改变啊

Open LJjack opened this issue 4 years ago • 1 comments

batch_hms[b, :, :, cls_id] = draw_gaussian(batch_hms[b, :, :, cls_id], ct_int, radius)

batch_hms.all() == 0 为True,没有发生改变

def draw_gaussian(heatmap, center, radius, k=1): diameter = 2 * radius + 1 gaussian = gaussian2D((diameter, diameter), sigma=diameter / 6)

x, y = int(center[0]), int(center[1])

height, width = heatmap.shape[0:2]

left, right = min(x, radius), min(width - x, radius + 1)
top, bottom = min(y, radius), min(height - y, radius + 1)

masked_heatmap = heatmap[y - top:y + bottom, x - left:x + right]
masked_gaussian = gaussian[radius - top:radius + bottom, radius - left:radius + right]
if min(masked_gaussian.shape) > 0 and min(masked_heatmap.shape) > 0:  # TODO debug
    np.maximum(masked_heatmap, masked_gaussian * k, out=masked_heatmap)

return heatmap

LJjack avatar Dec 18 '20 07:12 LJjack

应该还是有发生变化的,不然怎么训练的,你这个判断的方式换一个试试吧

bubbliiiing avatar Dec 22 '20 07:12 bubbliiiing