Hi, I am working with residual networks. I want to view features of intermediated layer as an image. How do I do that if
return res1, outAfterMask, mask
when I call that in my model:
self.res1 = resudal_unit(128, 128)
How do I save mask and view as an image. What I think if I can save them as an numpy array in .hf5 file and then view it using matplotlib. I am not sure how to save using a numpy array. Is it when I call the method in my model ? Any suggestions will be helpful
You can do it with matplotlib :
plt.imshow(MyTensor.permute(1, 2, 0).cpu().detach().numpy())
Or with PIL :
from torchvision import transforms
In any case, I think your tensor needs to be 3xWidthxHeight
@lerezell Thank you for your answer. My input is a video. So, I want to see one of its frame. But my question is when I call that method, do I just call it as
self.res1, self. outAfterMask, mask = residal_unit(128, 128)
How do I get that MyTensor?
MyTensor should be any tensor (3xHxW) that you want to see.
From a video you can get it with openCv or other tools
For you architecture, I don’t know what you’re trying to do.