Visualize image after conv operation


(Darley Barreto) #1

Is there any way of plotting or saving a Variable as image after a conv2d operation?


#2

you can save it / plot it as an image using make_grid or save_image here: https://github.com/pytorch/vision#utils


(Darley Barreto) #3

I didn’t knew this pytorch vision, thanks a lot.


(Darley Barreto) #4

Something doenst fits. In the forward method at my module, I am calling save_image(x.data,"before_conv.png"), for a Variable of shape [1, 4, 80, 80] and gives me an error: RuntimeError: inconsistent tensor size at /py/conda-bld/pytorch_1490980628440/work/torch/lib/TH/generic/THTensorCopy.c:51


#5

you cant save a 4-channel image. You will have to save each of the 80x80 images separately.

save_image(x.data[0, 0, :, :], ...)

(Darley Barreto) #6

Yeah, it worked. Thanks a lot!