<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel>
        <title>NotionNext BLOG</title>
        <link>https://tangly1024.com/</link>
        <description>这是一个由NotionNext生成的站点</description>
        <lastBuildDate>Sun, 23 Jul 2023 05:00:01 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <language>zh-CN</language>
        <copyright>All rights reserved 2023, NotionNext</copyright>
        <item>
            <title><![CDATA[How to use EarlyStopping]]></title>
            <link>https://tangly1024.com/article/early_stopping</link>
            <guid>https://tangly1024.com/article/early_stopping</guid>
            <pubDate>Fri, 21 Jul 2023 00:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto "><main class="notion light-mode notion-page notion-block-e6b334ac41bd4ef99cc79a4303c1a585"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-048de35ca3b740689ff032ba0e0882de" data-id="048de35ca3b740689ff032ba0e0882de"><span><div id="048de35ca3b740689ff032ba0e0882de" class="notion-header-anchor"></div><a class="notion-hash-link" href="#048de35ca3b740689ff032ba0e0882de" title="Why"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Why</span></span></h3><ol start="1" class="notion-list notion-list-numbered notion-block-c8034c1d951c4961b3e56897f4c235bd"><li>Avoid over-fitting.</li></ol><ol start="2" class="notion-list notion-list-numbered notion-block-66c6d5d09b134cb3add9b3f558a2f71f"><li>Save time &amp; gpu memory.</li></ol><hr class="notion-hr notion-block-ee42fc3f3a434d5283e8641576228897"/><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-c7f108e8aaf54894ad07cb8405629f5f" data-id="c7f108e8aaf54894ad07cb8405629f5f"><span><div id="c7f108e8aaf54894ad07cb8405629f5f" class="notion-header-anchor"></div><a class="notion-hash-link" href="#c7f108e8aaf54894ad07cb8405629f5f" title="Implementation"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Implementation</span></span></h3><div class="notion-row"><a target="_blank" rel="noopener noreferrer" class="notion-bookmark notion-block-5993d4488b274c679f1d0a7e20e54272" href="https://github.com/Lightning-AI/lightning/blob/9a4e8a8c528d6475ab33c46a0a84e27273cc10bd/src/pytorch_lightning/callbacks/early_stopping.py#L38"><div><div class="notion-bookmark-title">github.com</div><div class="notion-bookmark-link"><div class="notion-bookmark-link-text">https://github.com/Lightning-AI/lightning/blob/9a4e8a8c528d6475ab33c46a0a84e27273cc10bd/src/pytorch_lightning/callbacks/early_stopping.py#L38</div></div></div></a></div><div class="notion-row"><a target="_blank" rel="noopener noreferrer" class="notion-bookmark notion-block-df863fee1f74475ba5a1db8264c13df4" href="https://github.com/Bjarten/early-stopping-pytorch/blob/master/MNIST_Early_Stopping_example.ipynb"><div><div class="notion-bookmark-title">github.com</div><div class="notion-bookmark-link"><div class="notion-bookmark-link-text">https://github.com/Bjarten/early-stopping-pytorch/blob/master/MNIST_Early_Stopping_example.ipynb</div></div></div></a></div><div class="notion-text notion-block-fb42dac0316d43aaa28bf8845d151413">EarlyStoppingHook in mmengine:</div><div class="notion-row"><a target="_blank" rel="noopener noreferrer" class="notion-bookmark notion-block-a53f5bfaa3a1452d8699a3908c81f169" href="https://github.com/open-mmlab/mmengine/blob/main/mmengine/hooks/early_stopping_hook.py"><div><div class="notion-bookmark-title">github.com</div><div class="notion-bookmark-link"><div class="notion-bookmark-link-text">https://github.com/open-mmlab/mmengine/blob/main/mmengine/hooks/early_stopping_hook.py</div></div></div></a></div><hr class="notion-hr notion-block-13bc8ff52c144b9e8970b156a2d68c12"/><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-7ab7f2d0836a4b539c690586ce317078" data-id="7ab7f2d0836a4b539c690586ce317078"><span><div id="7ab7f2d0836a4b539c690586ce317078" class="notion-header-anchor"></div><a class="notion-hash-link" href="#7ab7f2d0836a4b539c690586ce317078" title="Sample Code"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Sample Code</span></span></h3><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-8c6e9c75953241aebd6b60b53c46f061" data-id="8c6e9c75953241aebd6b60b53c46f061"><span><div id="8c6e9c75953241aebd6b60b53c46f061" class="notion-header-anchor"></div><a class="notion-hash-link" href="#8c6e9c75953241aebd6b60b53c46f061" title="EarlyStopping:"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">EarlyStopping:</span></span></h4><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-e9eabd2f497e4e1cbff6d30e4e009010" data-id="e9eabd2f497e4e1cbff6d30e4e009010"><span><div id="e9eabd2f497e4e1cbff6d30e4e009010" class="notion-header-anchor"></div><a class="notion-hash-link" href="#e9eabd2f497e4e1cbff6d30e4e009010" title="Use in yolo-v5"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Use in yolo-v5</span></span></h4><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-fef9a26ed58a46ffbe4c21f7186bdbeb" data-id="fef9a26ed58a46ffbe4c21f7186bdbeb"><span><div id="fef9a26ed58a46ffbe4c21f7186bdbeb" class="notion-header-anchor"></div><a class="notion-hash-link" href="#fef9a26ed58a46ffbe4c21f7186bdbeb" title="Effectiveness for object detection"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Effectiveness for object detection</span></span></h3><figure class="notion-asset-wrapper notion-asset-wrapper-embed notion-block-13daada17d2e4a558e514a3390ff979b"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:384px"><iframe class="notion-asset-object-fit" src="https://docs.google.com/viewer?embedded=true&amp;url=https%3A%2F%2Fe-journal.unair.ac.id%2FJISEBI%2Farticle%2Fdownload%2F29988%2F17520" title="iframe embed" frameBorder="0" allowfullscreen="" loading="lazy" scrolling="auto"></iframe></div></figure><div class="notion-blank notion-block-5c186e30da4a48cd9e6892cbe03fb0b1"> </div></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cluster and visualize connected graph by k-means and networkx]]></title>
            <link>https://tangly1024.com/article/a5c6d495-4fa9-4aad-a501-959046b23146</link>
            <guid>https://tangly1024.com/article/a5c6d495-4fa9-4aad-a501-959046b23146</guid>
            <pubDate>Fri, 21 Jul 2023 00:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto "><main class="notion light-mode notion-page notion-block-a5c6d4954fa94aada501959046b23146"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-3a657316a6ef41918e775850eaa103ee" data-id="3a657316a6ef41918e775850eaa103ee"><span><div id="3a657316a6ef41918e775850eaa103ee" class="notion-header-anchor"></div><a class="notion-hash-link" href="#3a657316a6ef41918e775850eaa103ee" title="1. Get distance matrix from adjacent matrix M using floyd warshall algorithm."><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">1. Get distance matrix from adjacent matrix M using <span class="notion-orange">floyd warshall</span> algorithm.</span></span></h4><hr class="notion-hr notion-block-e7cef1beeeab4a6c9aa8318dc113da39"/><div class="notion-blank notion-block-7506d1650fbf49b58db2ee6eeca6d0ec"> </div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-8918b47c058d463b95c742814cc9dfeb" data-id="8918b47c058d463b95c742814cc9dfeb"><span><div id="8918b47c058d463b95c742814cc9dfeb" class="notion-header-anchor"></div><a class="notion-hash-link" href="#8918b47c058d463b95c742814cc9dfeb" title="2. Compute N clusters from distance matrix using k-means."><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2. Compute N clusters from distance matrix using k-means.</span></span></h4><div class="notion-callout notion-gray_background_co notion-block-db726f39410642619658d9b478f329bd"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="🤔">🤔</span></div><div class="notion-callout-text">What if we need to specify number of nodes for each cluster?</div></div><hr class="notion-hr notion-block-b5d1e955b1a44c77ace5d0d5a234acb7"/><div class="notion-blank notion-block-c1d24c5dc63a475f958a7107dbfb3c02"> </div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-59385ddc7ea74b3789757e435efb688b" data-id="59385ddc7ea74b3789757e435efb688b"><span><div id="59385ddc7ea74b3789757e435efb688b" class="notion-header-anchor"></div><a class="notion-hash-link" href="#59385ddc7ea74b3789757e435efb688b" title="3. Visualize graph using networkx."><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">3. Visualize graph using networkx.</span></span></h4><div class="notion-callout notion-gray_background_co notion-block-b4de6409c30e40a4bfb0d272192e3242"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="💡">💡</span></div><div class="notion-callout-text">To make edges in the visualized graph scaled to their actual values in the adjacency matrix, we need to use <code class="notion-inline-code">nx.draw_kamada_kawai</code> to draw the graph.</div></div><div class="notion-text notion-block-da80dfb0703a4a65bb4002e074db327e">Visualized graph:</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-ed89d577f8594f89bdc18b22369ac525"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:528px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F4a7cf445-66d2-440b-a1cc-f1846d868a9d%2FScreenshot_2023-07-21_at_16.06.05.png?table=block&amp;id=ed89d577-f859-4f89-bdc1-8b22369ac525" alt="notion image" loading="lazy" decoding="async"/></div></figure></main></div>]]></content:encoded>
        </item>
    </channel>
</rss>