2021-3-11学习笔记

1.复习了几个numpy函数,对参数里面的维度加深理解

1.np.mean(),求平均,若axis为元组,说明是在元组说明的维度上进行求均值
e.g.

mean_sal = np.mean(pred,(1,2))

其中pred为[length,height,width]三维度的矩阵,上述代码操作为对每个图像矩阵进行求均值,最终得到mean_sal变为[length]数组

2.np.multiply(),是每个对应位置的元素相乘,可用于求{0,1}值的两张图都为一的像素点数量(外面加一个np.sum)
3.np.sum(),求和
4.np.logic_and(),求逻辑与,用于求TP,FP,TN数据
5.np.equal(X, number),返回维度相同的True和False图,条件为每个元素是否等于number

2.掌握了显著性目标检测中两个常用的性能评估指标MAE与F-measure的实现方法

MAE:

def get_mae(pred, gt, in_type='numpy'):
    """Get average MAE for evaluation.

    :param pred: predicted saliency map, if in_type='file', pred is the path to images,
    if in_type='numpy' it should be a 3D ndarray having dtype np.float and of shape [length, height, width].
    :param gt: ground truth saliency map, if in_type='file', gt is the path to images
    if in_type='numpy' it should be a 3D ndarray having dtype np.uint8 and of shape [length, height, width].
    :param in_type: value in {'file', 'numpy'}, default set to 'numpy'.
    :return: one float value, indicating average MAE for evaluation.
    """
    if in_type == 'file':
        pred_names = os.listdir(pred)
        pred_list = []
        for name in pred_names:
            img = np.array(Image.open(name, 'r'))
            img = img.astype(np.float)
            pred_list.append(img)
        pred_list = np.array(pred_list)

        gt_names = os.listdir(gt)
        gt_list = []
        for name in gt_names:
            gt = np
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值