Code Monkey home page Code Monkey logo

deep_inside_convolutional_networks's Introduction

Deep Inside Convolutional Networks

This is a caffe implementation to visualize the learnt model.

Part of a class project at Georgia Tech
Problem Statement Pdf

Simonyan, K., Vedaldi, A., Zisserman, A.: Deep inside convolutional networks: Visualising image classification models and saliency maps Pdf

###Results:

Class Model visualization of Cat
In this exercise, we will use the method suggested in the “Deep inside convolutional networks: Visualising image classification models and saliency maps” to visualize the class model learnt by a convolutional network. We will use caffe for this exercise and visualize the class model learnt by the “bvlc_reference_caffenet.caffemodel”. Another aspect pointed out by the paper is that, the unnormalized Image score needs to be maximized instead of the probability. For this reason, we will be drop the final softmax layer(as the output here is the probability) and maximize the score at the inner product layer “fc8”.

Cat

Class Saliency extraction
The core idea behind this approach is to use the gradients at the image layer for a given image and class, to find the pixels which need to be changed the least i.e, the pixels for which the gradients have the smallest values. Also since our image is a 3 channel image, for each pixel, there will three different gradients. The maximum of these three will be considered the class saliency extraction.

Cat

Understanding backpropagation Here we simply visuzlize the gradients at different layers

Cat Cat Cat Cat

Instructions:

  • Install Caffe-rc2 tag
  • Copy the deploy_fc8.prototxt file to /models/bvlc_reference_caffenet/
  • Copy all the py files to /examples/
  • the just run python visualize.py

deep_inside_convolutional_networks's People

Contributors

artvandelay avatar saiprabhakar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

deep_inside_convolutional_networks's Issues

How to use it with multiple regression outputs.

Hi,
I am using it for a multi-task model.
I am using a customized alexnet for a multi-task model for aesthetics prediction and classification. I have a normalized score ( 0 to 1 ) for aesthetics prediction and a single label for classification. I want to check which areas are more salient for aesthetics. After doing
net.forward()
I am setting
net.blobs['aesthetics'].data[0][0] = 1
Then I am running
bw = net.backward()
But I am getting only zero values as input image.
I have set
force_backward: true in my model prototxt file.
I think I am messing up the backward function, let me know if you have any idea about how to use it for regression problems.

could not broadcast input array from shape (1000,1,1) into shape (1,1000)

When i run the visualize.py code, i got the above error as follows:-

Traceback (most recent call last):
File "visualize.py", line 69, in
bw = net.backward(**{net.outputs[0]: caffeLabel})
File "../python/caffe/pycaffe.py", line 167, in _Net_backward
self.blobs[top].diff[...] = diff
ValueError: could not broadcast input array from shape (1000,1,1) into shape (1,1000)

and when i change the net.backward line as: bw = net.backward(), it runs perfectly.
please tell me what is the problem??

how to set the Hyperparameter?

In visualize.py file,
I see the learning_rate is 10000,it confused me!why doing this,
also,In the optimization procedure,The sentence "caffe_data = caffe_data + learning_rate*diff " seems not used any L2 Paradigm,but in the paper, It is not like this!
thanks a lot!

IndexError: list index out of range

Traceback (most recent call last):
File "class_saliency_extraction.py", line 25, in
image_dims=(224, 224))
File "D:/Projects/caffe-windows/caffe/python\caffe\classifier.py", line 29, in init
in_ = self.inputs[0]
IndexError: list index out of range

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.