当前位置:网站首页>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
边栏推荐
- [Sun Yat sen University] information sharing of postgraduate entrance examination and re examination
- JDBC驱动器、C3P0、Druid和JDBCTemplate相关依赖jar包
- C#/VB. Net to add text / image watermarks to PDF documents
- RedisSystemException:WRONGTYPE Operation against a key holding the wrong kind of value
- Docker installation redis
- C#/VB.NET 给PDF文档添加文本/图像水印
- Introduction to the use of SAP Fiori application index tool and SAP Fiori tools
- Implementation of AVL tree
- How to improve website weight
- Execution process of MySQL query request - underlying principle
猜你喜欢

Method of accessing mobile phone storage location permission under non root condition

Word如何显示修改痕迹

Video based full link Intelligent Cloud? This article explains in detail what Alibaba cloud video cloud "intelligent media production" is

Handwritten online chat system (principle part 1)
![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]

应用使用Druid连接池经常性断链问题分析

openmv4 学习笔记1----一键下载、图像处理背景知识、LAB亮度-对比度

Human bone point detection: top-down (part of the theory)

On AAE

This article discusses the memory layout of objects in the JVM, as well as the principle and application of memory alignment and compression pointer
随机推荐
【论文笔记】TransUNet: Transformers Make StrongEncoders for Medical Image Segmentation
How to improve website weight
抽象类与抽象方法
C#/VB. Net to add text / image watermarks to PDF documents
线代笔记....
R语言使用order函数对dataframe数据进行排序、基于单个字段(变量)进行降序排序(DESCENDING)
Summary of performance knowledge points
AcWing 3537. Tree lookup complete binary tree
Penetration test information collection - WAF identification
R语言dplyr包进行数据分组聚合统计变换(Aggregating transforms)、计算dataframe数据的分组均值(mean)
Unlock 2 live broadcast themes in advance! Today, I will teach you how to complete software package integration Issues 29-30
Digital "new" operation and maintenance of energy industry
AIRIOT物联网平台赋能集装箱行业构建【焊接工位信息监控系统】
Human bone point detection: top-down (part of the theory)
Celery best practices
图之广度优先遍历
Execution process of MySQL query request - underlying principle
Implementation of AVL tree
openmv4 学习笔记1----一键下载、图像处理背景知识、LAB亮度-对比度
Specify flume introduction, installation and configuration