提交 c854a2a5 编写于 作者: M muli

update finetune

上级 256c2937
......@@ -151,7 +151,7 @@ train(scratch_net, 0.1)
-`finetune_net`试着增大学习率看看收敛变化。
- 多跑几个`epochs`直到收敛(你可以也需要调调参数),看看`scratch_net``finetune_net`最后的精度是不是有区别
- 这里`finetune_net`重用了`pretrained_net`除最后全连接外的所有权重,试试少重用些权重,有会有什么区别
- 事实上`ImageNet`里也有`hotdog`这个类,它的index是713。例如它对应的weight可以这样拿到。试试如何重用这个权重
- 事实上`ImageNet`里也有`hotdog`这个类,它对应的输出层参数可以如下拿到。试试如何使用它。
```{.python .input n=16}
weight = pretrained_net.output.weight
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="378px" height="412px" version="1.1" content="&lt;mxfile userAgent=&quot;Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.62 Safari/537.36&quot; version=&quot;7.6.3&quot; editor=&quot;www.draw.io&quot; type=&quot;device&quot;&gt;&lt;diagram id=&quot;55dede4a-8032-8888-8231-614c75d36358&quot; name=&quot;Page-1&quot;&gt;7Vpdc6IwFP01PnYHCCh93GptH7oznbWzH48RIqYNhIlRa3/9JpCgGOi6VWCngz5Ibj643HPPAW4cgHH8esdguvxGQ0QGjhW+DsBk4Di2CyzxIy273OKPhrkhYjhUg/aGGX5DyqjmRWscolVpIKeUcJyWjQFNEhTwkg0yRrflYQtKymdNYYQMwyyAxLT+xCFfqqvwrL39HuFoqc9sW6pnDoOXiNF1os43cMAi++TdMdRrqfGrJQzp9sAEbgdgzCjl+VH8OkZExlaHLZ83rekt/GYo4adMcPMJG0jWSHuc+cV3OhYoFKFRzYQm4ucmu0Akl7BE63kdp3pABFNhWfKYiIYtDlccMv5VQrKfntmmmBC1AEpCPYKmKMktB/3PiPOdShK45lSYKONLGtEEkgdK0+JcjL6gMSWUZa4DK/sUPRpKICwLmvApjDGRGXqPyAZxHEDVoc4FLNWuWtKMtAr+iq5ZoGKnoimuN0JqFMhNMqoH0xQ6d4jGiLOdGMAQgRxvygkJVV5Hxbg9tuJAwVsNtWNAPcs9dawJ5NDAvQzydok5mqUwu7ItM2E+Cv0w+3w49M57oYcERyJLJoEIPWJyoMiVg4ELT36lneD0h/KwFq8NYhy9vouF7tXypFTNG3p5e7vXCFtL3/JAH1zvfPiGPVObZCowmep1xlTQY/1BrAXEbPeruALR+C0bX7wz8sB2L50IauojxcKTQl6AeyQv1tESuVNq1lE6FW6clGEnJNiZ8h/4aL5oBuO/yX8Ikb8Impd/1x+2J/9+LwlNyr9n0n7Ulfx7PTkvQE7Lb4+c+tw9O5th58hk53VX7Bz17DyfnUDj1wY7rw3EihffBziXlav+zfcf8XN0JawVdT3hhtir68fV1dYV1kbfeU5G2zbQfsod+7x1qgswFDgd1qbsE26KPUPPYKhbwdBhZww1Nw3GNN39X49BZxGzeAxqgJitVg1s89mnJ+YliTmsIKbfGTHNPYKemKcTs82KgWM+5fTEvCQxfZOYGu8OiGlWb7/DJKTxhanpO3PQ1cNs6CE/dJuhZqvlAscs5hUvIJ+2XtAAaK3WCPrt8db3Ry7/AlK9LeqM3PJ92nbKS+R+Gtui5v7q6OiGrxP28vurFVXiR4auOIM4EenmWOovc0cZKpjGy1nH0Aq/wXk2QIKVSucyd72bgTeRFBd5tMphtg8YT9BCLiXpK9KBfFVmLnPsZiXUCSfRU5ZwV26NoNRmVX0WGWpRkVi1AnINyvphVejHqEI/gFWfUifrh3mHngqorvi6x6tW8C2rNcBEc/+nyJyQ+3+egts/&lt;/diagram&gt;&lt;/mxfile&gt;"><defs/><g transform="translate(0.5,0.5)"><path d="M 82 365 L 82 337.71" fill="none" stroke="#000000" stroke-width="3" stroke-miterlimit="10" pointer-events="none"/><path d="M 86.5 343.35 L 82 334.35 L 77.5 343.35" fill="none" stroke="#000000" stroke-width="3" stroke-miterlimit="10" pointer-events="none"/><rect x="17" y="365" width="130" height="45" fill="#f5f5f5" stroke="#666666" stroke-width="3" transform="translate(0,387.5)scale(1,-1)translate(0,-387.5)" pointer-events="none"/><g transform="translate(25.5,376.5)"><switch><foreignObject style="overflow:visible;" pointer-events="all" width="112" height="22" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 20px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 112px; white-space: nowrap; word-wrap: normal; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;">Source Data</div></div></foreignObject><text x="56" y="21" fill="#000000" text-anchor="middle" font-size="20px" font-family="Helvetica">Source Data</text></switch></g><path d="M 82 286 L 82 259.71" fill="none" stroke="#000000" stroke-width="3" stroke-miterlimit="10" pointer-events="none"/><path d="M 86.5 265.35 L 82 256.35 L 77.5 265.35" fill="none" stroke="#000000" stroke-width="3" stroke-miterlimit="10" pointer-events="none"/><path d="M 147 308.72 L 220.29 308.98" fill="none" stroke="#000000" stroke-width="3" stroke-miterlimit="10" pointer-events="none"/><path d="M 214.63 313.46 L 223.65 308.99 L 214.66 304.46" fill="none" stroke="#000000" stroke-width="3" stroke-miterlimit="10" pointer-events="none"/><rect x="17" y="286" width="130" height="45" fill="#dae8fc" stroke="#6c8ebf" stroke-width="3" transform="translate(0,308.5)scale(1,-1)translate(0,-308.5)" pointer-events="none"/><path d="M 82 208 L 82 180.71" fill="none" stroke="#000000" stroke-width="3" stroke-miterlimit="10" pointer-events="none"/><path d="M 86.5 186.35 L 82 177.35 L 77.5 186.35" fill="none" stroke="#000000" stroke-width="3" stroke-miterlimit="10" pointer-events="none"/><rect x="17" y="208" width="130" height="45" fill="#dae8fc" stroke="#6c8ebf" stroke-width="3" transform="translate(0,230.5)scale(1,-1)translate(0,-230.5)" pointer-events="none"/><path d="M 82 129 L 82 101.71" fill="none" stroke="#000000" stroke-width="3" stroke-miterlimit="10" pointer-events="none"/><path d="M 86.5 107.35 L 82 98.35 L 77.5 107.35" fill="none" stroke="#000000" stroke-width="3" stroke-miterlimit="10" pointer-events="none"/><rect x="17" y="129" width="130" height="45" fill="#dae8fc" stroke="#6c8ebf" stroke-width="3" transform="translate(0,151.5)scale(1,-1)translate(0,-151.5)" pointer-events="none"/><rect x="17" y="50" width="130" height="45" fill="#f5f5f5" stroke="#666666" stroke-width="3" transform="translate(0,72.5)scale(1,-1)translate(0,-72.5)" pointer-events="none"/><g transform="translate(22.5,61.5)"><switch><foreignObject style="overflow:visible;" pointer-events="all" width="118" height="22" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 20px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 118px; white-space: nowrap; word-wrap: normal; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;">Source Label</div></div></foreignObject><text x="59" y="21" fill="#000000" text-anchor="middle" font-size="20px" font-family="Helvetica">Source Label</text></switch></g><path d="M 292 365 L 292 337.71" fill="none" stroke="#000000" stroke-width="3" stroke-miterlimit="10" pointer-events="none"/><path d="M 296.5 343.35 L 292 334.35 L 287.5 343.35" fill="none" stroke="#000000" stroke-width="3" stroke-miterlimit="10" pointer-events="none"/><rect x="227" y="365" width="130" height="45" fill="#f5f5f5" stroke="#666666" stroke-width="3" pointer-events="none"/><g transform="translate(239.5,376.5)"><switch><foreignObject style="overflow:visible;" pointer-events="all" width="104" height="22" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 20px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 104px; white-space: nowrap; word-wrap: normal; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;">Target Data</div></div></foreignObject><text x="52" y="21" fill="#000000" text-anchor="middle" font-size="20px" font-family="Helvetica">Target Data</text></switch></g><path d="M 292 286 L 292 259.71" fill="none" stroke="#000000" stroke-width="3" stroke-miterlimit="10" pointer-events="none"/><path d="M 296.5 265.35 L 292 256.35 L 287.5 265.35" fill="none" stroke="#000000" stroke-width="3" stroke-miterlimit="10" pointer-events="none"/><rect x="227" y="286" width="130" height="45" fill="#dae8fc" stroke="#6c8ebf" stroke-width="3" pointer-events="none"/><g transform="translate(268.5,297.5)"><switch><foreignObject style="overflow:visible;" pointer-events="all" width="46" height="22" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 20px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 48px; white-space: nowrap; word-wrap: normal; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;">Copy</div></div></foreignObject><text x="23" y="21" fill="#000000" text-anchor="middle" font-size="20px" font-family="Helvetica">Copy</text></switch></g><path d="M 292 208 L 292 180.71" fill="none" stroke="#000000" stroke-width="3" stroke-miterlimit="10" pointer-events="none"/><path d="M 296.5 186.35 L 292 177.35 L 287.5 186.35" fill="none" stroke="#000000" stroke-width="3" stroke-miterlimit="10" pointer-events="none"/><rect x="227" y="208" width="130" height="45" fill="#dae8fc" stroke="#6c8ebf" stroke-width="3" pointer-events="none"/><g transform="translate(268.5,219.5)"><switch><foreignObject style="overflow:visible;" pointer-events="all" width="46" height="22" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 20px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 48px; white-space: nowrap; word-wrap: normal; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;">Copy</div></div></foreignObject><text x="23" y="21" fill="#000000" text-anchor="middle" font-size="20px" font-family="Helvetica">Copy</text></switch></g><path d="M 292 129 L 292 101.71" fill="none" stroke="#000000" stroke-width="3" stroke-miterlimit="10" pointer-events="none"/><path d="M 296.5 107.35 L 292 98.35 L 287.5 107.35" fill="none" stroke="#000000" stroke-width="3" stroke-miterlimit="10" pointer-events="none"/><rect x="227" y="129" width="130" height="45" fill="#d5e8d4" stroke="#82b366" stroke-width="3" pointer-events="none"/><g transform="translate(253.5,140.5)"><switch><foreignObject style="overflow:visible;" pointer-events="all" width="76" height="22" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 20px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 76px; white-space: nowrap; word-wrap: normal; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;">Random</div></div></foreignObject><text x="38" y="21" fill="#000000" text-anchor="middle" font-size="20px" font-family="Helvetica">Random</text></switch></g><rect x="227" y="50" width="130" height="45" fill="#f5f5f5" stroke="#666666" stroke-width="3" pointer-events="none"/><g transform="translate(236.5,61.5)"><switch><foreignObject style="overflow:visible;" pointer-events="all" width="110" height="22" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 20px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 112px; white-space: nowrap; word-wrap: normal; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;">Target Label</div></div></foreignObject><text x="55" y="21" fill="#000000" text-anchor="middle" font-size="20px" font-family="Helvetica">Target Label</text></switch></g><path d="M 147 230.5 L 220.29 230.5" fill="none" stroke="#000000" stroke-width="3" stroke-miterlimit="10" pointer-events="none"/><path d="M 214.65 235 L 223.65 230.5 L 214.65 226" fill="none" stroke="#000000" stroke-width="3" stroke-miterlimit="10" pointer-events="none"/><g transform="translate(1.5,2.5)"><switch><foreignObject style="overflow:visible;" pointer-events="all" width="159" height="22" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 20px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; white-space: nowrap;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;">Pre-trained Model</div></div></foreignObject><text x="80" y="21" fill="#000000" text-anchor="middle" font-size="20px" font-family="Helvetica">Pre-trained Model</text></switch></g><g transform="translate(208.5,2.5)"><switch><foreignObject style="overflow:visible;" pointer-events="all" width="156" height="22" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 20px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; white-space: nowrap;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;">Fine-tuned Model</div></div></foreignObject><text x="78" y="21" fill="#000000" text-anchor="middle" font-size="20px" font-family="Helvetica">Fine-tuned Model</text></switch></g></g></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xl="http://www.w3.org/1999/xlink" version="1.1" viewBox="97 93 229 215" width="229pt" height="215pt" xmlns:dc="http://purl.org/dc/elements/1.1/"><metadata> Produced by OmniGraffle 6.6.1 <dc:date>2018-05-29 22:02:14 +0000</dc:date></metadata><defs><font-face font-family="PingFang SC" font-size="9" panose-1="2 11 4 0 0 0 0 0 0 0" units-per-em="1000" underline-position="-150" underline-thickness="58" slope="0" x-height="600" cap-height="860" ascent="1060.00215" descent="-340.00069" font-weight="500"><font-face-src><font-face-name name="PingFangSC-Regular"/></font-face-src></font-face><marker orient="auto" overflow="visible" markerUnits="strokeWidth" id="StickArrow_Marker" viewBox="-1 -4 10 8" markerWidth="10" markerHeight="8" color="black"><g><path d="M 8 0 L 0 0 M 0 -3 L 8 0 L 0 3" fill="none" stroke="currentColor" stroke-width="1"/></g></marker></defs><g stroke="none" stroke-opacity="1" stroke-dasharray="none" fill="none" fill-opacity="1"><title>Canvas 1</title><rect fill="white" width="492" height="619"/><g><title>Layer 1</title><rect x="108" y="270" width="72" height="27" fill="white"/><rect x="108" y="270" width="72" height="27" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(113 277)" fill="black"><tspan font-family="PingFang SC" font-size="9" font-weight="500" fill="black" x="17.5" y="10" textLength="27">源数据</tspan></text><rect x="108" y="225" width="72" height="27" fill="#eff6fd"/><rect x="108" y="225" width="72" height="27" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(113 232)" fill="black"><tspan font-family="PingFang SC" font-size="9" font-weight="500" x="17.5" y="10" textLength="27">卷积层</tspan></text><rect x="108" y="180" width="72" height="27" fill="#eff6fd"/><rect x="108" y="180" width="72" height="27" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(113 187)" fill="black"><tspan font-family="PingFang SC" font-size="9" font-weight="500" x="17.5" y="10" textLength="27">卷积层</tspan></text><rect x="108" y="135" width="72" height="27" fill="#eff6fd"/><rect x="108" y="135" width="72" height="27" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(113 142)" fill="black"><tspan font-family="PingFang SC" font-size="9" font-weight="500" x="4" y="10" textLength="54">全连接输出层</tspan></text><rect x="243" y="270" width="72" height="27" fill="white"/><rect x="243" y="270" width="72" height="27" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(248 277)" fill="black"><tspan font-family="PingFang SC" font-size="9" font-weight="500" x="13" y="10" textLength="36">目标数据</tspan></text><rect x="243" y="225" width="72" height="27" fill="#eff6fd"/><rect x="243" y="225" width="72" height="27" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(248 232)" fill="black"><tspan font-family="PingFang SC" font-size="9" font-weight="500" x="17.5" y="10" textLength="27">卷积层</tspan></text><rect x="243" y="180" width="72" height="27" fill="#eff6fd"/><rect x="243" y="180" width="72" height="27" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(248 187)" fill="black"><tspan font-family="PingFang SC" font-size="9" font-weight="500" x="17.5" y="10" textLength="27">卷积层</tspan></text><rect x="243" y="135" width="72" height="27" fill="#c9e2ff"/><rect x="243" y="135" width="72" height="27" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><text transform="translate(248 142)" fill="black"><tspan font-family="PingFang SC" font-size="9" font-weight="500" x="4" y="10" textLength="54">全连接输出层</tspan></text><line x1="144" y1="270" x2="144" y2="261.9" marker-end="url(#StickArrow_Marker)" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><line x1="144" y1="225" x2="144" y2="216.9" marker-end="url(#StickArrow_Marker)" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><line x1="144" y1="180" x2="144" y2="171.9" marker-end="url(#StickArrow_Marker)" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><line x1="279" y1="270" x2="279" y2="261.9" marker-end="url(#StickArrow_Marker)" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><line x1="279" y1="225" x2="279" y2="216.9" marker-end="url(#StickArrow_Marker)" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><line x1="279" y1="180" x2="279" y2="171.9" marker-end="url(#StickArrow_Marker)" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/><line x1="180" y1="238.5" x2="233.1" y2="238.5" marker-end="url(#StickArrow_Marker)" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1" stroke-dasharray="1,4"/><line x1="180" y1="193.5" x2="233.1" y2="193.5" marker-end="url(#StickArrow_Marker)" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1" stroke-dasharray="1,4"/><rect x="194.97333" y="181.27389" width="28" height="24" fill="white"/><text transform="translate(199.97333 186.77389)" fill="black"><tspan font-family="PingFang SC" font-size="9" font-weight="500" x="0" y="10" textLength="18">复制</tspan></text><rect x="194.97333" y="226.91083" width="28" height="24" fill="white"/><text transform="translate(199.97333 232.41083)" fill="black"><tspan font-family="PingFang SC" font-size="9" font-weight="500" x="0" y="10" textLength="18">复制</tspan></text><text transform="translate(194.72333 135.5)" fill="black"><tspan font-family="PingFang SC" font-size="9" font-weight="500" x="5.25" y="10" textLength="18">随机</tspan><tspan font-family="PingFang SC" font-size="9" font-weight="500" x=".75" y="23" textLength="27">初始化</tspan></text><line x1="228.22333" y1="148.5" x2="233.1" y2="148.5" marker-end="url(#StickArrow_Marker)" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1" stroke-dasharray="1,4"/><text transform="translate(129.34746 109)" fill="black"><tspan font-family="PingFang SC" font-size="9" font-weight="500" x=".795" y="10" textLength="26.91">模型 A</tspan></text><text transform="translate(264.30508 107.5)" fill="black"><tspan font-family="PingFang SC" font-size="9" font-weight="500" x=".705" y="10" textLength="27.09">模型 B</tspan></text></g></g></svg>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册