np.argmax在多分类softmax输出后巧妙的应用

本文探讨了np.argmax函数如何巧妙地应用于多分类问题的softmax输出。通过将softmax生成的概率图(形状为(512, 512, class_num))进行处理,该函数找到概率最大的类别,并将其映射为0到class_num的整数,用于标记图像。这种技术简化了从概率图中提取最可能类别的方式。" 113677208,8666035,Ubuntu18.04编译OpenCV3.4.3:问题与解决方案,"['Ubuntu', 'OpenCV', '编译安装', '依赖管理']

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

id2code={0: (64, 128, 64),
 1: (128, 128, 64),
 2: (0, 128, 192),
 3: (128, 0, 0),
 4: (0, 128, 64),
 5: (64, 0, 128),
 6: (64, 0, 192),
 7: (192, 128, 64),
 8: (192, 192, 128),
 9: (64, 64, 128),
 10: (128, 0, 192),
 11: (192, 0, 64),
 12: (192, 0, 128),
 13: (192, 0, 192),
 14: (128, 64, 64),
 15: (64, 192, 128),
 16: (64, 64, 0),
 17: (128, 64, 128),
 18: (128, 128, 192),
 19: (0, 0, 192),
 20: (192, 128, 128),
 21: (128, 128, 128),
 22: (64, 128, 192),
 23: (0, 0, 64),
 24: (0, 64, 64),
 25: (192, 64, 128),
 26: (128, 128, 0),
 27: (192, 128, 192),
 28: (64, 0, 64),
 29: (192, 192, 0),
 30: (0, 0, 0),
 31: (64, 192, 0)}
def onehot_to_rgb(onehot, colormap = id2code):
    '''Function to decode encoded mask labels
        Inputs: 
            onehot - one hot encoded image matrix (height x width x num_classes)
            colormap - dictionary of color to label id
        Output: Decoded RGB image (height x width x 3) 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值