zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    接口调用实现类&& 为什么Autowired定义在接口上
    getSuperclass与getGenericSuperclass区别
    Error resolving template “pages”, template might not exist or might not be accessible by any of the configured Template Resolver 或者 springboot使用thymeleaf时报html没有结束标签
    dcm4che-core导包失败! mvn pom文件导包总是失败
    使用IDEA springboot 如何通过mybatis-generator自动生成mapper dao model
    《剑指offer》第三十八题:字符串的排列
    《剑指offer》第三十七题:序列化二叉树
    《剑指offer》第三十六题:二叉搜索树与双向链表
    《剑指offer》第三十五题:复杂链表的复制
    《剑指offer》第三十四题:二叉树中和为某一值的路径
  • 原文地址:https://www.cnblogs.com/thisisajoke/p/12071447.html
Copyright © 2011-2022 走看看