• 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

  • 相关阅读:
    OpenCV -- CV_8UC1,CV_32FC3等参数的含义
    OpenCV -- 命名空间及相关函数介绍
    Qt -- QMutex使用详解
    QT -- 常用数据结构及函数
    Qt -- QQueue用法
    Qt -- QSetting类/ini配置文件的读写操作
    QT--日期操作QDateTime
    设备接口总汇(含实物图)
    “SurfFeatureDetector”: 未声明的标识符/不能实例化抽象类
    OpenCV -- Shi-Tomas角点检测与亚像素级角点检测
  • 原文地址:https://www.cnblogs.com/thisisajoke/p/12071447.html
Copyright © 2020-2023  润新知