caffe權值可視化,特徵可視化,網路模型可視化

來源:互聯網
上載者:User

--------------------------------------------------------------------------------

權值可視化

對訓練後的網路權值進行可視化可以判斷模型的優劣及是否欠(過)擬合。經過良好訓練的網路權值通常表現為美觀,光滑;反之則表現為雜訊映像,或者圖案相關性太高(很規則的點和條紋),或者缺乏結構性,或有較多‘死’地區。

zz@zz-Inspiron-5520:~$ cd caffe


zz@zz-Inspiron-5520:~/caffe$ cd python


zz@zz-Inspiron-5520:~/caffe/python$ ls
caffe        CMakeLists.txt  detect.py    lenet_iter_10000.caffemodel  mnist_deploy.prototxt  requirements.txt         test_extract_weights.py~
classify.py  conv2.jpg       draw_net.py  lenet_train_test.prototxt    mnist.jpg             test_extract_weights.py


zz@zz-Inspiron-5520:~/caffe/python$ python test_extract_weights.py

結果:[('conv1', (20, 1, 5, 5)), ('conv2', (50, 20, 5, 5)), ('ip1', (500, 800)), ('ip2', (10, 500))]

20個 5*5 convolution kernel,以1維作為輸入.

50個 5*5 convolution kernel,以20維作為輸入.
------------------------------------------------------------------------------

特徵可視化

zz@zz-Inspiron-5520:~$ cd caffe


zz@zz-Inspiron-5520:~/caffe$ cd python

zz@zz-Inspiron-5520:~/caffe/python$ python test_extract_data.py

------------------------------------------------------------------------------

網路模型可視化

方法1:用代碼:caffe / python / draw_net.py 

//進入caffe / python 才可以執行其中的python指令碼

zz@zz-Inspiron-5520:~$ cd caffe


zz@zz-Inspiron-5520:~/caffe$ cd python

zz@zz-Inspiron-5520:~/caffe/python$ ls

caffe  classify.py  CMakeLists.txt  detect.py  draw_net.py  requirements.txt


zz@zz-Inspiron-5520:~/caffe/python$ ./draw_net.py
usage: draw_net.py [-h] [--rankdir RANKDIR] [--phase PHASE]
                   input_net_proto_file output_image_file
draw_net.py: error: too few arguments    //不用理會error

zz@zz-Inspiron-5520:~/caffe/python$ ./draw_net.py --rankdir TB ./lenet_train_test.prototxt mnist.jpg  

Drawing net to mnist.jpg

//TB=top to bottom;網路模型:lenet_train_test.prototxt;儲存到mnist.jpg






20個 5*5 convolution kernel,以1為步長滑動.

方法2.線上視覺化檢視 http://ethereon.github.io/netscope/#/editor

shift鍵+斷行符號,就可以畫圖了。

把原來的刪除,把網路模型:lenet_train_test.prototxt代碼複製過去



-----------------------------------------------------------------------------

可視化accuracy / loss曲線

step1:把這個檔案copy到caffe/python,改名字為:plot_training_log.py


step2:save training phase 列印到螢幕的資訊

$ sh train_lenet.sh >& 1.log

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.