Created
January 13, 2019 16:36
-
-
Save vihar/5f4273ec9e368c41517ff90630c241c0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def viz_layer(layer, n_filters= 4): | |
fig = plt.figure(figsize=(20, 20)) | |
for i in range(n_filters): | |
ax = fig.add_subplot(1, n_filters, i+1) | |
ax.imshow(np.squeeze(layer[0,i].data.numpy()), cmap='gray') | |
ax.set_title('Output %s' % str(i+1)) | |
fig = plt.figure(figsize=(12, 6)) | |
fig.subplots_adjust(left=0, right=1.5, bottom=0.8, top=1, hspace=0.05, wspace=0.05) | |
for i in range(4): | |
ax = fig.add_subplot(1, 4, i+1, xticks=[], yticks=[]) | |
ax.imshow(filters[i], cmap='gray') | |
ax.set_title('Filter %s' % str(i+1)) | |
gray_img_tensor = torch.from_numpy(gray_img).unsqueeze(0).unsqueeze(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment