• CIFAR-10のトレインニング・その一


    データセットの紹介

    CIFAR-10は10類の物のデータセットである。
    CIFARの完全の名前は知らないけど「なぜあいつのホムページにはこういうのは全然見つかなかったの?」、とりあえず、CIFARはカナダのリサーチセンターです。
    CIFARのホムページはこっち:CIFARの公式サイト
    CIFAR-10またCIFAR-100は全てこいつ作り出した公開データセットですし、CIFAR-100の難しさが全く違いのレベルだ。
    そして、初心者によって、CIFAR-10はCIFAR-100より適当な入門挑戦だと思います。

    ニューラルネットワークの建造

    基本タイプはCNNを選んでください、続いてのは、具体的なパラメーター、例はこちらです。

    def Build_IINN(n_class): dim_x = [1, None, None, 3] dim_y = [1, n_class]
    </span><span class="sc1"># configure the convolution layers</span><span class="sc0">
    </span><span class="sc11">n_conv</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc2">8</span><span class="sc0">
    </span><span class="sc11">conv_config</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc10">[</span><span class="sc5">None</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">*</span><span class="sc0"> </span><span class="sc11">n_conv</span><span class="sc0">
    </span><span class="sc5">for</span><span class="sc0"> </span><span class="sc11">i</span><span class="sc0"> </span><span class="sc5">in</span><span class="sc0"> </span><span class="sc11">range</span><span class="sc10">(</span><span class="sc11">n_conv</span><span class="sc10">):</span><span class="sc0">
        </span><span class="sc11">conv_config</span><span class="sc10">[</span><span class="sc11">i</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc11">new_conv_config</span><span class="sc10">(</span><span class="sc2">3</span><span class="sc10">,</span><span class="sc0"> </span><span class="sc2">3</span><span class="sc10">,</span><span class="sc0"> </span><span class="sc11">i</span><span class="sc10">%</span><span class="sc2">2</span><span class="sc10">+</span><span class="sc2">1</span><span class="sc10">,</span><span class="sc0"> </span><span class="sc11">i</span><span class="sc10">%</span><span class="sc2">2</span><span class="sc10">+</span><span class="sc2">1</span><span class="sc10">,</span><span class="sc0"> </span><span class="sc2">8</span><span class="sc10">&lt;&lt;(</span><span class="sc11">i</span><span class="sc10">//</span><span class="sc2">2</span><span class="sc10">))</span><span class="sc0">
    
    </span><span class="sc1"># configure the fully connectied layers</span><span class="sc0">
    </span><span class="sc11">n_fc</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc2">3</span><span class="sc0">
    </span><span class="sc11">fc_config</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc10">[</span><span class="sc5">None</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">*</span><span class="sc0"> </span><span class="sc11">n_fc</span><span class="sc0">
    </span><span class="sc5">for</span><span class="sc0"> </span><span class="sc11">i</span><span class="sc0"> </span><span class="sc5">in</span><span class="sc0"> </span><span class="sc11">range</span><span class="sc10">(</span><span class="sc11">n_fc</span><span class="sc10">):</span><span class="sc0">
        </span><span class="sc11">fc_config</span><span class="sc10">[</span><span class="sc11">i</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc11">new_fc_config</span><span class="sc10">(</span><span class="sc2">16</span><span class="sc0"> </span><span class="sc10">&lt;&lt;</span><span class="sc0"> </span><span class="sc11">i</span><span class="sc10">)</span><span class="sc0">
    
    </span><span class="sc1"># configure the special module : feedback attention</span><span class="sc0">
    </span><span class="sc11">n_att</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc2">3</span><span class="sc0">
    </span><span class="sc11">att_config</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc10">[</span><span class="sc5">None</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">*</span><span class="sc0"> </span><span class="sc11">n_att</span><span class="sc0">
    </span><span class="sc5">for</span><span class="sc0"> </span><span class="sc11">i</span><span class="sc0"> </span><span class="sc5">in</span><span class="sc0"> </span><span class="sc11">range</span><span class="sc10">(</span><span class="sc11">n_att</span><span class="sc10">):</span><span class="sc0">
        </span><span class="sc11">att_config</span><span class="sc10">[</span><span class="sc11">i</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc11">new_fc_config</span><span class="sc10">(</span><span class="sc2">64</span><span class="sc0"> </span><span class="sc10">&gt;&gt;</span><span class="sc0"> </span><span class="sc11">i</span><span class="sc10">)</span><span class="sc0">
    
    </span><span class="sc5">return</span><span class="sc0"> </span><span class="sc11">IINN</span><span class="sc10">(</span><span class="sc11">dim_x</span><span class="sc10">,</span><span class="sc0"> </span><span class="sc11">dim_y</span><span class="sc10">,</span><span class="sc0">
                </span><span class="sc11">conv_config</span><span class="sc10">,</span><span class="sc0">
                </span><span class="sc11">fc_config</span><span class="sc10">,</span><span class="sc0">
                </span><span class="sc11">att_config</span><span class="sc10">)</span></div></body>
    

    研究のため、一応batch normを利用しない。
    トレインニングは300エポックでした。結果は悪いです。

    TRAINING STAGE#1:
    TRAIN = 1.00000 0.99968 0.99954 0.99922 0.99824 0.99698 0.98404
    TEST = 0.66570 0.66420 0.66380 0.66330 0.66300 0.65990 0.65810

  • 相关阅读:
    qbzt day6 上午
    qbzt day5 下午
    qbzt day5 上午
    【7.24校内交流赛】T3【qbxt】复读警告
    【7.24校内交流赛】T1&T2
    一个一定要好好提溜出来的贪心题
    7.19 讲题
    DP大大大大大赏
    图论经典例题大赏
    数据结构题大赏
  • 原文地址:https://www.cnblogs.com/thisisajoke/p/12071447.html
Copyright © 2020-2023  润新知