Closed neouyghur closed 7 years ago
FYI, I use the latest version without any problem.
@experiencor Have you implemented the integrated gradient (the last part)? X_value is an image, however the x_baseline is shape of the image, therefore this x_baseline.shape == x_value.shape can't be true.
I did not provide x_baseline to GetMask but left it as default.
x_baseline = np.zeros_like(x_value), this creates a zero array with the same shape as x_value. (you can read the document here https://docs.scipy.org/doc/numpy-1.11.0/reference/generated/numpy.zeros_like.html)
You might have provided GetMask with incorrect x_baseline.
@experiencor you mean you have removed the x_baseline==baseline in the following code ?
vanilla_integrated_gradients_mask_3d = integrated_gradients.GetMask(
im, feed_dict = {neuron_selector: prediction_class}, x_baseline=baseline)
smoothgrad_integrated_gradients_mask_3d = integrated_gradients.GetSmoothedMask(
im, feed_dict = {neuron_selector: prediction_class}, x_baseline=baseline)
If so, I know it works it in that way. I have get the same result as author without providing x_baseline.
However, without doing these, the code does not work. The author should remove the x_baseline.
Besides that, in Example code the creation of the baseline is also not correct
baseline = np.array(im.shape)
baseline.fill(-1)
the author should use the np.zeros_like instead of the np.array.
Sorry about this!
The ipynb was incorrect, baseline is now initialized as follows: baseline = np.zeros(im.shape) baseline.fill(-1)
Previously, doing np.array(im.shape) makes a new np array with the values being the shape of image, when we really want to initialize an empty image the shape of the input.
A quick note on the -1 initialization, this is chosen because our Inception model uses -1 as black in the images. To keep true to the integrated gradients approach, we use black here, however you can use whatever baseline you want, and typically 0 and -1 don't look much different.
Hi, I am getting assertion error on Integrated_gradient part, could you check it?