码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • 如何调整yolo混淆矩阵的大小,使其更加美观


    1、找到xxx/utils/metrics.py
    2、找到这个函数
    在这里插入图片描述
    3、往下拉找到这里,自己对照改一下
    在这里插入图片描述

    		import seaborn as sn
    
            array = self.matrix / ((self.matrix.sum(0).reshape(1, -1) + 1E-9) if normalize else 1)  # normalize columns
            array[array < 0.005] = np.nan  # don't annotate (would appear as 0.00)
    
            fig, ax = plt.subplots(1, 1, figsize=(12, 9), tight_layout=True)
            nc, nn = self.nc, len(names)  # number of classes, names
            sn.set(font_scale=2.0 if nc < 50 else 0.8)  # for label size
            labels = (0 < nn < 99) and (nn == nc)  # apply names to ticklabels
            ticklabels = (list(names) + ['background']) if labels else 'auto'
            with warnings.catch_warnings():
                warnings.simplefilter('ignore')  # suppress empty matrix RuntimeWarning: All-NaN slice encountered
                sn.heatmap(array,
                           ax=ax,
                           annot=nc < 30,
                           annot_kws={
                               'size': 20},
                           cmap='Blues',
                           fmt='.2f' if normalize else '.0f',
                           square=True,
                           vmin=0.0,
                           xticklabels=ticklabels,
                           yticklabels=ticklabels).set_facecolor((1, 1, 1))
            plt.xticks(fontsize=15)
            plt.yticks(fontsize=15)
    
            title = 'Confusion Matrix' + ' Normalized' * normalize
            ax.set_xlabel('True',fontsize=20)
            ax.set_ylabel('Predicted',fontsize=20)
            ax.set_title(title,fontsize=20)
            plot_fname = Path(save_dir) / f'{title.lower().replace(" ", "_")}.png'
            fig.savefig(plot_fname, dpi=500)
            plt.close(fig)
            if on_plot:
                on_plot(plot_fname)
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35

    效果图:
    在这里插入图片描述

  • 相关阅读:
    亿图导出word和PDF中清晰度保留方法
    Java笔记:手写spring之ioc
    RuntimeError:Input, output and indices must be on the current device
    抖音网红百叶窗短视频Python全程托管一键生成
    XShell无法链接(腾讯云)服务器
    使用iso镜像包制作离线本地镜像源(本地yum源)
    带团队后的日常思考(十二)
    电脑重装系统后Word文档如何横向排版
    【Trailhead题目解析】Prepare your salesforce org for users - 5Create Chatter Groups
    /.idea/workspace.xml漏洞以及解决方法
  • 原文地址:https://blog.csdn.net/weixin_43722052/article/details/136605362
  • 最新文章
  • 攻防演习之三天拿下官网站群
    数据安全治理学习——前期安全规划和安全管理体系建设
    企业安全 | 企业内一次钓鱼演练准备过程
    内网渗透测试 | Kerberos协议及其部分攻击手法
    0day的产生 | 不懂代码的"代码审计"
    安装scrcpy-client模块av模块异常,环境问题解决方案
    leetcode hot100【LeetCode 279. 完全平方数】java实现
    OpenWrt下安装Mosquitto
    AnatoMask论文汇总
    【AI日记】24.11.01 LangChain、openai api和github copilot
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1
正则表达式工具 cron表达式工具 密码生成工具

京公网安备 11010502049817号