nutszebra_chainer.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:trainer 作者: nutszebra 项目源码 文件源码
def _heatmap(x, y, confidences, activations, threshold=0.2):
    channel, height, width = x.shape
    heatmaps = []
    max_activation = 0
    for activation, confidence in six.moves.zip(activations, confidences):
        heatmap = np.zeros((height, width))
        activation = confidence * cv2.resize(activation, (width, height), interpolation=cv2.INTER_CUBIC)
        heatmap = heatmap + activation
        heatmaps.append(heatmap)
        max_activation = np.max([max_activation, np.max(heatmap)])
    for heatmap in heatmaps:
        heatmap[np.where(heatmap <= max_activation * threshold)] = 0.0
    total_heatmap = np.zeros((height, width))
    for heatmap in heatmaps:
        total_heatmap = total_heatmap + heatmap
    return (x, y, heatmaps, total_heatmap)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号