<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>技巧 on Sheng Dong&#39;s website</title>
    <link>https://shdong.net/categories/%E6%8A%80%E5%B7%A7/</link>
    <description>Recent content in 技巧 on Sheng Dong&#39;s website</description>
    <image>
      <url>https://shdong.net/ptr.png</url>
      <link>https://shdong.net/ptr.png</link>
    </image>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <lastBuildDate>Fri, 17 May 2024 23:29:36 +0800</lastBuildDate><atom:link href="https://shdong.net/categories/%E6%8A%80%E5%B7%A7/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>自定义计算MMDetection目标检测模型的precision, recall, F1, AP, AR</title>
      <link>https://shdong.net/post/mmdet_object_detection_model_evaluation/</link>
      <pubDate>Fri, 17 May 2024 23:29:36 +0800</pubDate>
      
      <guid>https://shdong.net/post/mmdet_object_detection_model_evaluation/</guid>
      <description>使用自定义的类别和数据集训练了MMDetection的目标检测模型，需要汇报模型的precision, recall等等各项指标。在MMDetection的官网文档里只找到了生成混淆矩阵的代码，但似乎并不支持直接给出其他常见的评价指标（见Github项目的issue#6212和issue#8791。搜索一番后发现CSDN博客上有人分享了如何通过在tools/analysis_tools/confusion_matrix.py的main()函数末尾添加代码，从而得到precision, recall, F1, AP, AR。然而实际运行后发现其实有bug，并且原理上也有一些问题，所以进行了适当修改。
