当前位置:网站首页>Pychrm Community Edition calls matplotlib pyplot. Solution of imshow() function image not popping up
Pychrm Community Edition calls matplotlib pyplot. Solution of imshow() function image not popping up
2022-07-06 18:58:00 【--Jize--】
Preface
Learn from teacher Wu Enda's deeplearningai Course , Complete programming assignment 2 of the second week , I want to be here pycharm Rewrite the code in , It is found that the image does not display after loading the dataset .
Environmental Science
win10
anaconda3
python3.8
pychrm-community-2022.1.3
resolvent
Method 1 :
Import pylab library (pylab yes matplotlib One of the modules in , Import directly .)
stay plt.imshow(train_set_x_orig[index]) Add a sentence after pylab.show()
import numpy as np
from matplotlib import pyplot as plt
import h5py
import scipy
from PIL import Image
from scipy import ndimage
import scipy.misc
import pylab
def load_dataset():
train_dataset = h5py.File('datasets/train_catvnoncat.h5', "r")
train_set_x_orig = np.array(train_dataset["train_set_x"][:]) # your train set features
train_set_y_orig = np.array(train_dataset["train_set_y"][:]) # your train set labels
test_dataset = h5py.File('datasets/test_catvnoncat.h5', "r")
test_set_x_orig = np.array(test_dataset["test_set_x"][:]) # your test set features
test_set_y_orig = np.array(test_dataset["test_set_y"][:]) # your test set labels
classes = np.array(test_dataset["list_classes"][:]) # the list of classes
train_set_y_orig = train_set_y_orig.reshape((1, train_set_y_orig.shape[0]))
test_set_y_orig = test_set_y_orig.reshape((1, test_set_y_orig.shape[0]))
return train_set_x_orig, train_set_y_orig, test_set_x_orig, test_set_y_orig, classes
train_set_x_orig, train_set_y, test_set_x_orig, test_set_y, classes = load_dataset()
index = 5
plt.imshow(train_set_x_orig[index])
pylab.show()
print("y = " + str(train_set_y[:, index]) + ", it's a '" + classes[np.squeeze(train_set_y[:, index])].decode(
"utf-8") + "' picture.")
Method 2 :
stay plt.imshow(train_set_x_orig[index]) Add a sentence after plt.show()
PS
- The online solution is pycharm–>File | Settings | Tools | Python Scientific | Uncheck the Show plots in tool window, But mine pycharm There is no Python Scientific This option
- pycharm Use plt Don't show picture solutions
This blog explains why jupyter Can be displayed in and pycharm Cannot display . - I feel that the image source of China University of science and technology is very easy to use
pip3 install -i https://pypi.mirrors.ustc.edu.cn/simple/ pylab
边栏推荐
- Word如何显示修改痕迹
- 涂鸦智能在香港双重主板上市:市值112亿港元 年营收3亿美元
- Oracle advanced (IV) table connection explanation
- 人体骨骼点检测:自顶向下(部分理论)
- Mathematics in machine learning -- common probability distribution (XIII): Logistic Distribution
- Atcoder a mountaineer
- [Matlab] Simulink 同一模块的输入输出的变量不能同名
- Summary of performance knowledge points
- 上海部分招工市場對新冠陽性康複者拒絕招錄
- 如何提高网站权重
猜你喜欢
ROS custom message publishing subscription example
Solve DoS attack production cases
Wx applet learning notes day01
Deep circulation network long-term blood pressure prediction [translation]
CSRF vulnerability analysis
helm部署etcd集群
涂鸦智能在香港双重主板上市:市值112亿港元 年营收3亿美元
徐翔妻子应莹回应“股评”:自己写的!
美庐生物IPO被终止:年营收3.85亿 陈林为实控人
Nuc11 cheetah Canyon setting U disk startup
随机推荐
Reproduce ThinkPHP 2 X Arbitrary Code Execution Vulnerability
R语言ggplot2可视化:使用ggpubr包的ggdotplot函数可视化点阵图(dot plot)、设置palette参数设置不同水平点阵图数据点和箱图的颜色
上海部分招工市场对新冠阳性康复者拒绝招录
Human bone point detection: top-down (part of the theory)
Penetration test information collection - WAF identification
Penetration test information collection - App information
node の SQLite
SQL injection - access injection, access offset injection
Breadth first traversal of graph
Video based full link Intelligent Cloud? This article explains in detail what Alibaba cloud video cloud "intelligent media production" is
R语言使用dt函数生成t分布密度函数数据、使用plot函数可视化t分布密度函数数据(t Distribution)
Penetration test information collection - basic enterprise information
渲大师携手向日葵,远控赋能云渲染及GPU算力服务
C#/VB.NET 给PDF文档添加文本/图像水印
Lucun smart sprint technology innovation board: annual revenue of 400million, proposed to raise 700million
上海部分招工市場對新冠陽性康複者拒絕招錄
Stm32+esp8266+mqtt protocol connects onenet IOT platform
[Matlab] Simulink 同一模块的输入输出的变量不能同名
R语言使用order函数对dataframe数据进行排序、基于单个字段(变量)进行降序排序(DESCENDING)
Installation and management procedures