当前位置:网站首页>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
边栏推荐
- 手写一个的在线聊天系统(原理篇1)
- Afnetworking framework_ Upload file or image server
- AcWing 3537. Tree lookup complete binary tree
- test about BinaryTree
- Example of implementing web server with stm32+enc28j60+uip protocol stack
- QPushButton绑定快捷键的注意事项
- Method of accessing mobile phone storage location permission under non root condition
- 涂鸦智能在香港双重主板上市:市值112亿港元 年营收3亿美元
- 图之广度优先遍历
- SQL injection - access injection, access offset injection
猜你喜欢

From 2022 to 2024, the list of cifar azrieli global scholars was announced, and 18 young scholars joined 6 research projects

图之广度优先遍历

Online notes

二叉搜索树

helm部署etcd集群

ROS custom message publishing subscription example

涂鸦智能在香港双重主板上市:市值112亿港元 年营收3亿美元
![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]

美庐生物IPO被终止:年营收3.85亿 陈林为实控人

应用使用Druid连接池经常性断链问题分析
随机推荐
Based on butterfly species recognition
Cobra quick start - designed for command line programs
Hongke shares | plate by plate ar application in Beijing Winter Olympics
巨杉数据库首批入选金融信创解决方案!
Oracle advanced (IV) table connection explanation
Huawei 0 foundation - image sorting
关于静态类型、动态类型、id、instancetype
How does crmeb mall system help marketing?
POJ 2208 six lengths of tetrahedron are known, and the volume is calculated
使用map函数、split函数一行键入多个元素
Penetration test information collection - site architecture and construction
Some recruitment markets in Shanghai refuse to recruit patients with covid-19 positive
Jushan database was among the first batch of financial information innovation solutions!
Penetration test information collection - basic enterprise information
应用使用Druid连接池经常性断链问题分析
星诺奇科技IPO被终止:曾拟募资3.5亿元 年营收3.67亿
R语言ggplot2可视化:使用ggpubr包的ggstripchart函数可视化分组点状条带图(dot strip plot)、设置add参数为不同水平点状条带图添加箱图
Tongyu Xincai rushes to Shenzhen Stock Exchange: the annual revenue is 947million Zhang Chi and Su Shiguo are the actual controllers
SQL injection - access injection, access offset injection
Optical blood pressure estimation based on PPG and FFT neural network [translation]