当前位置:网站首页>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
边栏推荐
- Collection of penetration test information -- use with nmap and other tools
- 关于静态类型、动态类型、id、instancetype
- Self supervised heterogeneous graph neural network with CO comparative learning
- R语言使用rchisq函数生成符合卡方分布的随机数、使用plot函数可视化符合卡方分布的随机数(Chi Square Distribution)
- Picture zoom Center
- 2022.2.12
- Reproduce ThinkPHP 2 X Arbitrary Code Execution Vulnerability
- 关于npm install 报错问题 error 1
- pychrm社区版调用matplotlib.pyplot.imshow()函数图像不弹出的解决方法
- Jdbc driver, c3p0, druid and jdbctemplate dependent jar packages
猜你喜欢

朗坤智慧冲刺科创板:年营收4亿 拟募资7亿

Summary of performance knowledge points

Lucun smart sprint technology innovation board: annual revenue of 400million, proposed to raise 700million

From 2022 to 2024, the list of cifar azrieli global scholars was announced, and 18 young scholars joined 6 research projects
![A wearable arm device for night and sleeveless blood pressure measurement [translation]](/img/fd/947a38742ab1c4009ec6aa7405a573.png)
A wearable arm device for night and sleeveless blood pressure measurement [translation]

Handwritten online chat system (principle part 1)

Abstract classes and abstract methods

AUTOCAD——中心线绘制、CAD默认线宽是多少?可以修改吗?

Binary search tree

Oracle advanced (IV) table connection explanation
随机推荐
First, look at K, an ugly number
监控界的最强王者,没有之一!
Method of accessing mobile phone storage location permission under non root condition
Stm32+esp8266+mqtt protocol connects onenet IOT platform
CSRF vulnerability analysis
Qlabel marquee text display
Video based full link Intelligent Cloud? This article explains in detail what Alibaba cloud video cloud "intelligent media production" is
Jushan database was among the first batch of financial information innovation solutions!
MySQL查询请求的执行过程——底层原理
Installation and management procedures
How does crmeb mall system help marketing?
徐翔妻子应莹回应“股评”:自己写的!
wx小程序学习笔记day01
Wx applet learning notes day01
三年Android开发,2022疫情期间八家大厂的Android面试经历和真题整理
Master Xuan joined hands with sunflower to remotely control enabling cloud rendering and GPU computing services
基于蝴蝶种类识别
十、进程管理
When visual studio code starts, it prompts "the code installation seems to be corrupt. Please reinstall." Solution to displaying "unsupported" information in the title bar
AvL树的实现