{
  "id": 12768,
  "title": "How could I visualize what my CNN learns ?",
  "url": "/competitions/datasciencebowl/discussion/12768",
  "author_name": "",
  "post_date": "2015-03-11T05:22:09.300Z",
  "votes": 2,
  "comment_count": 4,
  "views": 6435,
  "content": "<p>Hi, guys, there has been a topic already in the forum that may competitors show the filters which middle layers of their CNN have learned. I have asked how but no one replied. Here is my question: suppose that I have resized each training image into 64x64, and set the number of 1st convolutional neurons to 32, the kernel size is (3, 3), with stride = 1 and no zero-padding. Thus, my first Conv layer will output 32x62x62. Then How can I visualize what CNN learns such as edges just like some papers have presented ?</p>\n\n<p>ps: When I google I found this link may be useful&nbsp;http://deeplearning.net/tutorial/utilities.html#how-to-plot , has anyone ever used it ?&nbsp;</p>",
  "messages": [
    {
      "id": "65940",
      "postDate": "03/11/2015 05:22:09",
      "content": "<p>Hi, guys, there has been a topic already in the forum that may competitors show the filters which middle layers of their CNN have learned. I have asked how but no one replied. Here is my question: suppose that I have resized each training image into 64x64, and set the number of 1st convolutional neurons to 32, the kernel size is (3, 3), with stride = 1 and no zero-padding. Thus, my first Conv layer will output 32x62x62. Then How can I visualize what CNN learns such as edges just like some papers have presented ?</p>\n\n<p>ps: When I google I found this link may be useful&nbsp;http://deeplearning.net/tutorial/utilities.html#how-to-plot , has anyone ever used it ?&nbsp;</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65942",
      "postDate": "03/11/2015 06:08:59",
      "content": "<p>Even though i didn't try it but i think this link will guide u directly to your point</p>\n<p>http://nbviewer.ipython.org/github/BVLC/caffe/blob/master/examples/filter_visualization.ipynb</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65943",
      "postDate": "03/11/2015 06:15:49",
      "content": "<p>Thank you Data-Lover. Then, it seems that I have to move from Nolearn + Lasagne to Caffe ! Finally. I thought that I could depend on a more lightweight CNN lib.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65948",
      "postDate": "03/11/2015 10:02:06",
      "content": "<p>Just take the values of your convolution matrices (size 3x3 in your case), convert it to pixel values (so eg. most positive is white and most negative becomes black), and find a library that lets you write them as grayscale 3x3 png files. Alternatively collect all of them together side-by-side and write it as one png file.</p>\n<p>You don't need to use any specific learning library to do this, you just have to be able to extract values from your matrices.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "66032",
      "postDate": "03/12/2015 12:07:10",
      "content": "<p>@Nicolay, you mean that I will have 32 images in total, and each image size is 3x3, right?</p>",
      "rawMarkdown": "",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 65942,
      "author_name": "",
      "author_url": "",
      "post_date": "03/11/2015 06:08:59",
      "content": "<p>Even though i didn't try it but i think this link will guide u directly to your point</p>\n<p>http://nbviewer.ipython.org/github/BVLC/caffe/blob/master/examples/filter_visualization.ipynb</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65943,
      "author_name": "pengpai",
      "author_url": "",
      "post_date": "03/11/2015 06:15:49",
      "content": "<p>Thank you Data-Lover. Then, it seems that I have to move from Nolearn + Lasagne to Caffe ! Finally. I thought that I could depend on a more lightweight CNN lib.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65948,
      "author_name": "nicolaykorslund",
      "author_url": "",
      "post_date": "03/11/2015 10:02:06",
      "content": "<p>Just take the values of your convolution matrices (size 3x3 in your case), convert it to pixel values (so eg. most positive is white and most negative becomes black), and find a library that lets you write them as grayscale 3x3 png files. Alternatively collect all of them together side-by-side and write it as one png file.</p>\n<p>You don't need to use any specific learning library to do this, you just have to be able to extract values from your matrices.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 66032,
      "author_name": "pengpai",
      "author_url": "",
      "post_date": "03/12/2015 12:07:10",
      "content": "<p>@Nicolay, you mean that I will have 32 images in total, and each image size is 3x3, right?</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "65940": "",
    "65942": "",
    "65943": "",
    "65948": "",
    "66032": ""
  },
  "source": "meta"
}