matplotlib - 如何放大子图中的 imshow 图像?
问题描述
def plot_image(image):
plt.imshow(image, cmap="gray", interpolation="nearest")
plt.axis("off")
# # What is a Convolution?
# In[3]:
import numpy as np
from sklearn.datasets import load_sample_image
# Load sample images
china = load_sample_image("china.jpg") / 255
flower = load_sample_image("flower.jpg") / 255
images = np.array([china, flower])
batch_size, height, width, channels = images.shape
# Create 2 filters
filters = np.zeros(shape=(7, 7, channels, 2), dtype=np.float32)
filters[:, 3, :, 0] = 1 # vertical line
filters[3, :, :, 1] = 1 # horizontal line
outputs = tf.nn.conv2d(images, filters, strides=1, padding="SAME")
for image_index in (0, 1):
for feature_map_index in (0, 1):
plt.subplot(2, 2, image_index * 2 + feature_map_index + 1)
plot_image(outputs[image_index, :, :, feature_map_index])
plt.show()
我尝试使用plt.figure(figsize=(100,100))
(不确定尺寸是什么或它的含义..)它无论如何都不起作用..
解决方案
推荐阅读
- javascript - 将 React 组件插入到带有 html 内容的 String 变量中
- mingw - 在 msys2 上构建 doxygen
- python - 如何从 odoo 中的外部模块创建发票
- java - java 8中的Group By,具有多级分组
- c# - 如何在 Razor 页面中动态生成文件以供下载
- .net-core - 如何将 exe 发布与控制台 .net core 2.2 应用程序的 VS2019 构建集成?
- mongodb - 如何在 MongoDB 中找到按行数排序的最受欢迎的 ID?
- android - YouTube 嵌入式视频观看次数不计入 Android 应用
- node.js - 从反应应用程序路由以获取从车把生成的服务器端呈现的 HTML
- javascript - 在 [ View ] [ ASP.NET MVC ] 中使用 Java Script 不会更改 src