总体思路是，先从混淆矩阵中计算出每个分类的真阳性样本量FP、假阳性样本量TP、假阴性样本量FN，然后按照公式计算各分类标签的precision和recall。
需要注意的是，precision和recall的长度其实比分类数量多1。这是因为前面生成confusion matrix的时候，在已有分类的后边还加了一个“background”的标签。precision和recall的最后一位其实就是“background”的精确率和召回率，并且总是为零。从混淆矩阵里面也可以看出，background的真阳性比例一定是0%。在计算平均precision和recall的时候，我们不需要考虑这一个额外的分类。
MMDetection官方文档里的normalized confusion matrix，&#34;background&#34;分类的真阳性比例一定是0%需要在main()函数末尾添加的代码为：
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 TP = np.diag(confusion_matrix) FP = np.sum(confusion_matrix, axis=0) - TP FN = np.sum(confusion_matrix, axis=1) - TP precision = TP / (TP + FP) recall = TP / (TP + FN) average_precision = np.mean(precision[:-1]) average_recall = np.mean(recall[:-1]) f1 = 2* (average_precision * average_recall) / (average_precision + average_recall) print(&amp;#39;\n===Averaging all classes===&amp;#39;) print(&amp;#39;AP:&amp;#39;, average_precision) print(&amp;#39;AR:&amp;#39;, average_recall) print(&amp;#39;F1:&amp;#39;, f1) print(&amp;#39;Classes&amp;#39;, dataset.</description>
    </item>
    
    <item>
      <title>拆机加硬盘，新电脑已是老油条了</title>
      <link>https://shdong.net/post/install_ssd/</link>
      <pubDate>Mon, 29 Apr 2024 01:36:50 +0800</pubDate>
      
      <guid>https://shdong.net/post/install_ssd/</guid>
      <description>&lt;p&gt;凭借曾经在E志者学到的功夫，拆开笔记本并添加了一条固态硬盘(SSD)。&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>MMDetection目标检测入门笔记</title>
      <link>https://shdong.net/post/notes-on-mmdet/</link>
      <pubDate>Mon, 28 Aug 2023 11:11:41 +0800</pubDate>
      
      <guid>https://shdong.net/post/notes-on-mmdet/</guid>
      <description>&lt;p&gt;本篇是MMDetection学习应用过程中的踩坑记录，随学习情况更新。&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>浅试Biorender</title>
      <link>https://shdong.net/post/try-biorender/</link>
      <pubDate>Thu, 06 Jul 2023 09:29:42 +0800</pubDate>
      
      <guid>https://shdong.net/post/try-biorender/</guid>
      <description>&lt;p&gt;在写一篇综述论文的时候被推荐了&lt;a href=&#34;https://www.biorender.com/&#34;&gt;BioRender&lt;/a&gt;这一作图工具，尝试了一下发现确实很好用，可以让生物领域的插图制作如有神助。&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>在Hugo &#43; Papermod中添加Echartsjs</title>
      <link>https://shdong.net/post/learning-echartsjs/</link>
      <pubDate>Sun, 12 Mar 2023 01:38:43 +0800</pubDate>
      
      <guid>https://shdong.net/post/learning-echartsjs/</guid>
      <description>&lt;p&gt;参照Echarts的&lt;a href=&#34;https://echarts.apache.org/handbook/zh/get-started/&#34;&gt;官方入门文档&lt;/a&gt;，给Hugo框架的博客网站添加使用Echarts渲染的功能（主题为&lt;a href=&#34;https://github.com/adityatelange/hugo-PaperMod&#34;&gt;Papermod&lt;/a&gt;)。以后需要放图表的时候就不用再傻乎乎地截图了。&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>在Hugo &#43; PaperMod主题下添加不蒜子网站统计</title>
      <link>https://shdong.net/post/my_web-count/</link>
      <pubDate>Thu, 01 Dec 2022 01:34:50 +0800</pubDate>
      
      <guid>https://shdong.net/post/my_web-count/</guid>
      <description>&lt;p&gt;之前在使用Hexo平台 + NexT主题搭建博客的时候，自带不蒜子&lt;sup id=&#34;fnref:1&#34;&gt;&lt;a href=&#34;#fn:1&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;1&lt;/a&gt;&lt;/sup&gt;的网站访问统计。现在的这个主题下需要自行添加统计功能。最终还是决定使用不蒜子来实现，便于直接显示在网站页面上&lt;sup id=&#34;fnref:2&#34;&gt;&lt;a href=&#34;#fn:2&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;2&lt;/a&gt;&lt;/sup&gt;。唯一的缺点就是目前没办法自定义初始值，所以域名更换后数据就从零开始了。&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>HugoBlog Test</title>
      <link>https://shdong.net/post/test/</link>
      <pubDate>Tue, 01 Nov 2022 15:31:58 +0800</pubDate>
      
      <guid>https://shdong.net/post/test/</guid>
      <description>&lt;h1 id=&#34;this-is-a-test-page&#34;&gt;This is a test page&lt;/h1&gt;
&lt;p&gt;本页面用于测试网站的显示格式，以及不同模块的渲染情况。&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Sci-Hub &#43; Python爬虫实现文献批量下载</title>
      <link>https://shdong.net/post/crawl_papers_from_scihub/</link>
      <pubDate>Wed, 18 May 2022 19:27:46 +0000</pubDate>
      
      <guid>https://shdong.net/post/crawl_papers_from_scihub/</guid>
      <description>&lt;center&gt;
&lt;img src=&#34;https://shdong.net/images/image-20220518230710288.png&#34; alt=&#34;image-20220518230710288&#34; style=&#34;zoom:50%;&#34; /&gt;
&lt;/center&gt;
&lt;h1 id=&#34;操作思路&#34;&gt;操作思路&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;在Web of Science或者其他学术搜索引擎上查找所需要的文献，然后将全体检索结果的信息导出成Excel（包括作者、标题、出版年份、期刊、DOI号等等）&lt;/li&gt;
&lt;li&gt;以DOI号为检索条件，到Sci-Hub下载文献，将这一过程写成爬虫进行批量处理
&lt;ul&gt;
&lt;li&gt;导出DOI号序列，写成循环来逐个爬取&lt;/li&gt;
&lt;li&gt;以DOI号检索文献，进入下载页面，查找到保存按钮对应的元素，下载到本地&lt;/li&gt;
&lt;li&gt;将下载的PDF文件按照自己的标准重命名&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;手动补全无法在Sci-Hub上得到的文献&lt;/li&gt;
&lt;/ul&gt;</description>
    </item>
    
    <item>
      <title>Markdown-mermaid画流程图、甘特图和饼图</title>
      <link>https://shdong.net/post/markdown-mermaid/</link>
      <pubDate>Sun, 20 Mar 2022 01:07:53 +0000</pubDate>
      
      <guid>https://shdong.net/post/markdown-mermaid/</guid>
      <description>&lt;p&gt;在很多支持Markdown语法的编辑器（例如Typora, 印象笔记）中，可以通过mermaid代码块的方式，实现流程图、时序图等图表的绘制。它是一种基于 Javascript 的图表和图表工具，提供标记启发的文本定义，以动态创建和修改图表。&lt;/p&gt;
&lt;p&gt;以下是除了普通的&lt;code&gt;graph&lt;/code&gt;流程图以外，常用的一些mermaid功能。&lt;/p&gt;</description>
    </item>
    
  </channel>
</rss>
