Caffe weight visualization, feature visualization, network model visualization

Source: Internet
Author: User
Tags python script

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

Visualization of weight values

After training, the network weights can be visualized to judge the model and whether it owes (too) fit. Well-trained network weights usually appear to be aesthetically pleasing, smooth, whereas the opposite is a noisy image, or the pattern correlation is too high (very regular dots and stripes), or lack of structural or more ' dead ' areas.

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 t_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

Results: [(' Conv1 ', (1, 5, 5)), (' Conv2 ', (M, 5, 5)), (' Ip1 ', (+)), (' Ip2 ', (10, 500))]

20 5*5 convolution kernel, with 1-D as input.

50 5*5 convolution kernel, with 20-D as input.
------------------------------------------------------------------------------

Feature Visualization

zz@zz-inspiron-5520:~$ CD Caffe


zz@zz-inspiron-5520:~/caffe$ CD python

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

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

Visualization of network models

Method 1: In code: caffe/python/draw_net.py

To enter the Caffe/python to execute the python script

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/no need to ignore the 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; network model: Lenet_train_test.prototxt; save to Mnist.jpg






20 5*5 convolution kernel, sliding with 1 steps.

Method 2. Online visualization tool Http://ethereon.github.io/netscope/#/editor

Shift key + ENTER, you can paint.

Put the original delete, put the network model: Lenet_train_test.prototxt code to copy the past



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

Visualization of Accuracy/loss curves

Step1: Copy this file to Caffe/python and change the name to :p lot_training_log.py


Step2:save Training phase Print to screen information

$ sh train_lenet.sh >& 1.log

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.